August 15, 2023

cAMQP – Docs for ESB 6.x

cAMQP

Exchange messages between a Route and a JMS provider using the AMQP
broker.

cAMQP Standard properties

These properties are used to configure cAMQP running in the Standard Job framework.

The Standard
cAMQP component belongs to the Connectivity/Internet of Things and Connectivity/Messaging family.

Basic settings

URI/Type

Select the messaging type, either queue or topic.

URI/Destination

Type in a name for the message queue or topic in the message
broker.

ConnectionFactory

Click […] and select an MQ
connection factory to be used for handling messages.

Advanced settings

Parameters

Set the optional parameters in the corresponding table. Click
[+] as many times as required
to add parameters to the table. Then click the corresponding
Value field and enter a value.
See the site http://camel.apache.org/amqp.html for available
options.

Be sure to set the clientId parameter to a unique
value if you need to deploy multiple Routes using this component to
Runtime. Otherwise the Routes will throw exception in
Runtime.

Usage

Usage rule

cAMQP can be a start, middle or
end component in a Route. It has to be used with the cMQConnectionFactory component, which
creates a connection to a MQ server. For more information about
cMQConnectionFactory, see cMQConnectionFactory.

Limitation

 n/a

Scenario: Sending messages to and receiving messages from an AMQP broker

This scenario applies only to a Talend solution with ESB.

This scenario will show you how to use the cAMQP component
to send messages to and consume messages from a JMS Queue or Topic. To do this, two
Routes are built, a message producer Route, and a consumer Route. Messages are sent to
the AMQP broker in the producer Route and then consumed in the consumer Route.

In this use case, Apache ActiveMQ is used as the message broker which supports the AMQP 1.0
protocol. You need to launch the ActiveMQ server before executing the Route. For more
information about installing and launching ActiveMQ server, see the site http://activemq.apache.org/index.html.

Building the producer Route

Dropping and linking the components

use_case-camqp1.png

  1. From the Palette, drag and drop a cMQConnectionFactory, a cTimer, a cSetBody, a
    cAMQP, and a cLog component onto the design workspace.
  2. Label the components for better identification of their roles and link
    them with the Row > Route connection as shown above.

Configuring the components

  1. Double-click the cMQConnectionFactory component to
    display its Basic settings view in the
    Component tab.

    use_case-camqp2.png

  2. From the MQ Server list, select AMQP 1.0 to handle messages. Keep the default
    settings of the other options.
  3. Double-click the cTimer component to open its Basic settings view in the Component tab.

    use_case-camqp3.png

  4. In the Repeat field, enter 5 to generate
    the message exchange five times. Keep the default settings of the other
    options.
  5. Double-click the cSetBody component to
    open its Basic settings view in the
    Component tab.

    use_case-camqp4.png

  6. Select SIMPLE from the Language drop-down list and type in "Hello
    world"
    in the Expression field
    as the message body.
  7. Double-click the cAMQP component to open its Basic settings view in the Component tab.

    use_case-camqp5.png

  8. From the Type list, select queue or topic to send the
    messages to a JMS queue or topic. In this use case, queue is used.

    In the Destination field, type in a name for the queue,
    for example "myqueue".
    In the ConnectionFactory field, click […] and select the MQ connection factory that
    you have just configured to handle messages.
  9. Keep the default settings of the cLog component to
    log the message exchanges.

    use_case-camqp6.png

  10. Press Ctrl+S to save your Route.

Viewing the code and executing the Route

  1. Click the Code tab at the bottom of the
    design workspace to check the generated code.

    use_case-camqp7.png

    As shown above, the message flow from cTimer_1 is given a payload by
    cSetBody_1 and then sent to cAMQP_1 and
    cLog_1.
  2. Press F6 to execute the Route. The logs of the message
    exchange are printed in the console.

    use_case-camqp8.png

  3. In the ActiveMQ Web Console, you can see that the message queue
    myqueuehas been created.

    use_case-camqp13.png

Building the consumer Route

Adding components to arrange the flow

use_case-camqp9.png

  1. From the Palette, drag and drop a cMQConnectionFactory, a cAMQP, and a cLog component
    onto the design workspace.
  2. Label the components for better identification of their roles and link
    them with the Row > Route connection as shown above.

Configuring how the message is processed

  1. Double-click the cMQConnectionFactory
    component to display its Basic settings
    view in the Component tab.

    use_case-camqp2.png

  2. From the MQ Server list, select AMQP 1.0 to handle messages. Keep the default
    settings of the other options.
  3. Double-click the cAMQP component to
    display its Basic settings view in the
    Component tab.

    use_case-camqp10.png

  4. Specify the same URI Type and Destination in the consumer cAMQP component as in the producer.

    In the ConnectionFactory field. click
    […] and select the MQ connection
    factory that you have just configured to handle messages.
  5. Keep the default settings of the cLog component to
    log the message exchanges.

    use_case-camqp11.png

  6. Press Ctrl+S to save your Route.

Executing the Route

  1. Click the Code tab at the bottom of the
    design workspace to check the generated code.

    use_case-camqp12.png

    As shown above, the message flow is routed from cAMQP_1 to
    cLog_1.
  2. Press F6 to execute the Route. The logs of the message
    exchange are printed in the console.

    use_case-camqp14.png

  3. In the ActiveMQ Web Console, you can see that the messages in
    myqueue have been consumed.

    use_case-camqp15.png


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x