ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker SupportWEBSPHERE MQ WITH IIB User Exit - UNABLE TO MODIFY HEADERS

Post new topicReply to topic Goto page 1, 2, 3  Next
WEBSPHERE MQ WITH IIB User Exit - UNABLE TO MODIFY HEADERS View previous topic :: View next topic
Author Message
iibdevYANDEX
PostPosted: Fri Aug 11, 2017 2:51 pm Post subject: WEBSPHERE MQ WITH IIB User Exit - UNABLE TO MODIFY HEADERS Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 14

I have an IIB workflow that has a MQINPUT node that connects to a MQ manager and retrieves the incoming messages from a queue. In IIB I have a user exit that gets called when the input arrives. I am trying to add a key value pair to the MQ header (MQRFH2/usr) but it seems like the incoming header information is read only and any changes that I make to the CciMessage buffer coming in, just gets discarded. Could someone please provide some pointers as to how I can modify the MQ header to include the new fields?

Thanks!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sat Aug 12, 2017 6:45 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17446

That sounds very complicated.

Why do you need this set before it comes into the MQInput node?

Why are you trying to usean exit to do this?

Have you tried changing the properties instead of the mqrfh2?

Have you confirmed that your exits works without using IIB?
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
iibdevYANDEX
PostPosted: Mon Aug 14, 2017 7:10 am Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 14

Thanks for the reply.

Below is an example of the sample flow.

Q1 --> IIB (MQInput) --- > UpdateHeaderInUserExit---> MQOutput --- >Q2


Q2 ---> IIB (MQInput1) ---> UserExit reads the updated header .....

>>Have you tried changing the properties instead of the mqrfh2?
Not yet, I will try that

>>Have you confirmed that your exits works without using IIB?
Yes
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Aug 14, 2017 7:25 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24525
Location: Ohio, USA

I find it very hard to believe that there's anything you need to do that's not easier / better / faster more maintainable in IIB than in an MQ user exit, as my most worthy associate alludes to.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Mon Aug 14, 2017 5:25 pm Post subject: Re: WEBSPHERE MQ WITH IIB User Exit - UNABLE TO MODIFY HEADE Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1256

This topic belongs in the WMB/IIB forum.

Vitor wrote:
... MQ user exit ...

An IIB user exit is not the same thing as an MQ user exit.

iibdevYANDEX wrote:
I am trying to add a key value pair to the MQ header (MQRFH2/usr) but it seems like the incoming header information is read only and any changes that I make to the CciMessage buffer coming in, just gets discarded.

The user exit would need to modify the message tree, not the CciMessage buffer. The C user exit API contains more details about accessing and updating elements in the message tree.
Back to top
View user's profile Send private message
iibdevYANDEX
PostPosted: Tue Aug 29, 2017 3:42 pm Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 14

@rekarm01

Thanks for the reply. I realized that I posted this question in the wrong forum, apologies for that.

I believe the message tree is accessed via the incoming CciMessage buffer,
typedef void (*cciInputMessageCallback) (
CciDataContext* userContext,
CciMessage* message,
CciMessage* localEnvironment,
CciMessage* exceptionList,
CciMessage* environment,
CciMessageOrigin messageOrigin,
CciNode* inputNode);

Isn't the highlighted part the message tree? I tried modifying it, but once the message leaves the node, the update to the message tree is lot. Please correct me if I am wrong.

Thanks!
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Aug 30, 2017 4:37 am Post subject: Re: WEBSPHERE MQ WITH IIB User Exit - UNABLE TO MODIFY HEADE Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1256

rekarm01 wrote:
The user exit would need to modify the message tree, not the CciMessage buffer.

Ok, the term "CciMessage buffer" was confusing. There is no such thing as a "CciMessage buffer". There is a CciMessage pointer, and there is a cniBufferPointer; the user exit should not try to modify either of them.

iibdevYANDEX wrote:
I believe the message tree is accessed via the incoming CciMessage buffer,
Code:
typedef void (*cciInputMessageCallback) {
    CciDataContext * userContext,
    CciMessage * message,
...

"message" is a pointer to a message tree structure. The callback function can't modify the pointer directly, because it's just a copy. It has to use the C node utility functions to navigate the message tree, and add elements to it.

iibdevYANDEX wrote:
I tried modifying it, but once the message leaves the node, the update to the message tree is lost.

Without seeing any code, it's difficult to tell what went wrong.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Aug 30, 2017 5:02 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19296
Location: LI,NY

Are you sure that the CciDataContext is a usercontext and not a messagecontext, such as message, message + local environment, local environment only, etc... ?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
iibdevYANDEX
PostPosted: Wed Aug 30, 2017 9:01 am Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 14

I am trying this with a simple workflow.

1.) JMSInput node receives a message
a. UserExit tries to add a key value pair and the flow continues to
JMSOutput node.
2.) The JMSOutput node puts this updated message into another queue "QOUT"
3.) Another JMSInput node receives the message from "QOUT", but when I read the message tree, I cannot see the key value pair I inserted.

This is what the message tree structure looks like https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ac24865_.htm

Below is a sample snippet where I am trying to add a new key value pair to the Applicaiton_Properties node in the incoming message.

Code:

void inputCallBack(CciDataContext*  userContext,
        CciMessage*      message,
        CciMessage*      localEnvironment,
        CciMessage*      exceptionList,
        CciMessage*      environment,
        CciMessageOrigin messageOrigin,
        CciNode*         inputNode)
{
  setKeyValue(message)
}

void setKeyValue(CciMessage* message)
{
  int rc = CCI_SUCCESS;

  CciElement* root = cniRootElement(&rc, message);
  char nodeName[3][32] = {"JMSTransport","Transport_Folders","Application_Properties"}
  CciElement* element = 0;

  for(int i=0; i<3; i++)
  {
     element = findChildByName(nodeName[i], root);
     root = element;
  }

  CciChar conversionBuf[32];
  cciMbsToUcs(&rc, "testKey", conversionBuf, 32, UNIX_NT_CCSID);
 
  CciElement* newElement = cniCreateElementAsFirstChild(&rc, root);
  cniSetElementType(&rc, newElement, CCI_ELEMENT_TYPE_NAME_VALUE);
  cniSetElementName(&rc, newElement, conversionBuf);

  cciMbsToUcs(&rc, "testValue", conversionBuf, 32, UNIX_NT_CCSID);
  cniSetElementCharacterValue(&rc, newElement, conversionBuf, 10);
}


If I iterate through the "message" using the utility functions, right after the above piece of code is run, I can see the key value pair. But once this enters the workflow, I can no longer see the new entry
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Aug 30, 2017 12:45 pm Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19296
Location: LI,NY

What is the value of the CciDataContext and what is the meaning of that value ?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Wed Aug 30, 2017 6:34 pm Post subject: Re: WEBSPHERE MQ WITH IIB User Exit - UNABLE TO MODIFY HEADE Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1256

iibdevYANDEX wrote:
This is what the message tree structure looks like https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ac24865_.htm

Before it was an MQInput node and an MQRFH2 header, now it's a JMSInput node with JMSTransport headers? Or is this a different message flow? It might be useful to put a Trace node after the input node, to display the message header elements.

iibdevYANDEX wrote:
Below is a sample snippet where I am trying to add a new key value pair to the Applicaiton_Properties node in the incoming message.

Whenever calling a utility or implementation function, check the return code, to confirm that the function call completed successfully. For example, if the findChildByName() function (whatever that is) failed to find an element named "Application_Properties", because it didn't exist, then all the subsequent functions that depend on that element will fail too.

iibdevYANDEX wrote:
Code:
cciMbsToUcs(&rc, "testValue", conversionBuf, 32, UNIX_NT_CCSID);
cniSetElementCharacterValue(&rc, newElement, conversionBuf, 10);

What is UNIX_NT_CCSID? "testValue" has only nine characters. The element value should not need a null terminator.

iibdevYANDEX wrote:
If I iterate through the "message" using the utility functions, right after the above piece of code is run, I can see the key value pair.

The utility functions don't display anything. How are you "seeing" key value pairs? Can you post what you're seeing?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 31, 2017 4:05 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17446

The other really important point is that you make sure your message data is actually passed through the rest of your flow to the first JMSOutput node.

Put a TraceNode right before that.

If you see your data in the message structure, then make sure your data belongs to a parser, such that it will be serialized into the outbound message.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
iibdevYANDEX
PostPosted: Thu Aug 31, 2017 10:15 pm Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 14

@rekarm01 , thank you for the reply.

Quote:

iibdevYANDEX wrote:
This is what the message tree structure looks like https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ac24865_.htm

Before it was an MQInput node and an MQRFH2 header, now it's a JMSInput node with JMSTransport headers? Or is this a different message flow? It might be useful to put a Trace node after the input node, to display the message header elements.


Sorry, I didn't mean to create confusion. This is a different flow, but I am seeing similar behavior with both. I am unable to add a key value pair to either
MQRFH2/usr
(or)
JMSTransport/Transport_Folders/Application_Properties

Quote:
Whenever calling a utility or implementation function, check the return code, to confirm that the function call completed successfully. For example, if the findChildByName() function (whatever that is) failed to find an element named "Application_Properties", because it didn't exist, then all the subsequent functions that depend on that element will fail too.


I do check the return code, each time. I just didn't put it in here for conciseness. I can confirm that none of the calls are failing.


Quote:
The utility functions don't display anything. How are you "seeing" key value pairs? Can you post what you're seeing?

I used the utility function "cniFirstChild", "cniElementName" and "cniNextSibling" to print the elements in the message tree.

Here is what the "message" looks like before and after calling the setKeyValue () method (i've not included every node to keep the post shorter.

Before:
1: elementName:Properties
2: elementName:MessageSet
2: elementName:MessageType
...
1: elementName:JMSTransport
2: elementName:Transport_Folders
3: elementName:Message_MetaData
4: elementName:PayloadType
5: elementName:
4: elementName:MessagePersistence
5: elementName:
3: elementName:Header_Values
4: elementName:JMSDestination
...
3: elementName:Application_Properties
3: elementName:JMS_Provider_Properties
3: elementName:Standard_Properties
1: elementName:XML

After:
1: elementName:Properties
2: elementName:MessageSet
2: elementName:MessageType
...
1: elementName:JMSTransport
2: elementName:Transport_Folders
3: elementName:Message_MetaData
4: elementName:PayloadType
5: elementName:
4: elementName:MessagePersistence
5: elementName:
3: elementName:Header_Values
4: elementName:JMSDestination
...
3: elementName:Application_Properties
4: elementName:testkey
5: elementName:
3: elementName:JMS_Provider_Properties
3: elementName:Standard_Properties
1: elementName:XML


Last edited by iibdevYANDEX on Fri Sep 01, 2017 3:47 pm; edited 1 time in total
Back to top
View user's profile Send private message
iibdevYANDEX
PostPosted: Thu Aug 31, 2017 10:17 pm Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 14

@mqjeff, thank you for the suggestion.

I will add the traceNode to check if the updated message is flowing through the nodes.
Back to top
View user's profile Send private message
iibdevYANDEX
PostPosted: Fri Sep 01, 2017 3:46 pm Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 14

@mqjeff

I put trace nodes to output the message tree and I DO see the newly inserted key value pair

Code:
( ['GENERICROOT' : 0x7f91101879b0]
  (0x01000000:Name      ):Properties   = ( ['MQPROPERTYPARSER' : 0x7f91102b5640]
    (0x03000000:NameValue):MessageSet             = '' (CHARACTER)
    (0x03000000:NameValue):MessageType            = '' (CHARACTER)
    (0x03000000:NameValue):MessageFormat          = '' (CHARACTER)
    (0x03000000:NameValue):Encoding               = 0 (INTEGER)
    (0x03000000:NameValue):CodedCharSetId         = 1208 (INTEGER)
    (0x03000000:NameValue):Transactional          = TRUE (BOOLEAN)
    (0x03000000:NameValue):Persistence            = FALSE (BOOLEAN)
    (0x03000000:NameValue):CreationTime           = NULL
    (0x03000000:NameValue):ExpirationTime         = NULL
    (0x03000000:NameValue):Priority               = 0 (INTEGER)
    (0x03000000:NameValue):ReplyIdentifier        = NULL
    (0x03000000:NameValue):ReplyProtocol          = 'JMS' (CHARACTER)
    (0x03000000:NameValue):Topic                  = NULL
    (0x03000000:NameValue):ContentType            = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourceType     = NULL
    (0x03000000:NameValue):IdentitySourceToken    = NULL
    (0x03000000:NameValue):IdentitySourcePassword = NULL
    (0x03000000:NameValue):IdentitySourceIssuedBy = NULL
    (0x03000000:NameValue):IdentityMappedType     = NULL
    (0x03000000:NameValue):IdentityMappedToken    = NULL
    (0x03000000:NameValue):IdentityMappedPassword = NULL
    (0x03000000:NameValue):IdentityMappedIssuedBy = NULL
  )
  (0x01000010:ParserRoot):JMSTransport = ( ['jms_transport' : 0x7f91101de750]
    (0x01000000:Element):Transport_Folders = (
      (0x01000000:Element):Message_MetaData        = (
        (0x01000000:Element):PayloadType        = (
          (0x02000000:pcdata): = 'jms_text' (CHARACTER)
        )
        (0x01000000:Element):MessagePersistence = (
          (0x02000000:pcdata): = 'Non_Persistent' (CHARACTER)
        )
      )
      (0x01000000:Element):Header_Values           = (
        (0x01000000:Element):JMSDestination   = (
          (0x02000000:pcdata): = 'IN.Q' (CHARACTER)
        )
        (0x01000000:Element):JMSDeliveryMode  = (
          (0x03000000:Attribute):dt = 'i4' (CHARACTER)
          (0x02000000:pcdata   ):   = 1 (INTEGER)
        )
        (0x01000000:Element):JMSExpiration    = (
          (0x03000000:Attribute):dt = 'i8' (CHARACTER)
          (0x02000000:pcdata   ):   = 0 (INTEGER)
        )
        (0x01000000:Element):JMSPriority      = (
          (0x03000000:Attribute):dt = 'i4' (CHARACTER)
          (0x02000000:pcdata   ):   = 0 (INTEGER)
        )
        (0x01000000:Element):JMSTimestamp     = (
          (0x03000000:Attribute):dt = 'i8' (CHARACTER)
          (0x02000000:pcdata   ):   = 1504308505369 (INTEGER)
        )
        (0x01000000:Element):JMSMessageID     = (
          (0x02000000:pcdata): = 'ID:localhost.localdomain-33683-1504281526804-3:3:1:1:5' (CHARACTER)
        )
        (0x01000000:Element):JMSCorrelationID = (
          (0x02000000:pcdata): = '' (CHARACTER)
        )
        (0x01000000:Element):JMSReplyTo       = (
          (0x02000000:pcdata): = ' ' (CHARACTER)
        )
        (0x01000000:Element):JMSType          = (
          (0x02000000:pcdata): = '' (CHARACTER)
        )
        (0x01000000:Element):JMSRedelivered   = (
          (0x03000000:Attribute):dt = 'boolean' (CHARACTER)
          (0x02000000:pcdata   ):   = '0' (CHARACTER)
        )
      )
      (0x01000000:Element):Application_Properties  = (
       [b] (0x03000000:Attribute):testkey = 'testvalue' (CHARACTER)[/b]
      )
      (0x01000000:Element):JMS_Provider_Properties =
      (0x01000000:Element):Standard_Properties     =
    )
  )
  (0x01000010:ParserRoot):XML          = ( ['xml' : 0x7f911024a6c0]
    (0x01000000:Element):note = (
      (0x01000000:Element):to      = (
        (0x02000000:pcdata): = 'hello' (CHARACTER)
      )
      (0x01000000:Element):from    = (
        (0x02000000:pcdata): = 'world' (CHARACTER)
      )
      (0x01000000:Element):heading = (
        (0x02000000:pcdata): = 'IIB' (CHARACTER)
      )
      (0x01000000:Element):body    = (
        (0x02000000:pcdata): = 'HelloWorld!' (CHARACTER)
      )
    )
  )
)
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page 1, 2, 3  Next Page 1 of 3

MQSeries.net Forum IndexWebSphere Message Broker SupportWEBSPHERE MQ WITH IIB User Exit - UNABLE TO MODIFY HEADERS
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.