cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IBM Message ID as Return Value

Babar_Qayyum
Leader

Hello Dears,

How to capture a messageId as a return value from the IBM Class (com.ibm.mq.MQDestination) and Method put(com.ibm.mq.MQMessage message, com.ibm.mq.MQPutMessageOptions putMessageOptions)?

Regards,

Babar

7 REPLIES 7

Radu
Dynatrace Pro
Dynatrace Pro

Hi Babar,

You will have to create a custom method sensor for the put method. In the rule that the method sensor creates you must enable capturing of return value. The returned value will be a representation of the object type the return value belongs to (for example if you will have a Object type return, it will most likely return an internal ID of the object); so if you need to use another method on the return in order to get a relevant value (such as .getName() or .toString() or any other applicable method) this can be added in the accessor field.

This can be done either by right clicking your system profile, choosing Edit System Profile, then from the list on the left choosing Sensors, Browse, and finding the method in the generated list:

Or by right clicking the method from within a PurePath tree, and choosing option "add sensor rule" followed by "Include selected methods...".

Once the method rule is created, just make sure to check the box for return value and add any accessor method required to capture the value in a relevant way:

Let me know if you have any other queries.

Regards,

Radu

Babar_Qayyum
Leader

Hello Radu,

We practiced the same without putting any accessor, but unfortunately no luck.
Can you guide me that which method should I put in the accessor field to catch the messageId?

Regards,

Babar

Babar, I have looked up the javadoc for the class (http://www.ibm.com/support/knowledgecenter/SSFKSJ_...

The put(MQMessage, MQPutMessageOptions) method is of type void, meaning that it doesn't return anything.

Is this messageId an attribute of the MQMessage argument of the put method instead of its return?

I see on the docs that this MessageId is a String property of the MQMessage class.
So, to capture this, please try the following:

- disable the 'Method return values will be captured' - there are no return values

- in the list of arguments, next to "com.ibm.mq.MQMessage", check the box in the column called "Capture", and next to it in the accessor field write ".getStringProperty("MessageId")"

Hello Radu,

Thank you for your assistance.

I tried the same but accessor is not accepting. Please see the below screenshot:

Regards,

Babar

Unfortunately there is no other way. The getStringProperty method must have a string with the name of the property.

Hi Radu,

Thank you for all this effort and assistance.

Regards,

Babar