Introduction
In my previous 3 blogs about integration using JMS Queue, have covered:
- JMS connector setup, inbound and outbound jms queues, and message selector
- JMS request and response patterns
- Request and response pattern using request-reply scope
In this article, I will cover how to set the outbound JMS message properties.
Set Single Property
To set a single property for the JMS message, we can use the "property" transformer as should in the following diagram:Set Multiple Properties
To set multiple properties, we need to use message property transfromer:1 2 3 4 | < message-properties-transformer name = "Message_Properties" doc:name = "Message Properties" > < add-message-property key = "TYPE" value = "ORDER" > < add-message-property key = "DEST" value = "#[message.inboundProperties.source_id]" > </ add-message-property ></ add-message-property ></ message-properties-transformer > |
Complete Flow
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | <!--xml version="1.0" encoding="UTF-8"?--> < mule xmlns:dw = "http://www.mulesoft.org/schema/mule/ee/dw" xmlns:http = "http://www.mulesoft.org/schema/mule/http" xmlns:jms = "http://www.mulesoft.org/schema/mule/jms" xmlns:tracking = "http://www.mulesoft.org/schema/mule/ee/tracking" xmlns = "http://www.mulesoft.org/schema/mule/core" xmlns:doc = "http://www.mulesoft.org/schema/mule/documentation" xmlns:spring = "http://www.springframework.org/schema/beans" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd"> < message-properties-transformer name = "Message_Properties" doc:name = "Message Properties" > < add-message-property key = "TYPE" value = "ORDER" > < add-message-property key = "DEST" value = "#[message.inboundProperties.source_id]" > </ add-message-property ></ add-message-property ></ message-properties-transformer > < flow name = "Simple-One-Way-Main_Flow" > < http:listener config-ref = "HTTP_Listener_Configuration" path = "/jms/oneway" doc:name = "HTTP" > < dw:transform-message doc:name = "Transform Message" > < dw:set-payload > <!--[CDATA[%dw 1.0 %output application/java --- payload]]--> </ dw:set-payload > </ dw:transform-message > < set-property propertyname = "source_id" value = "#[message.inboundProperties.source_id]" doc:name = "Property" > < jms:outbound-endpoint queue = "order.queue" connector-ref = "Active_MQ" doc:name = "Order Queue Producer" > < jms:selector expression = "source_id='ATG'" > </ jms:selector ></ jms:outbound-endpoint > </ set-property ></ http:listener ></ flow > < flow name = "Process_Order_Flow" > < jms:inbound-endpoint queue = "order.queue" connector-ref = "Active_MQ" doc:name = "Order Queue Consumer" > < jms:selector expression = "source_id='ATG'" > </ jms:selector ></ jms:inbound-endpoint > < logger message = "Process_Order_Flow CID: #[message.correlationId]" level = "INFO" doc:name = "Logger" > < set-property propertyname = "SOURCE_ID" value = "#[message.inboundProperties.source_id]" doc:name = "Property" > < jms:outbound-endpoint queue = "order.special.queue" connector-ref = "Active_MQ" doc:name = "Special Queue Producer" transformer-refs = "Message_Properties" > </ jms:outbound-endpoint > </ set-property ></ logger ></ flow > </ mule > |
Thanks for your information with graphically and code Mulesoft online training
ReplyDeleteThe article provided by you is very nice and it is very helpful to know the more information.keep update with your blogs .I found a article related to you..once you can check it out
ReplyDeleteMulesoft online training india
the blog is good and Interactive it is about Mulesoft API Developer it is useful for students and Mulesoft Developers for more updates on Mulesoft mulesoft Online training bangalore
ReplyDelete