NavigationContentFooter
Jump toSuggest an edit

NATS, Queues, and Topics and Events - Quickstart

Reviewed on 18 October 2024Published on 29 August 2022

Scaleway NATS, Queues, and Topics and Events are message broker tools 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. These brokers enable and simplify microservices application development and allows you to build highly scalable, reliable, distributed applications.

NATS, Queues, and Topics and Events were previously grouped together as the Messaging and Queuing product, and have now become three separate products in their own right. Read on to learn how to get started with your product of choice

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization

Quickstart for NATS

How to create a NATS account

To start using a NATS message broker, you must first create a NATS account. This sets a scope for your NATS credentials, messages, queues and stream.

  1. Click NATS in the Serverless section of the Scaleway console side menu.

  2. Click Create a NATS account. The creation wizard displays.

  3. Complete the following steps in the wizard:

    • Choose a region, which is the geographical location in which your NATS account will be created.
    • Enter a name for your NATS account, or use the auto-generated name suggested for you.
    • Optional: Use the Estimated cost* calculator to simulate how messages sent and stored with NATS streams will be billed. Note that simply creating a NATS account does not in itself incur any billing. For more information about NATS billing, see the FAQ.
    • Click Create NATS account to finish.

    You are directed to the listing of your NATS accounts, where your newly-created NATS account now appears.

How to create NATS credentials

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

  1. Click NATS in the Serverless section of the Scaleway console side menu.

  2. Use the drop-down menu to select the region of the NATS account for which you want to create credentials. The list of your NATS accounts in the pre-selected region displays.

  3. Click the NATS account you want to generate credentials for. The account’s Overview page displays.

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

  5. 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 generated credentials are displayed only once. Make sure to download and safely store them before closing the window.

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

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

How to create and manage queues, messages and streams

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 for more information. You can also check out our tutorial on creating a serverless architecture for handling large messages with Scaleway Messaging and Queuing NATS.

How to delete a NATS account

  1. Click NATS in the Serverless section of the Scaleway console side menu.

  2. Use the drop-down menu to select the region containing the NATS account you want to delete.

  3. Click the NATS account you want to delete.

  4. In the bottom panel, click the Delete NATS account button.

    A pop-up displays, reminding you that the action is irreversible, and any associated queued messages and credentials will be deleted.

  5. Type DELETE and click Delete NATS account to confirm.

Quickstart for Queues

How to create credentials for Queues

Credentials for Queues are granular: you can define the level of access that they should give. Credentials give the specified level of access to all queues that you create in the region they are scoped to.

  1. Click Queues in the Serverless section of the Scaleway console side menu. A list of your queues displays.

  2. Click the Credentials tab.

  3. Click Generate credentials. A pop-up displays:

  4. Choose a region that these credentials should be scoped to.

  5. Enter a name for these credentials.

  6. Select the required permissions for the credentials. You must choose at least one of Write, Read and Manage. You are free to select any combination of these permissions.

  7. Click Generate credentials.

    The credentials are created. The access key and secret key are displayed, and you are invited to copy them.

    Important

    This is your only chance to view and save the secret key. Make sure that you copy it and save it somewhere securely.

  8. Copy and save the credentials, before closing the window.

    You are returned to the Credentials tab. The name of your newly-generated credentials, along with the access key and access level are displayed.

How to create queues

  1. Click Queues in the Serverless section of the Scaleway console side menu.

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

  3. Select the region in which you want to create the queue.

  4. 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.

  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. 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.
  7. Click Create queue to finish.

You are returned to the Queues tab, where your newly-created queue now displays. The queue’s URL is also displayed here, for use in your API/CLI operations.

How to send and receive messages

All further actions related to sending messages to queues can be done via a supported CLI or SDK. See our documentation on the SQS CLI and SDKs for more information. You can also check out our tutorial on creating a serverless scraping architecture with Scaleway Queues.

How to delete a queue

When you no longer want a queue, you can delete it. This action is irreversible and deletes the queue along with any queued messages.

  1. Click Queues in the Serverless section of the Scaleway console side menu.

  2. Use the drop-down menu to select the region of the queue you want to configure.

  3. Either:

    • Click the queue you wish to delete. The queue’s Settings page displays. Click the Delete queue button in the bottom right corner.
    • Click the «See more Icon» icon next to the queue you wish to delete, then select Delete from the menu that displays.

    A pop-up asks you to confirm that you understand this action will delete the queue and all your queued messages.

  4. Type DELETE and click Delete queue.

Quickstart for Topics and Events

How to create Topics and Events credentials

Credentials for Topics and Events are granular: you can define the level of access that they should give. Credentials give the specified level of access to all topics that you create in the region they are scoped to.

  1. Click Topics and Events in the Serverless section of the Scaleway console side menu. The Topics and Events dashboard displays.

  2. Click the Credentials tab.

  3. Click Generate credentials. A pop-up displays:

  4. Choose a region that these credentials should be scoped to.

  5. Enter a name for these credentials.

  6. Select the required permissions for the credentials. You must choose at least one of Write, Read and Manage. You are free to select any combination of these permissions.

  7. Click Generate credentials.

    The credentials are created. The access key and secret key are displayed, and you are invited to copy them.

    Important

    This is your only chance to view and save the secret key. Make sure that you copy it and save it somewhere securely.

  8. Copy and save the credentials, before closing the window.

    You are returned to the Credentials tab. The name of your newly-generated credentials, along with the access key and access level are displayed.

How to create topics

  1. Click Topics and Events in the Serverless section of the Scaleway console side menu.

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

  3. Choose a region in which to create your topic.

  4. Enter a name for your topic. The name must contain 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.

  5. Choose a topic type. The following topic types are available:

    • Standard: Ensures at-least-once message delivery, where the order of messages is not preserved. Supports Serverless Functions, Serverless Containers and HTTP/S subscriptions.
    • FIFO: Provides first-in-first-out delivery, where the order of messages is preserved without duplication. Supports Scaleway Queues subscriptions. Content-based deduplication is only available for FIFO topics.
  6. Click Create topic to finish.

You are returned to the Topics tab, where your newly-created topic now displays. The topic’s URL is also displayed here, for use in your API/CLI operations.

How to create a subscription

  1. Click Topics and Events in the Serverless section of the Scaleway console side menu.

  2. Use the dropdown menu to select the region of the topic you want to create a subscription for.

  3. Click the name of the topic you want to create a subscription for.

  4. Click Create Subscription. The subscription creation wizard displays.

  5. Verify the parameters of the topic that you are creating a subscription for (name and type).

  6. Choose a protocol, based on the type of endpoint or client you want to subscribe. Click the tab below for further details and full instructions on each protocol:


    Select HTTP to create a subscription for a service or web server that can receive HTTP POST requests from Topics and Events, via standard HTTP protocol.

    Note that for security reasons, we recommend using the HTTPS protocol, rather than HTTP.

    You are prompted to enter the URL of the HTTP endpoint to subscribe, e.g. example.com. Note that the scheme (http://) is not required.

    After your HTTP subscription is created, you must confirm it. Find out how in our dedicated documentation.

  7. Click Create subscription to finish.

    The subscription is created. If you created an HTTP or HTTPS subscription, you will now need to confirm it.

How to publish messages

All further actions related to publishing messages to topics can be done via a supported CLI or SDK. See our documentation on the SNS CLI and SDKsfor more information.

How to delete a topic

When you no longer want a topic, you can delete it. This action is irreversible and deletes the topic along with all its associated subscriptions.

  1. Click Topics and Events in the Serverless section of the Scaleway console side menu.

  2. Use the drop-down menu to select the region containing the topic you want to delete.

  3. Either:

    • Click the topic you wish to delete, and navigate to its Settings page. Click the Delete topic button in the bottom right corner, or
    • Click the «See more Icon» icon next to the topic you wish to delete, then select Delete from the menu that displays.

    A pop-up asks you to confirm that you understand this action will delete the topic and all of its associated subscriptions.

  4. Type DELETE and click Delete topic.

Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway