How to install the Send messages to a queue solution from Azion Marketplace
Overview
Sending messages to a queue refers to the process of adding messages to a message queue, which is a data structure that stores messages in “first-in-first-out” (FIFO) order. Messages are added to the back of the queue and removed from the front. Messages can be sent asynchronously and processed by the receiving component later, allowing for easy communication between different parts of a system.
1. Getting the solution
To use the Send messages to a queue solution provided by Azion Marketplace, follow these steps:
- Access Real-Time Manager (RTM) and log in.
- If you don’t have one yet, create an account by visiting the sign-up page.
- On the upper-left corner of the page, select Products menu > Marketplace.
- On the Marketplace’s homepage, type “message” in the search box or browse through the cards below it to find the desired Send messages to a queue solution.
- Select the Send messages to a queue card and you’ll be redirected to the solution’s page.
- Find the Subscribe for section at the bottom-right corner of the page.
- Click the Get It Now button.
Done. You’ve installed the solution.
Note that a successful message appears on the top of the solution’s page.
2. Using the solution
Once you’ve gotten your solution on Marketplace, it’ll be available at your Edge Functions list. You’ll have to select an Edge Application to use the solution.
For this task you have several modes of action. The main ones are:
- Visit the getting started documentation to create a new edge application.
- Create an edge application in RTM by selecting Products menu > Edge Application and follow the instructions.
- Use an existing edge application.
3. Configuring the solution
On the Edge Application page, locate the edge application you want to use with the new Send messages to a queue solution and select it.
On the Main Settings tab, locate the Edge Functions switch. This switch should be on the off position, you must turn it on:
- Activate the switch.
- On the bottom-right corner, click the Save button.
A successful message appears informing that the edge application is updated.
This will enable the Functions tab on your edge application, enabling you to instantiate the Send messages to a queue edge function on your edge application.
4. Instantiating the solution
To enable the Send messages to a queue function, follow these steps:
- Still in the Edge Application page, select the Functions tab located in the top list.
- Click the Add Function button.
- On the Edge Function’s name text box, type an easy to remember name.
- On the dropdown function menu, select the Send messages to a queue function.
This action will load the function, showing a form with the source-code of the function and, just above it, two tabs: Code and Args. By clicking on the Code tab, you’ll be able to navigate through the code, but won’t be able to change it.
You can configure three messaging services for this solution: RabbitMQ, Amazon SQS, and Kafka-REST. You can configure it in advance beforehand. For each one of these solutions, you’ll have a different Args box and different credentials, as in the following examples:
AMQP:
{
"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"
}
}
SQS
{
"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"
}
}
Kafka-REST
{
"server_type": "kafka-rest",
"connection_url": "https://my-service.azion.com/topics/my-topic",
"connection_args: {
"payload": "my_custom_payload"
}
}
Where:
server_type
: defines the connection type used (amqp
,sqs
,kafka-rest
are the three possible values).connection_url
: defines the server URL of the service you choose.connection_authorization
: the type of authorization needed for the connection. This is an optional field.
You can also set extra parameters to your queue, passing them in the connection_args
section. Each supported service has different extra parameters to use. It’s optional to inform these to push your function to the edge.
Important: it isn’t possible to integrate Kafka “as is” because the Kafka clients available for JavaScript (Kafka JS and Kafka Node) use Node.js features that are incompatible with Azion Cells. However, you have the option to integrate it using Kafka-REST, a module that provides an HTTP RESTful interface to a Kafka cluster.
To end the process, click the Save button. Now your function is configured.
5. Configuring a rule on Rules Engine
Still in the Edge Application page, in the Rules Engine tab, you have to configure the rules you want (criteria and behavior) to apply to run your function.
To do so, follow these steps:
- Select the Rules Engine tab.
- Click on Default Rule.
- You can’t change the criteria field for the Default Rule on Rules Engine.
- On the behavior field, select Run Function from the dropdown menu and then select the Send messages to a queue function, according to the name you gave it in the instantiation step.
- Click the Save button.
Done. Now you have your solution running on the edge.
Didn’t find what you were looking for? Open a support ticket.