---
name: azion-install-the-send-messages-to-a-queue-integration
description: >-
  Install Send messages to a queue from Azion Marketplace and run it on an application to add messages to a RabbitMQ, Amazon SQS, or Kafka-REST queue.
---

# Install the Send messages to a queue integration

Send messages to a queue adds messages to a message queue. A queue stores messages in first-in-first-out (FIFO) order: a message enters at the back and leaves from the front. The sender adds a message asynchronously, and the receiving component processes it later. The integration supports three messaging services: RabbitMQ, Amazon SQS, and Kafka-REST. It is one of the [Marketplace integrations](/en/documentation/platform/marketplace/integrations/) that run on an application.

Four objects must exist before a request sends a message: the installed function, an application with the **Functions** module turned on, a function instance that holds the arguments, and a Rules Engine rule with the **Run Function** behavior. Each section below creates one of them.

---

## Prerequisites

- An Azion account. To sign in, refer to [How to access Azion Console](/en/documentation/guides/platform/account-and-billing/how-to-access-azion-console/).
- An [application](/en/documentation/platform/applications/) served by a [workload](/en/documentation/platform/workloads/). To create one, refer to [Applications quickstart](/en/documentation/platform/applications/quickstart/).
- A queue on RabbitMQ, Amazon SQS, or Kafka-REST, with its server URL and, where the service requires one, its authorization credentials. Configure the service before you create the function instance.
- Turning on a product or a module can generate usage costs. For more information, refer to [Pricing](/en/documentation/fundamentals/pricing/).

---

## Install the integration

The install adds the Send messages to a queue function to your account. To install it from Azion Console:

1. **Open Marketplace**

   Access [Azion Console](https://console.azion.com/) > **Marketplace**.

2. **Find the integration**

   Enter `Send messages to a queue` in the **Search on Marketplace** field, then select the integration's card. Browsing the cards and the categories reaches the same page.

3. **Select Install**

The card shows `Successfully installed!` and `Latest version installed!`. The function is then listed in the **Function** list of the **Create Instance** drawer.

---

## Turn on the Functions module

An application runs an installed function only when its **Functions** module is on. To turn on the module:

1. **Open your application**

   Access [Azion Console](https://console.azion.com/) > **Applications** > **your application**.

2. **Open the Modules section**

   In the **Main Settings** tab, go to the **Modules** section.

3. **Turn on the Functions switch**

4. **Select Save**

Azion Console confirms that the application was updated.

---

## Create the function instance

A function instance holds the arguments the Send messages to a queue function reads for one application. To create the instance in your application:

1. **Open the Functions Instances tab**

   In **Applications**, select your application, then select the **Functions Instances** tab.

2. **Select + Function**

   An application with no instance yet offers the same action as **Function Instance**. The **Create Instance** drawer opens.

3. **Name the instance**

   In **Name**, enter a unique name that identifies the instance. For example: `send-messages-amqp`.

4. **Select the function**

   In **Function**, select *Send messages to a queue*. The **Arguments** editor fills with the default arguments of the integration.

5. **Edit the arguments**

   In **Arguments**, enter the arguments of your messaging service. Each service takes a different set of arguments and credentials, shown below.

6. **Select Save**

The instance appears in the **Functions Instances** tab with the name you entered.

### Arguments

The arguments are one JSON object. Three keys define the connection:

| Key                        | Description                                                 |
| -------------------------- | ----------------------------------------------------------- |
| `server_type`              | The connection type. Takes `amqp`, `sqs`, or `kafka-rest`   |
| `connection_url`           | The server URL of the messaging service                     |
| `connection_authorization` | The type of authorization the connection requires. Optional |

The `connection_args` section passes extra parameters to the queue. Each service accepts different parameters, and all of them are optional.

For RabbitMQ, over AMQP:

```json
{
  "server_type": "amqp",
  "connection_url": "https://my-service.azion.com/queue",
  "connection_authorization": "Basic my_basic_auth",
  "connection_args: {	
   "routing_key: "my_queue",
   "payload: "my_custom_payload"
  }
}
```

For Amazon SQS:

```json
{
  "server_type": "sqs",
  "connection_url": "https://my-service.azion.com/sqs-queue",
  "connection_authorization": "Basic my_basic_auth",
  "connection_args: {
    "auth_params: "my_aditional_auth_params",
     "version": "2012-11-05",
    "expires": "Wed, 21 Oct 2015 07:28:00 GMT"
  }
}
```

For Kafka-REST:

```json
{
  "server_type": "kafka-rest",
  "connection_url": "https://my-service.azion.com/topics/my-topic",
 "connection_args: {
    "payload": "my_custom_payload"
  }
}
```

> **Note**
>
> The integration connects to Kafka only through Kafka-REST, a module that provides an HTTP RESTful interface to a Kafka cluster. The Kafka clients for JavaScript, Kafka JS and Kafka Node, use Node.js features that are incompatible with Azion's infrastructure.

---

## Create the rule

The instance runs only when a Rules Engine rule calls it. The rule below matches every request. To create the rule:

1. **Open the Rules Engine tab**

   In **Applications**, select your application, then select the **Rules Engine** tab.

2. **Select + Rule**

3. **Name the rule**

   In **Name**, enter a name for the rule. For example: `Send messages to a queue on every request`.

4. **Select the phase**

   In the **Phase** section, select *Request Phase*.

5. **Set the criterion**

   In the **Criteria** section, keep the `${uri}` variable and the *starts with* operator, then enter `/` as the argument.

6. **Add the Run Function behavior**

   In the **Behaviors** section, select *Run Function*, then select the instance you created by its name.

7. **Select Save**

The rule appears in the **Rules Engine** tab, under the request phase, and runs the Send messages to a queue instance on every request.

For every criterion and behavior a rule accepts, refer to [Rules Engine](/en/documentation/platform/applications/rules-engine/).

---

## Next steps

- [Marketplace integrations](/en/documentation/platform/marketplace/integrations.md): The integrations Marketplace offers, and the application or firewall each one runs on.
- [Rules Engine](/en/documentation/platform/applications/rules-engine.md): The criteria and behaviors a rule accepts, to narrow the requests that send a message.
- [Functions instances](/en/documentation/platform/applications/functions-instances.md): How an application holds and runs the instances of its functions.
- [Update an integration](/en/documentation/guides/application-development/integrations/update-an-integration.md): How to get the latest version of an installed integration, and what an update creates.
