Skip to content

Commit c92fed9

Browse files
authored
update python documentation (#2260)
based on: rabbitmq/rabbitmq-amqp-python-client#63 Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
1 parent cc82b68 commit c92fed9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

client-libraries/amqp-client-libraries.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ PublishResult pr = await publisher.PublishAsync(message);
352352

353353
```python title="Publishing a message"
354354
# create the message
355-
message = Message(body="Hello")
355+
# body is a byte array. You can use the Converter utility class
356+
message = Message(body=Converter.string_to_bytes("Hello"))
356357
# publish the message and deal with broker feedback
357358
# The result is synchronous
358359
status = publisher.publish(Message(message)
@@ -662,6 +663,9 @@ class MyMessageHandler(AMQPMessagingHandler):
662663

663664
def on_message(self, event: Event):
664665
# ...
666+
# event.message.body is a byte array. If you have string
667+
# you can use Converter utility class, like:
668+
# my_body_string=Converter.bytes_to_string(event.message.body)
665669

666670
self.delivery_context.accept(event)# settle the message
667671

0 commit comments

Comments
 (0)