Reputation:
I am new to Mule and JMS. Just trying to figure out how to add a JMS end-point with a connector. Is there any JMS implementation provided by Mule or do I need to use an external JMS provider.
Upvotes: 1
Views: 3336
Reputation: 1
Drag out another HTTP connector and drop it in the canvas to create a new flow. Give the flow a new name of postTopicMessageFlow. In the HTTP Properties view, set the connector configuration to the existing HTTP_Listener_Configuration. Set the path to /jms and the allowed methods to GET. Drag out another JMS connector and drop it into the process section of the flow. In the JMS Properties view, select topic and set it to jms connectivity. Set the connector configuration to the existing Active_MQ. If you see an Attribute ‘action’ is required warning, ignore it. Add a Set Payload transformer between the HTTP and JMS connector endpoints. In the Set Payload Properties view, change the display name to Set Message and set the value to a message query parameter. Add a breakpoint to the Set Payload transformer. Add a Property transformer after the Set Payload transformer. In the Properties view, change the display name to Set Name. Select Set Property and set the name to name and the value to your name. Note: You can set this to a query parameter instead if you prefer. Save the file to redeploy the application and make a request to http://localhost:8081/jms?message=Hello. Look at the console;; you should see your name and message displayed – along with those of your classmates.
Upvotes: 0
Reputation: 8311
A simple example will be :-
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
To send a message to a queue :-
<flow name="JmsSendFlow" doc:name="JmsSendFlow" >
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP"/>
<set-payload value="Test Data" />
<jms:outbound-endpoint queue="StudioOUT" connector-ref="Active_MQ" doc:name="JMS"/>
</flow>
To receive message from the queue :-
<flow name="JmsReceiveFlow" doc:name="JmsReceiveFlow" >
<jms:inbound-endpoint queue="StudioOUT" connector-ref="Active_MQ1" exchange-pattern="one-way"/>
<logger message="Message received#[message.payload]" level="INFO" doc:name="Logger"/>
</flow>
For more information about JMS:- http://blogs.mulesoft.com/dev/newbie/mule-school-jms-tutorial/
Upvotes: 1
Reputation: 6647
Here is the ActiveMQ usage guide for Mule JMS connector.
Mule ActiveMQ integration http://www.mulesoft.org/documentation/display/MULE3USER/ActiveMQ+Integration
This should help.
Upvotes: 0