Day-6 JMS and DB Insert

Configure JMS queue in Mule flow. we are using ActiveMQ JMS implementation for this demo.

  • Download  ActiveMQ from http://activemq.apache.org/download.html
  • Navigate to the path of activeMq
  • C:\xxxxx\apache-activemq-5.14.2-bin\apache-activemq-5.14.2\bin\win64
  • start ActiveMq messging server by giving command as >activemq
  • Configure ActiveMq to Anypoint studio
  • Drag and drop JMS icon to canvas
  • JMS
  • the properties as below. select the exchange pattern one-way or request-response based on requirement and provide queue namejms-2
  • Provide queue name and click on + icon
  • jms-3
  • provide username and password as admin/admin
  • Configuration complete

Demo-1: JMS as outbound endpoint.

send a request to mule flow where JMS queue configured as outbound endpoint

Jms-4

Import and execute the project, analyze the ActiveMQ console at

http://localhost:8161/admin/index.jsp

open the queues tab to see the queue details.

Demo-2 JMS as Inbound.

Design a flow that initiates from the JMS queue.

JMS-5

download and execute the project jmsreceiver.

Use ActiveMQ console to send the message to JMS queue. by clicking “Send” menu item on ActiveMQ home page

JMS-6

 

 

DB Insert Program:

Use Expression transformer to retrieve the fields from the payload. expression transformer will create new outbound endpoint properties. and populates them using Mule expression language.

DB_Insert1

DB-Insert-2

Import the project DBInsertDemo  to the Anypoint  and run the flow

Test the flow with Postman or SOAPUI using the payload

<?xml version=”1.0″ encoding=”UTF-8″?>
<MovieDetail>
<movieCode>robo</movieCode>
<movieName>robo</movieName>
<director>Raj</director>
<hero>HYD</hero>
<releaseDate>2017-05-28</releaseDate>
<status>HYD</status>
</MovieDetail>

makesure you selected mime type as application/xml while sending the request.

4) Analyze the Iterating the ResultSet and sending each record as JMS message in DBdemo projectDB-Iterate

The Demo projects available at Day-6.zip

https://drive.google.com/drive/folders/0B7kdTdRlWaF_TVhOaTk1cDVEYzQ

2 thoughts on “Day-6 JMS and DB Insert

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s