Create AMQP action

To send PubNub data into Advanced Message Queuing Protocol (AMQP), you must first configure your AMQP environment and the AMQP action in Admin Portal.

For Events & Actions, it doesn't matter how or where you set up your AMQP environment as long as you correctly configure your action in Admin Portal.

Existing AMQP environment

You will need the following information to configure Events & Actions to connect to AMQP.

  • URL configuration - full AMQP URL with TLS, credentials, and Vhost.
  • Routing key to direct messages to the appropriate queue.
  • (Optional) RabbitMQ Exchange name for message publication.

Once you can access this information, create an AMQP action by following the steps described in the Configure Admin Portal section.

New AMQP environment

Setting up an Advanced Message Queuing Protocol (AMQP) environment typically involves deploying a message broker that implements the AMQP standard and configuring your client applications to communicate with this broker.

Use services like RabbitMQ or CloudAMQP to establish your AMQP environment.

Refer to RabbitMQ documentation to understand how to set up your AMQP environment, secure your connection with TLS, and obtain credentials, including the Vhost.

Ensure to have the following information ready, as you will need it to create an AMQP action:

  • URL configuration - full AMQP URL with TLS, credentials, and Vhost.
  • Routing key to direct messages to the appropriate queue.
  • (Optional) RabbitMQ Exchange name for message publication.

When you've created your AMQP environment and have access to this information, create an AMQP action by following the steps described in the Configure Admin Portal section.

Configure Admin Portal

  1. In the Events & Actions view on the Admin Portal, create an action by clicking the + Add Action button.

  2. Select Advanced Message Queuing Protocol (AMQP) as the action type.

  3. In the URL field, enter the full AMQP URL with TLS, credentials, and Vhost in the amqps://username:password@hostname/vhost format, like amqps://user123:pass456@bunny.cloudamqp.com/myvhost.

  4. In the Routing key field, enter a message attribute the exchange looks at when deciding how to route the message to queues. For example, to direct messages to a queue that collects warning logs, use logs.warning.

  5. (Optional) Enable the Persistent toggle to ensure each message is saved on a message broker disk.

  6. (Optional) Enable and configure retries through AMQP retry.

  7. (Optional) Provide an Exchange name to identify an exchange within a RabbitMQ server where messages will be published. For example, MyExchange.

  8. (Optional) Set a custom TTL (Time-To-Live) for messages and queues in TTL (min) to override the default AMQP queue settings.

  9. Pair your action with an event listener without leaving the Actions view. To do this, click the Add event listener button and select an existing event listener or create a new one.

  10. Save your newly created action by clicking the Save changes button.

Last updated on