SendMessage

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 No 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 No 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>