此内容没有您所选择的语言版本。
Chapter 4. Connecting to AMQP
In an integration, you can obtain messages from or publish messages to an Advanced Message Queue Protocol (AMQP) broker. AMQP defines communication between clients and message brokers. To communicate with the following broker types, use the AMQP connector to create a connection to the broker of interest:
- Apache ActiveMQ broker that supports AMQP
- Apache ActiveMQ Artemis
- AMQ 7 broker
- EnMasse, which is an open source messaging platform
To communicate with one of the following broker types, use the AMQ connector to create a connection to the broker of interest:
- Apache ActiveMQ broker that does not support AMQP
- AMQ 6 broker
See Chapter 3, Connecting to AMQ.
It is possible to use the AMQP connector to create a connection to an Apache ActiveMQ broker that does not support AMQP or to an AMQ 6 broker. Doing this requires transport configuration in the broker. For information about configuring the broker, see Red Hat JBoss A-MQ Managing and Monitoring Brokers, Adding Client Connection Points. For information about the configuration values to specify, see Red Hat JBoss A-MQ Connection Reference, Advanced Message Queuing Protocol (AMQP).
To use the AMQP connector, see:
4.1. Create an AMQP connection
To create an AMQP connection:
- In Fuse Online, in the left panel, click Connections to display any available connections.
- In the upper right, click Create Connection to display connectors.
- Click the AMQP Message Broker connector.
- Configure the connection by entering: - In the Connection URI field, enter the location you want to send data to or obtain data from.
- In the User Name field, enter the user name for the account that you want to use to access this broker.
- In the Password field, enter the password for the account that you want to use to access this broker.
- In the Client ID field, enter the ID that allows connections to close and reopen without missing messages. The destination type must be a topic.
- If this connection will be used in a development environment, you can save some time by disabling Check Certificates. Disabling the checking of certificates is a convenience for development environments. For secure production environments, always enable Check Certificates.
- In the Broker Certificate field, paste the broker’s PEM certificate text. This is required except when disable checking the certificates.
- In the Client Certificate field, paste the client’s PEM certificate text. Content in this field is always optional.
 
- Click Validate. Fuse Online immediately tries to validate the connection and displays a message that indicates whether validation is successful. If validation fails, revise the configuration details as needed and try again.
- If validation is successful, click Next.
- 
						In the Connection Name field, enter your choice of a name that helps you distinguish this connection from any other connections. For example, you might enter AMQP 1.
- 
						In the Description field, optionally enter any information that is helpful to know about this connection. For example, enter Sample AMQP connection
- In the upper right, click Create to see that the connection you created is now available. If you entered the example name, you would see that AMQP 1 appears as a connection that you can choose to add to an integration.
4.2. Add an AMQP connection to an integration
You must create an AMQP connection before you can add an AMQP connection to an integration. If you did not already create an AMQP connection, see Section 4.1, “Create an AMQP connection”.
The procedure for adding an AMQP connection to an integration varies according to whether you want to use the connection to start an integration, finish an integration, or publish messages in the middle of an integration. See the following topics:
To trigger execution of an integration based on receiving messages from an AMQP broker, add an AMQP connection as the start connection:
- In the Fuse Online panel on the left, click Integrations.
- Click Create Integration.
- On the Choose a Start Connection page, click the AMQP connection that you want to use to start the integration.
- On the Choose an Action page, click the Subscribe for messages action to receive messages from the queue or topic you specify.
- To configure the action: - In the Destination Name field, enter the name of the queue or topic to receive data from.
- For the Destination Type, accept Queue or select Topic.
- In the Durable Subscription ID field, to allow connections to close and reopen without missing messages, enter the durable subscription ID. The destination type must be a topic.
- In the Message Selector field, if you want to receive only data that satisfies a particular condition, enter a filter expression.
 
- Click Next to specify the action’s output type. See Specifying connection action input and output types.
4.2.2. Finish an integration by publishing AMQP messages
To finish an integration by publishing messages to an AMQP broker, add an AMQP connection as the finish connection. You must be creating or editing an integration. You must have already added the start connection. Follow these instructions:
- On the Choose a Finish Connection page, click the AMQP connection that you want to use to finish the integration.
- On the Choose an Action page, click Publish messages to publish messages to the queue or topic you specify.
- In the Destination Name field, enter the name of the queue or topic to send messages to.
- For the Destination Type, accept Queue or select Topic.
- Select Persistent to guarantee message delivery even if a connection fails.
- Click Next to specify the action’s input and output type. See Specifying connection action input and output types.
In the middle of an integration, to publish messages to an AMQP broker, add an AMQP connection between the start and finish connections. You must be creating or editing an integration. You must have already added the start and finish connections to the integration. Follow these instructions:
- In the integration visualization panel on the left, click the plus sign in the location where you want to add the connection.
- Click Add a connection.
- On the Choose a Connection page, click the AMQP connection that you want the integration to use after the start connection and before the finish connection.
- On the Choose an Action page, select one of the following actions: - Publish messages to publish messages to the queue or topic you specify. To configure this action: - In the Destination Name field, enter the name of the queue or topic to send messages to.
- For the Destination Type, accept Queue or select Topic.
- Select Persistent to guarantee message delivery even if a connection fails.
 
- Request response using messages to send messages to the JMS destination you specify and receive a response. To configure this action: - In the Destination Name field, enter the name of the queue or topic to send messages to.
- For the Destination Type, accept Queue or select Topic.
- In the Message Selector field, if you want to receive only responses that satisfy a particular condition, enter a filter expression.
- In the Named Reply To field, enter the name of a queue or topic. The destination sends its response to this queue or topic.
- Select Persistent to guarantee message delivery even if a connection fails.
- In the Response Time Out field, specify the number of milliseconds that this connection waits for a response message before throwing a runtime exception. The default is 5000 milliseconds (5 seconds).
 
 
- Click Next to specify the action’s input and output type. See Specifying connection action input and output types.