Author |
Message
|
binayak.nanda |
Posted: Sat Nov 01, 2014 11:08 pm Post subject: Setting MQMD ApplIdentityData in java Compute Node . |
|
|
Novice
Joined: 29 Oct 2014 Posts: 17
|
Hi All ,
I am new to IIB v9.0 . I am facing a problem that in a java compute node i am generating a reference id of integer . I want to pass that id to all the flows . I want to set it in MQMD ApplIdentityData field . In my message MQMD does not exist as I am getting null when i am calling outMessage.getRootElement().getFirstElementByPath(
"MQMD/ApplIdentityData") . I have to create MQMD and set ApplIdentityData field to that number . I have done like this
MbElement root = outMessage.getRootElement();
MbElement mqmd = root.createElementAsFirstChild("MQMD");
MbElement appIdentityData = mqmd.createElementAsFirstChild(
MbElement.TYPE_NAME_VALUE, "ApplIdentityData", refId);
It is not working . I have done wrong here . Please suggest me how to set refId to ApplIdentityData of MQMD .
Thanks,
Binayak |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Nov 01, 2014 11:38 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You do realize that the application identity may not be the first field of the MQMD. Why don't you use an MQHeader node to set the MQMD? You can then retrieve the application identity data and set it. Don't forget to look at the flags to allow the set appid data. Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
binayak.nanda |
Posted: Mon Nov 03, 2014 11:45 pm Post subject: |
|
|
Novice
Joined: 29 Oct 2014 Posts: 17
|
I added MQHeader Node and create ApplIdentityData field as first child as initially it was not there in properties and populated data to it . It successfully worked in the same flow throughout . But when next flow starts ApllIdentityData is changed to blank and also its location changed in MQMD tree .Initially i created in 1st location of MQMD Tree. I think a new MQMD created for that flow . I need that data to be there in ApplIdentityData field throughout all flows . Please suggest how to do .
Thanks,
Binayak |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 04, 2014 6:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to accept that the MQMD is a fixed-length structure with fields in a specific order.
You need to accept that the MQMD parser in IIB will serialize and parse the MQMD properly.
And so you should always access fields under the MQMD by name, not by position.
You need to understand how and under what conditions MQ lets you modify various fields under the MQMD based on the options used when you PUT the message. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 04, 2014 6:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
binayak.nanda wrote: |
But when next flow starts ApllIdentityData is changed to blank and also its location changed in MQMD tree . |
The fields in an MQMD are of fixed length and fixed position, and the ApplIdentityData is never the first field. The MQMD is a message descriptor, so when you start a new flow (with a new message) you get a new MQMD.
binayak.nanda wrote: |
Initially i created in 1st location of MQMD Tree. |
Wrong move - see above.
binayak.nanda wrote: |
I think a new MQMD created for that flow . |
Yes - see above
binayak.nanda wrote: |
I need that data to be there in ApplIdentityData field throughout all flows . Please suggest how to do . |
Store it external to your flows and add it to each new message. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zpat |
Posted: Tue Nov 04, 2014 9:18 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Use the MQHeader node as suggested.
Avoid coding whenever possible, especially in Java! ESQL is much better.
The entire point of WMB or IIB is to gain development efficiency by not coding (much). If you want an application server, there is WAS. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
martinb |
Posted: Wed Nov 05, 2014 1:37 am Post subject: |
|
|
Master
Joined: 09 Nov 2006 Posts: 210 Location: UK
|
binayak.nanda wrote: |
I added MQHeader Node and create ApplIdentityData field ... It successfully worked in the same flow throughout . But when next flow starts ApllIdentityData is changed to blank ... I need that data to be there in ApplIdentityData field throughout all flows . Please suggest how to do .
Thanks,
Binayak |
If you want to have a Message Flow MQOutput node to be passing specific ApplIdentityData and other context values you need to be looking at setting the MQOutput node options such as "Message Context" or "Alternate User Authority". |
|
Back to top |
|
 |
|