Skip to content

Commit

Permalink
added additional info about if message_body_formatter is set to None
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaspuff committed Feb 5, 2024
1 parent d1ea725 commit b64b635
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Changes
-------------------

- Added the function ``tomodachi.sqs_send_message`` (``tomodachi.aws_sns_sqs_send_message``) to send a message directly to an SQS queue. It mostly works the same way as the ``tomodachi.sns_publish`` (``tomodachi.aws_sns_sqs_publish``) function, but sends a message directly to the specified SQS queue. This is useful when you know the recipient queue of a message, for example when manually sending messages to a dead-letter queue or to do command-like messaging instead of event-based messaging.
- The message body of ``tomodachi.sqs_send_message`` calls is by default built using the ``tomodachi.transport.aws_sns_sqs.MessageBodyFormatter`` implementation, which will encode the message body as JSON and embed it within the ``"Message"`` property also using the service specified message envelope functionality. The message includes some additional properties, mimicing how SNS notifications are represented when they are sent to subscribed SQS queues (with the exception that these messages are of type ``"Message"`` to differentiate from SNS notifications that are by AWS typed ``"Notification"``. For custom or more advanced setups requiring more flexibility, the implementation can be overridden by providing a callable to the ``message_body_formatter`` keyword argument of ``sqs_send_message`` calls. The callable receives a message context object and returns the raw message (as a string) that will be sent to SQS as the message body.
- The message body of ``tomodachi.sqs_send_message`` calls is by default built using the ``tomodachi.transport.aws_sns_sqs.MessageBodyFormatter`` implementation, which will encode the message body as JSON and embed it within the ``"Message"`` property also using the service specified message envelope functionality. The message includes some additional properties, mimicing how SNS notifications are represented when they are sent to subscribed SQS queues (with the exception that these messages are of type ``"Message"`` to differentiate from SNS notifications that are by AWS typed ``"Notification"``. For custom or more advanced setups requiring more flexibility, the implementation can be overridden by providing a callable to the ``message_body_formatter`` keyword argument of ``sqs_send_message`` calls. The callable receives a message context object and returns the raw message (as a string) that will be sent to SQS as the message body. Setting ``message_body_formatter`` to ``None`` will disable default message body formatting (and incidentally also the message envelope builder), causing the message body to be as is specified within the ``data`` argument to the ``sqs_send_message`` call.
- Sending messages to an SQS queue that does not exist will result in a ``tomodachi.transport.aws_sns_sqs.QueueDoesNotExistError`` exception being raised, which can be caught also by ``tomodachi.transport.aws_sns_sqs.AWSSNSSQSException``, ``botocore.exceptions.ClientError`` or ``<botocore_sqs_client>.exceptions.QueueDoesNotExist``.
- Receives and propagates message attributes for all messages received on a queue, which means message attribute propagation will work for messages published to SNS, using either raw message delivery or not, and/or messages that were directly sent to SQS via SQS.SendMessage calls. Currently, messages on SQS queues consumed and parsed by tomodachi services still need to be JSON formatted and be embedded within the ``"Message"`` property (which is how SNS notification messages are represented by default, unless a queue is setup for raw message delivery).
- Fixes a bug that were causing message attributes in binary form to be invalidly processed.
Expand Down

0 comments on commit b64b635

Please sign in to comment.