In this post we will elaborate how to select messages from the JMS queue based on certain selection criteria. To do this we need to add a JMS message header property while publish the message. Depending upon same we can filter out the message while consuming the message through a JMS adapter.
While transferring the JMS message the server by default adds some of the JMS header properties, however we can set our own custom JMS header property also for our requirement.
To add a custom JMS property in the JMS message header we need to use inputProporty tag in the invoke activity of *.bpel file. The corresponding value we can pass through a variable or an expression. Consider the below code snippet,
<invoke name="InvkJMSProduceMsg"
inputVariable="InvkJMSProduceMsg_Produce_Message_InputVariable"
partnerLink="JMSProduceMsg" portType="ns2:Produce_Message_ptt"
operation="Produce_Message" bpelx:invokeAsDetail="no">
<bpelx:inputProperty name="jca.jms.JMSProperty.depid" variable="deptidVar"/>
</invoke>
<invoke name="InvkJMSProduceMsg"
inputVariable="InvkJMSProduceMsg_Produce_Message_InputVariable"
partnerLink="JMSProduceMsg" portType="ns2:Produce_Message_ptt"
operation="Produce_Message" bpelx:invokeAsDetail="no">
<bpelx:inputProperty name="jca.jms.JMSProperty.depid" expression="10"/>
</invoke>
In the above screenshot jca.jms.JMSProperty.depid is the custom JMS header Property whose value will be visible at EM console as shown below.
Now to consume messages as per certain criteria we need to set the Message selector defined in JMS adapter.
Here depid is the JMS header custom property which was set at the time of producing message in JMS Queue.
After this configuration of JSM adapter it will poll only the required messages from the JSM Queue depending upon the deptid value.
Let us know your valuable feedback.
While transferring the JMS message the server by default adds some of the JMS header properties, however we can set our own custom JMS header property also for our requirement.
To add a custom JMS property in the JMS message header we need to use inputProporty tag in the invoke activity of *.bpel file. The corresponding value we can pass through a variable or an expression. Consider the below code snippet,
<invoke name="InvkJMSProduceMsg"
inputVariable="InvkJMSProduceMsg_Produce_Message_InputVariable"
partnerLink="JMSProduceMsg" portType="ns2:Produce_Message_ptt"
operation="Produce_Message" bpelx:invokeAsDetail="no">
<bpelx:inputProperty name="jca.jms.JMSProperty.depid" variable="deptidVar"/>
</invoke>
<invoke name="InvkJMSProduceMsg"
inputVariable="InvkJMSProduceMsg_Produce_Message_InputVariable"
partnerLink="JMSProduceMsg" portType="ns2:Produce_Message_ptt"
operation="Produce_Message" bpelx:invokeAsDetail="no">
<bpelx:inputProperty name="jca.jms.JMSProperty.depid" expression="10"/>
</invoke>
In the above screenshot jca.jms.JMSProperty.depid is the custom JMS header Property whose value will be visible at EM console as shown below.
Now to consume messages as per certain criteria we need to set the Message selector defined in JMS adapter.
Here depid is the JMS header custom property which was set at the time of producing message in JMS Queue.
After this configuration of JSM adapter it will poll only the required messages from the JSM Queue depending upon the deptid value.
Let us know your valuable feedback.
Thanks for the post and the way explain
ReplyDelete