Wednesday, October 9, 2013

In this post, I will show you how you can set custom JMS header properties in Mediator and BPEL components.

By Default a JMS message includes a number of header fields that contain information used to identify and route messages. The supported headers for an incoming message are:

Ø   JMSCorrelationID
Ø   JMSDeliveryMode
Ø   JMSExpiration
Ø   JMSMessageID
Ø   JMSPriority
Ø   JMSRedelivered
Ø   JMSTimestamp
Ø   JMSType

But we can also set Custom properties.

Mediator: To set custom JMS header property in Mediator follows below steps.

Ø  Open .mplan file and click on assign activity. Here we are defining new custom header property (city).
Ø  To set city custom header property choose “jca.jms.JMSProperty” and append “.city” to it. You can assign any expression or hard-code this property value.






  
BPEL: To set custom JMS header property in BPEL follows below steps.
·         Go to *.bpel file, check the invoke code and add a new property called jca.jms.JMSProperty.city, for instance:

<invoke name="Invoke1" inputVariable="Invoke1_Produce_Message_InputVariable"
            partnerLink="Produce_Message" portType="ns1:Produce_Message_ptt"
            operation="Produce_Message" bpelx:invokeAsDetail="no">
              <bpelx:inputProperty name="jca.jms.JMSProperty.city" variable="cityVar"/>
 </invoke>

  


Currently this property is equal to cityVar but you can also use expression to assign value to city property.

              <bpelx:inputProperty name="jca.jms.JMSProperty.city" expression="2"/>

Remember you will not find this property in header tab, you need to manually set this property in *.bpel file for specific invoke.

When you will run the composite, you will see custom JMS header property at admin console for that queue.






0 comments :

Post a Comment