Jump toUpdate content

Messaging and Queuing - Quickstart

Reviewed on 08 June 2023Published on 29 August 2022

Scaleway Messaging and Queuing is a message broker tool that allows you to transfer messages between different microservices and platforms. This enables them to “talk” to each other effectively even if they are not otherwise compatible. Messaging and Queuing enables and simplifies microservices application development and allows you to build highly scalable, reliable, distributed applications.

To get started with Scaleway Messaging and Queuing, you need to create a namespace and generate its credentials. You can then use any supported SDK or CLI of your choice to start creating and managing queues, topics and messages. When you no longer need your namespace, you can delete it.

Security & Identity (IAM):

You may need certain IAM permissions to carry out some actions described on this page. This means:

  • you are the Owner of the Scaleway Organization in which the actions will be carried out, or
  • you are an IAM user of the Organization, with a policy granting you the necessary permission sets
Requirements:

How to create a namespace

A namespace sets a scope for your queues, topics, and credentials. For each namespace, you can generate one or multiple sets of credentials, which allow the bearer to perform actions within that namespace, dependent on their access rights. Actions could include creating topics or queues, publishing messages, reading messages etc. Namespaces therefore allow you to isolate queues and topics from each other, as credentials only give access to queues and topics within that namespace.

Two types of namespaces are available: NATS and SQS/SNS. The type of namespace that you choose determines the messaging system used to distribute and queue your messages.

  1. Click Messaging in the Serverless section of the side menu. The Messaging and Queuing namespace creation page displays.

  2. Click Create namespace. The namespace creation wizard displays.

  3. Complete the following steps in the wizard:

    • Choose a region, which is the geographical region in which your namespace will be created.
    • Choose a namespace type. The namespace type determines the message system used to distribute and queue your messages. Currently, two types are available:
      • NATS: Choose this namespace type if you want to use the NATS messaging system. When you later create credentials, they will be scoped at the namespace level and give full access to all streams related to the namespace.
      • SQS/SNS: Choose this namespace type if you want to use the SQS and/or SNS messaging systems. When you later create credentials, they will be scoped at the namespace level, and you can select the required level of access (read/write/manage) for each set of credentials.
    • Choose a name for your namespace, or use the randomly-generated name suggested.
  4. Click Create namespace to finish.

    Your namespace is created. You are taken to the list of all your namespaces, where your newly-created namespace now appears.

How to generate credentials

Credentials give their bearer (e.g. services and platforms) access to your namespace. The process of creating credentials differs depending on the namespace type (NATS or SQS/SNS).

You can create multiple sets of credentials for each namespace. Follow the instructions below according to your namespace type.

Credentials for NATS namespaces are not granular: they necessarily give full read and write access to the namespace. The bearer of these credentials can publish and receive messages, as well as manage topics and streams.

  1. Click Messaging in the Serverless section of the side menu. The list of your Messaging and Queuing namespaces displays.

  2. Click the NATS namespace you wish to create credentials for. The namespace’s Overview page displays.

  3. In the Credentials panel, click Generate credentials. A pop-up displays.

  4. Enter a name for these credentials, and click Generate credentials.

    The credentials are created and a button displays prompting you to download them in a .creds file.

    Important:

    The credentials are displayed only once. Make sure to download and safely store them before closing the window.

  5. Click Download and save the file, before closing the window.

    You are returned to your namespace’s overview page. The name of your newly-generated credentials and their access level is displayed in the Credentials tab.

How to create a queue

  1. Click Messaging in the Serverless section of the Scaleway console side menu. The list of your Messaging and Queuing namespaces displays.

  2. Click the SQS/SNS namespace you wish to create a queue for. The namespace’s Overview page displays.

  3. Click the Queues tab. If you have existing queues, they are listed here. Otherwise, the screen below displays:

  4. Click the green + button to create a new queue. The queue creation wizard displays.

  5. Choose your queue type, from one of the following:

    • Standard: Standard queues ensure at-least-once delivery. The exact order of messages in the queue is not preserved.
    • FIFO: FIFO queues (First In First Out) preserves the exact ordering of messages.
  6. Enter a name for your queue. The name must be no more than 80 characters, and consist only of alphanumeric characters, hyphens, and underscores. Alternatively, you can go with the auto-generated name suggested for you.

  7. Configure your queue’s parameters. The following parameters can be defined:

    • Visibility timeout: The length of time (in seconds) during which, after a message is received, it is hidden and cannot be received again by the same or other consumers. This is useful as the queue itself does not automatically delete messages once they are received, and so prevents consumers from receiving the same message many times before they have finished processing it. Therefore, the value set here should be informed by the expected length of time it will take consumers to process messages. The default value is 30 seconds. The value must be between 1 second and 43 200 seconds (12 hours).
    • Message retention period: The length of time (in seconds) that messages are kept in the queue before being deleted. Setting a longer message retention period allows for a longer interval between a message being sent and it being received. The default value is 60 seconds. The value must be between 60 seconds and 1 290 600 seconds (14 days).
    • Maximum message size: The maximum size (in kilobytes) of a message that can be sent to the queue. Messages greater than the defined size will be rejected. The default value is 256 KB. The value must be between 1 KB and 256 KB.
    • Content Based Deduplication: This setting is only available for FIFO queues. Enable content based deduplication if the message body is guaranteed to be unique for each message. A unique hash value is generated from the body of each message, which is used as its deduplication ID. This avoids the need to set a deduplication ID when sending messages.
  8. Click Create queue to finish.

You are returned to the Queues tab, where your newly-created queue now displays.

How to create and manage topics, messages and more

All further actions related to publishing, processing and managing messages, subjects, queues and streams can be done via a supported CLI or SDK. See our documentation on NATS CLI and SDKs and SQS/SNS CLI and SDKs for more information.

How to delete a namespace

  1. Click Messaging in the Serverless section of the side menu. The list of your Messaging and Queuing namespaces displays.

  2. Click the «See more Icon» button next to the namespace you want to update. A menu displays.

  3. Select Delete. A popup displays.

    Important:

    Deleting a namespace is irreversible. Any URLs, credentials and queued messages belonging to this namespace will also be deleted.

  4. Type DELETE to confirm, and click Delete namespace.

    Your namespace is deleted. You are returned to your Messaging and Queuing overview page.