File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff 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
358359status = 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
You can’t perform that action at this time.
0 commit comments