Topics to be covered
Publish/Subscribe
Topic and content base filtering
JMS integration using ActiveMQ
File transport
Mule provide easy integration with ActiveMQ for using it as a jms broker.
Install ActiveMQ
Please go to the official web page: http://activemq.apache.org/ and get the latest version
Start the server running the following command: $> [activemq-directory]/bin/activemq
Check that active-mq is running by going to the administration web console: http://localhost:8161/admin/
Find also in our local server:
Integrate Mule with ActiveMQ
Create a folder inside your mule project called lib, put the activemq-core-5.5.0.jar (located in mule lib folder) inside the folder.
Refresh your project folder and add the jar to the buld path by RightClick on the jar ->BuildPath->AddtoBuildPath
In your configuration file, point the brokerURL to the uri where ActiveMQ is running. This is set in the jms connector property:
<jms:activemq-connector name="jmsConnector" brokerURL="tcp://localhost:61616" />
Listo, now you are ready to work with jms transport on mule.
For more information on available mule transports (jms,file,etc), go to:
http://www.mulesoft.org/documentation/display/MULE3USER/Available+Transports
Create a esb application with an endpoint that receives from the standard input a string and send it to a topic using pub/sub jms.
The application should contain also another service component subscribed to the topic. Each message received in the topic should be sent to the standard output.
Solve the following scenario with an esb application using pub/sub
Every Monday morning the Price Manager of a company sends a CSV file that contains the list of products with their respective price and discount for the rest of the week to the Marketing Manager. The company has a lot of retail-stores and clients that are interested on getting the product discounts. Some people needs the complete list and others only want to receive the products with higher discount.
The MM would like to put the file into a specific folder and then let the application send the information to everyone who is interested on receiving the information.
ESB approach
Create an esb application that checks every second if a new file is added into a specific folder (pricelist). We expect only CSV files, therefore the application has to filter out files that are not csv.
Once the file is received, the systems will process the file and converts the content to string using standard transformer, and finally sends the data to a topic product-list where the clients are subscribed to.
The application will send also the products that contains a discount over a 30% to a different topic called on-sale. This process will be done by defining a component that is subscribed on the topic product-list, process the data by selecting only the records that contains more than 30% discount, and send them to the topic on-sale.
Topics to be covered
Publish/Subscribe
Webservice exposition
Transformers
POJO and xml over jms
Develop a esb application using pub/pub that solves the following scenario
A group of people from different museums want to collaborate each other on collecting information/comments over different objects. They need a way where everyone can send the information to be distributed to all the partners.
The information (record) will contain two vars:
object_uri (String): containing the URI of the object (Example: http://myimages.net/233.png
description (String): the description of the object (Example: This was the first church...)
The information will be sent from different devices (including mobile, tablets, etc), therefore we will provide a webservice interface for let them send their records.
The record will be processed by the esb and transformed into a XML format, and send to the topic record-partners where the partners are subscribed to.
Use CXF for exposing your component as webservice. See http://www.mulesoft.org/documentation/display/MULE3USER/Building+Web+Services+with+CXF
Define a flow that invokes your webservice for testing (Lesson 2)
Use xml module for using custom trasformers http://www.mulesoft.org/documentation/display/MULE3USER/XML+Module