Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
© 2022 Yandex.Cloud LLC
Yandex Message Queue
  • Getting started
    • Quick start
    • Supported tools
    • Code samples
      • Node.js
      • PHP
      • JMS
      • Laravel
      • Terraform
  • Step-by-step instructions
    • Overview
    • Creating a new message queue
    • Sending messages
    • Receiving and deleting messages
    • Deleting a message queue
    • Monitoring processes in queues
  • Concepts
    • Overview
    • Message queues
    • Messages
    • Deduplication
    • Visibility timeout
    • Long Polling
    • Dead Letter Queue
    • Delay queues
    • Quotas and limits
  • Practical guidelines
    • Converting a video to a GIF in Python
  • Access management
  • Pricing policy
  • Yandex Message Queue API
    • Overview
    • Queue
      • CreateQueue
      • DeleteQueue
      • GetQueueAttributes
      • GetQueueUrl
      • ListQueues
      • PurgeQueue
      • SetQueueAttributes
    • Message
      • ChangeMessageVisibility
      • ChangeMessageVisibilityBatch
      • DeleteMessage
      • DeleteMessageBatch
      • ReceiveMessage
      • SendMessage
      • SendMessageBatch
    • Data types
      • BatchResultErrorEntry
      • ChangeMessageVisibilityBatchRequestEntry
      • ChangeMessageVisibilityBatchResultEntry
      • DeleteMessageBatchRequestEntry
      • DeleteMessageBatchResultEntry
      • Message
      • MessageAttributeValue
      • SendMessageBatchRequestEntry
      • SendMessageBatchResultEntry
    • Common errors
  • Questions and answers
  1. Yandex Message Queue API
  2. Message
  3. SendMessage

SendMessage

Written by
Yandex Cloud
  • Request
    • Request parameters
  • Response
    • Successful response fields
    • SendMessage errors
  • Sample request
  • Response example

Method for delivering a message to the specified queue. A message can include only XML, JSON, and unformatted text.

Request

Request parameters

Parameter Type Required parameter Description
DelaySeconds integer No The number of seconds to delay the message from being available for processing. Valid values: from 0 to 900. If not specified, it defaults to the queue's parameter value. The parameter does not apply to messages sent to a FIFO queue: in this case, the queue's parameter is used.
MessageAttributeName.N
MessageAttributeValue.N
array No Array of names and corresponding values of your custom message attributes. See the Message data type.
QueueUrl string Yes URL of the queue where the message is placed.
MessageBody string Yes Body of the message to send. The maximum size is 256 KB. A message can include XML, JSON, and unformatted text. The following Unicode characters are supported:
  • #x9
  • #xA
  • #xD
  • from #x20 to #xD7FF
  • from #xE000 to #xFFFD
  • from #x10000 to #x10FFFF

FIFO queue parameters

Parameter Type Required parameter Description
MessageDeduplicationId string Yes ID of the token for message deduplication, used in FIFO queues. Each message must have a unique MessageDeduplicationId. If no MessageDeduplicationId is specified, a message will not be sent to a queue. The maximum length is 128 characters. You can use numbers, upper and lowercase Latin letters, and punctuation marks. For more information, see Deduplication.
MessageGroupId string Yes ID of a message group, used in FIFO queues. The maximum length is 128 characters. You can use numbers, upper and lowercase Latin letters, and punctuation marks. For more information, see Deduplication.

Response

Successful response fields

Field Type Description
MD5OfMessageAttributes string An MD5 digest of a message attribute string.
MD5OfMessageBody string The MD5 digest of the message body.
MessageId string ID of the message sent.
SequenceNumber string Message number specific to FIFO queues within a group of messages with the same MessageGroupId. The number length is 128 bits; SequenceNumber continues to increase within a group with the same MessageGroupId.

SendMessage errors

For a list of errors common for all methods, see Common errors.

HTTP code Error ID Description
400 UnsupportedOperation The operation is not supported.
400 InvalidMessageContents The message contains characters outside the allowed set.

Sample request

Action=SendMessage
&Version=2012-11-05
&QueueUrl=https://message-queue.api.cloud.yandex.net/b1g8ad42m6he1ooql78r/dj600000000000le07ol/sample-queue
&MessageBody=Hello+world

For more information about forming requests, see General API request format.

Response example

<SendMessageResponse>
    <SendMessageResult>
        <MD5OfMessageBody>3e25960a79dbc69b674cd4ec67a72c62</MD5OfMessageBody>
        <MessageId>cddcbbe4-b0571f5c-d7b94ce4-1523191</MessageId>
    </SendMessageResult>
    <ResponseMetadata>
        <RequestId>75eb03b2-fba0e60e-b1c5641-12f7a5bc-2bf4e677831c06c5f9d7ea1063ffeb3f</RequestId>
    </ResponseMetadata>
</SendMessageResponse>

Was the article helpful?

Language / Region
© 2022 Yandex.Cloud LLC
In this article:
  • Request
  • Request parameters
  • Response
  • Successful response fields
  • SendMessage errors
  • Sample request
  • Response example