• Distributed Message Service

dms
  1. Help Center
  2. Distributed Message Service
  3. User Guide
  4. Getting Started
  5. Creating a Message

Creating a Message

Scenario

Messages can be sent to a chosen queue. The size of each message, including the message body and attributes, cannot exceed 512 KB. The body includes the message content and a few bytes of additional JSON information.

If the Kafka SDK is used to produce messages, the maximum size of a single message is 10 MB. If the DMS console is used to produce messages, the maximum size of a single message is 512 KB.

Prerequisites

A queue has been created.

Procedure

  1. Log in to the management console.
  2. Click  in the upper left corner of the management console and select a region and a project.
  3. Click Service List, and choose Application > Distributed Message Service to launch the DMS console.
  4. In the navigation pane, choose Queue Manager.
  5. Open the Create Message dialog box using either of the methods:

    • Method 1

      In the queue list, click Create Message in the same row as the queue to which messages will be sent.

    • Method 2
      1. Click the name of the queue to which messages will be sent.
      2. Click Create Message in the upper right corner of the queue details page.

  6. Specify the Message Body. If you want to add attributes, specify Name and Value, and then click Add.

    Table 1 Parameter description

    Parameter

    Description

    Message Body

    Body of the message to be sent.

    When using the DMS console to send messages, characters that are reserved in the JSON format will be escaped in the message body content. For example, she said "it's not you, it's me" would be escaped to she said \"it's not you, it's me\".

    Message Attributes (optional)

    Attribute of a message, which is composed of the name and value.

    Message attributes are in the key-value format. Attribute names are mandatory and must be unique in the same message.

    If you enter attribute names or values on the DMS console, spaces are allowed in attribute names and values, but not before and after them. For example, " ab c " is converted to "ab c".

    NOTE:

    If you use APIs to access DMS, spaces are allowed in, before, and after attribute names and values.

    Message attributes are supplementary to the message body and can be sent and retrieved along with it. You can specify multiple message attributes, as long as the size of the message remains within 512 KB.

    Messages in Kafka queues do not have attributes.

    Successfully added attributes will be displayed in the list. To delete an attribute, click Delete in the same row as the attribute.

  7. Click OK.

    In the queue list, the value of Messages for the chosen queue will increment by one.

    In the consumer group list of the chosen queue, the value of Messages Available for those consumer groups will also increment by one if consumer groups exist for the queue.