cancel
Showing results for 
Search instead for 
Did you mean: 

Get Message details in custom adapter module

shweta_walaskar
Participant
0 Kudos

Hello,

Could you please let me know how can we retrieve following parameters in custom adapter module?

Message size

Message Mapping name

Operation Mapping name

Sender and Receiver Interface names

Thanks!

Regards,

Shweta

Accepted Solutions (1)

Accepted Solutions (1)

engswee
Active Contributor

Hi Shweta

Not all the information is available directly from the adapter module.

Message size

Retrieve the input stream of the payload, convert the stream to bytes and count the bytes length.


Message msg = (Message) inputModuleData.getPrincipalData();

XMLPayload payload = msg.getDocument();

InputStream inStr = payload.getInputStream();

// Convert inStream to bytes

int size = bytes.length;

Sender and Receiver interface names

You can only get Sender interface in sender module, and receiver interface in receiver module. You can get the from the getAction() method.


Message msg = (Message) inputModuleData.getPrincipalData();

String interfaceName = msg.getAction().getName();

Operation Mapping name

This is not directly available from the Adapter Framework. One workaround is to access this via the Integration Directory API. With the Interface Determination Service API, you can read the Interface Determination object to get the associated mapping. To do this you have to make a SOAP call to the API.

Message Mapping name

I'm not sure how this can be retrieved as this is only available in ESR.

If the module is on the receiver side, another option is to extract the information during mapping and store it into Dynamic Configuration, then in the receiver module, to extract it from Dynamic Configuration.

Rgds

Eng Swee

shweta_walaskar
Participant
0 Kudos

Hi Eng,

Thanks a lot for the details.

The problem with message size with this approach is, the value we get is totally different from the one we see in Message Monitoring under Message Details tab.

For example, I get 562 when under Message Details tab, its 6638.

Not sure, where this difference come from.

Regards,

Shweta

engswee
Active Contributor
0 Kudos

Hi Shweta

I think the Message Size calculated in the monitor includes the SOAP header and body.

Rgds

Eng Swee

shweta_walaskar
Participant
0 Kudos

Hi Eng,

Would it then be possible to get this value(including SOAP Header)?

When we calculate it with payload as you have described here, in case of synchronous messages, would it only be the size of request message or both request and response?

Thanks for your help.

Regards,

Shweta

engswee
Active Contributor
0 Kudos

Hi Shweta

Unfortunately, I am not aware of any way to get the whole SOAP header and body. The JavaDocs for Message does not seem to list any methods to retrieve the whole SOAP section, only specific header fields.


During runtime, the module has access to only 1 message, either the request or the response. If you want both, you will need to have a module before the adapter call is executed (to get request size) and another after the adapter is executed (to get the response size.)


Rgds

Eng Swee

shweta_walaskar
Participant
0 Kudos

Hi Eng,

Thanks a lot for providing details.

It has been quite helpful to me.

Regards,

Shweta

engswee
Active Contributor
0 Kudos

Hi Shweta

Glad to hear that the information have been helpful.

Rgds

Eng Swee

Answers (0)