Scaleway Messaging is a Message broker offering notifications, queues, fifos and streams. This service is designed to enable you to easily make your applications communicate with each others and port your Microservice Applications to the cloud. It includes all major features of a modern message broker (like message persistence). When reaching general availability, it will enable you to choose between several protocols for your broker (named "namespaces" below).
Update: The SQS protocol has been added !
In the current product stage, two protocol options are available:
NATS: all features typically offered by a NATS v2 message broker are supported (pub/sub, request/response, streams, ...).
AWS SQS/SNS: it allows the use the AWS SDKs for using Queues and Topics. For now, SNS only supports subscriptions with the following protocols:
fr-par
).The following tutorial will guide you to create your first MnQ Namespace and use it to make two applications communicate thought a managed Pub/Sub messaging system.
In this tutorial we will use the NATS protocol to publish and receive messages, and to call the MnQ API we will use the well-known cURL HTTP client.
Alternatively, you can use the software Postman to make the following requests from a nice user interface. here is the tutorial to use Postman.
Set your Scaleway token's secret key in the environment variable SCW_SECRET_KEY
and the id of the Scaleway project you want to use into the variable SCW_DEFAULT_PROJECT_ID
(you can use your Scaleway organisation id as it is your default project id).
Create your first Namespace.
On the second one execute the following command:
The following links might be useful if you are new to NATS or want to go further.
Also, you can interact directly with the NATS community on their Slack Channel.
Both SQS and SNS share the same namespace. On the API, the corresponding namespace protocol parameter value is sqs_sns
.
Set your Scaleway token's secret key in the environment variable SCW_SECRET_KEY
and the id of the Scaleway project you want to use into the variable SCW_DEFAULT_PROJECT_ID
(you can use your Scaleway organisation id as it is your default project id).
Create a Namespace with protocol sqs_sns
.
Either update your default profile or create a new one with the following configuration in your ~/.aws/config
file:
Where the endpoint_url
value was returned by your namespace creation:
create the corresponding credentials in ~/.aws/credentials
:
where <sqs_sns_credentials.access_key>
and <sqs_sns_credentials.secret_key>
are the values returned by the credentials
API call:
you can now define the AWS_PROFILE
environment variable to use the newly created profile:
The following tutorial will guide you to create a namespace and to communicate using the SQS protocol.
Please follow the Prerequisites to getting started with SQS and/or SNS section, to create the required common resources to use SQS and SNS protocol.
Create a Queue
List existing Queues
Send messages to a Queue
Receive messages
Delete messages
Once the messages have been processed on your consumer side (typically by a worker), the message needs to be deleted otherwise it will be re-queued.
Delete the queue itself
The following tutorial will guide you to create a namespace and to communicate using the SNS protocol.
Please follow the Prerequisites to getting started with SQS and/or SNS section, to create the required common resources to use SQS and SNS protocol.
Create a Topic
List existing Topics
Prepare a target for SNS messages and subscribe the SNS topic to the target (procedure depends on the chosen protocol)
for SQS:
Create a Queue (the queue must be in the same namespace than the SNS topic)
Get the Queue ARN
Configure a subscription to push each new message sent on this topic to the queue
for HTTP/HTTPS:
Get the public endpoint of the HTTP server you want to forward your messages to.
Configure a subscription to push each new message sent on the topic to the HTTP server
To complete the subscription process, you need to confirm the subscription using a link sent to your HTTP server.
The HTTP server should have received an HTTP request with a body in json matching the following format:
Confirm subscription
for lambda (Scaleway Serverless function):
Create the function following the Quick Start Guide of Scaleway functions.
Get the function endpoint from the Scaleway Console under "Functions" -> "[YOUR-FUNCTION-NAMESPACE]" -> "[YOUR-FUNCTION-NAME]" -> "Function Settings" tab -> "Function Endpoint"
Warning: Only the main generated Endpoint of the function will work, not the aliases. The endpoint should match the following format:
Configure a subscription to push each new message sent on this topic to the function
List subscriptions
Publish a message on the topic
Read the message received on the chosen target
for SQS:
Read the message from this queue
Delete the message
As seen in the getting started with SQS section, the message needs to be deleted.
for HTTP/HTTPS, you should have received the message on your server
for lambda, your function should have been called with the message as argument
Delete the subscription
Delete the remaining resources of this tutorial
for SQS, delete the queue
for lambda, delete the function using the Scaleway Console
Delete the topic
SQS queues and SNS topics are compatible with the Amazon AWS SQS/SNS protocols. Please check out the official documentations for more information:
The differences between the Scaleway service and the Amazon service are:
The SQS/SNS protocol support is not complete, see the SQS/SNS APIs compatibility matrixes below
The credentials use a simplified permissions system: each credential created by the CreateCredential API call gives permissions to the whole namespace. There are 3 permissions:
can_publish
: Allows to send messages to a Queue/Topic.can_receive
: Allows to receive and acknowledge (delete) messages and to subscribe to a Topic.can_manage
: Allows all other actions (Creating, Listing, Updating, Deleting Queues/Topics).The permissions required by each action are listed in the following sections.
The SNS/SQS credentials are issued by the Scaleway Messaging product, these are not your Scaleway API keys.
To ensure everything will go as smoothly as possible for this beta, we set the following limits:
We are available on Scaleway Community Slack on the #messaging-queuing-beta
channel.
Messaging or Queueing brokers
unknown
, nats
and sqs_sns
. The default value is unknown
.unknown
, nats
and sqs_sns
. The default value is unknown
.unknown
, nats
and sqs_sns
. The default value is unknown
.Credentials to connect to Messaging or Queueing brokers
Create a set of credentials for a specific namespace.
unknown
, nats
and sqs_sns
. The default value is unknown
.nats_credentials
and sqs_sns_credentials
may be set.unknown
, nats
and sqs_sns
. The default value is unknown
.nats_credentials
and sqs_sns_credentials
may be set.Update a set of credentials.
unknown
, nats
and sqs_sns
. The default value is unknown
.nats_credentials
and sqs_sns_credentials
may be set.