Lab 7 - Messaging

RH_Icon_Compass_Shiny.png In this lab you will add an ActiveMQ component to receive messages through the MoM Broker JBoss A-MQ. Using the JMS component you could connect to any JMS compliant MoM Broker.
general_info_polished.png Red Hat JBoss A-MQ, based on Apache ActiveMQ, is a JMS 1.1-compliant messaging system. It consists of a broker and client-side libraries that enable remote communication among distributed client applications. JBoss A-MQ provides numerous connectivity options and can communicate with a wide variety of non-JMS clients through its support of the OpenWire and STOMP wire protocols.It provides enterprise features like High Availability, Scalability, Reliability, Security, High Performance,etc. (https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_A-MQ/6.2/html/Product_Introduction/FuseMBIntroWhatIsMB.html )
  1. Select File -> Import.. and select General -> Existing Project into Workspace
  2. Click on Select archive file and browse to ~/FuseWorkshop/support/Lab7, and select Lab7.zip
  3. Click Finish.
  4. Double-click on the blueprint.xml file under Camel Contexts.
  5. Click on the Source tab.
  6. Copy and paste the following xml lines before <camelContext>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
general_info_polished.png The activemq bean describes the ActiveMQ connection configuration: url, user and password.
  1. Save the file (Ctrl+S).
  2. Click on the Design tab.
  3. Add an ActiveMQ component from the Components palette.

  4. Edit its properties:

  5. Advanced -> Path -> Destination Name: Lab7

  6. Advanced -> Path -> Destination Type: queue

  1. Add a Split component from the Routing palette.

  2. Edit its properties:

  3. Expression: //update

  4. Lanugage: xpath

  1. Add a setProperty Component from the Transformation palette.

  2. Edit its properties:

  3. Property Name: entity

  4. Expression: //entity/text()
  5. Language: xpath

  6. Link ActiveMQ to Split.

  7. Link Split to setProperty.

  8. Add a RecipientList from the Routing palette.

  9. Edit its properties:

  10. Expression: activemq:topic:Updates.${property.entity}

  11. Link setProperty to recipientList.

  12. Save the file (Ctrl+S).

general_info_polished.png A recipient list, is a type of router that sends each incoming message to multiple different destinations. In addition, a recipient list typically requires that the list of recipients be calculated at run time.
  1. Click in any empty space in the route diagram.
  2. Click on the properties tab.
  3. Enter “mainRoute” as the ID.

  1. Click on the Routes menu, and select Add Route.
  2. Add an ActiveMQ component from the Components palette.

  3. Edit its properties:

  4. Advanced -> Path -> Destination Name: Updates.Customer

  5. Advanced -> Path -> Destination Type: topic

  1. Add a setBody component from the Transformatoin palette.

  2. Edit its properties:

  3. Expression: //entityID/text()

  4. Language: xpath

  1. Add a Log component from the Components palette.

  2. Edit its properties:

  3. Message: Received an update for Customer ID: ${body}

  4. Link ActiveMQ to setBody.

  5. Link setBody to Log.
  6. Save the file (Ctrl+S).

  1. Click in any empty space in the route diagram.
  2. Click on the properties tab.
  3. Enter “CustomerRoute” as the ID.
  4. Save the file (Ctrl+S).
  5. Click on the Routes menu, and select Add Route.
  6. Add an ActiveMQ component from the Components palette.

  7. Edit its properties:

  8. Advanced -> Path -> Destination Name: Updates.Product

  9. Advanced -> Path -> Destination Type: topic

  1. Add a setBody component from the Transformation palette.

  2. Edit its properties:

  3. Expression: //entityID/text()

  4. Language: xpath

  1. Add a Log component from the Components palette.

  2. Edit its properties:

  3. Message: Received an update for Product ID: ${body}

  4. Link ActiveMQ to setBody.

  5. Link setBody to Log.
  6. Save the file (Ctrl+S).
  7. Click in any empty space in the route diagram.
  8. Click on the properties tab.
  9. Enter “ProductRoute” as the ID.
  10. Save the file (Ctrl+S).
  11. If JBoss Fuse Server is not running, start it by clicking
  12. Open a web browser, and go to http://localhost:8181
  13. Login as admin/admin
  14. Click on the ActiveMQ tab.

  1. Click on the amq broker.
  2. Click on
  3. Enter “Lab7” as the Queue Name and click Create Queue
  4. Enter “Updates.Customer”, select “Topic” and click Create Topic
  5. Enter “Updates.Product”, select “Topic” and click Create Topic

  1. Go back to JBDS.
  2. Right-Click on the JBoss Fuse Server and select Add and Remove
  3. Select Lab7 project, click Add and Finish
  4. Go back to the web browser.
  5. Expand the Queue folder and click on the Lab7 queue.
  6. Click on
  7. Open ~/FuseWorkshop/support/Lab7/Message.xml with any text editor (llike gedit or vi)
  8. Copy its contents and paste them into the payload box.
  9. Click on the Send Message button.

  1. Click on the Logs tab and verify there’s a log message per each element in the XML message.

  1. Go back to JBDS.
  2. Right-click on Lab7 under JBoss Fuse Server and select Remove.

results matching ""

    No results matching ""