Search This Blog

SOA 11g- Set Custom JMS Header properties In Mediator & BPEL

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.




Message Selector Proprty in JMS :


I will show you how to set Message Selector property in JMS adapter to filter the incoming message based on custom JMS header property.We use Message Selector property when your messaging application needs to filter the messages it receives.

 This field is also optional. It filters messages based on header and property information. The message selector rule is a Boolean expression. If the expression is true, then the message is consumed. If the expression is false, then the message is rejected. 

For example, you can enter logic, such as:  city in ( 'Mohali', 'Mumbai', 'Delhi')


Message Selector Property
I explained how to set custom JMS header property. In this post I will show you how to set Message Selector property in JMS adapter to filter the incoming message based on custom JMS header property.
We use Message Selector property when your messaging application needs to filter the messages it receives.
This field is also optional. It filters messages based on header and property information. The message selector rule is a Boolean expression. If the expression is true, then the message is consumed. If the expression is false, then the message is rejected.
For example, you can enter logic, such as:
·         city in (‘Mohali’, 'Mumbai', 'Delhi')
·         city=’Mohali’

To set the Message selector property, open JMS adapter configuration Wizard. Here you can set Message selector property as shown in below diagram.
- See more at: http://soawork.blogspot.de/2013/10/message-selector-property-jms-adapter.html#sthash.eBG71n2u.dpuf

No comments:

Post a Comment