Python - publish and subscribe message with message in the Content and not in the Attachment
In our current use case we will be expecting published messages to be stored in the Attachment or in Content from our external broker.
Our python subscriber currently can read published messages via get_payload_as_string() or get_payload_as_bytes().decode("utf-8").
1. How can we publish a message via python and stored as a Content and not an attachment? See screenshot
2. How can our python subscriber app read the messages in the content when the attachment size is 0 and Content size > 0?
We have tried publishing messages using your docker ui sample but and no option to publish message as a content. https://solace.com/products/event-broker/software/getting-started/
We have tried using the Try-Me! page under the solace management ui, and no option to publish message as a content
We have tried publishing message via python api with all the properties but the published messaged is as an attachment.from the solace sample python in github
outbound_msg = messaging_service.message_builder() \
.with_property("custom_key", "custom_value") \
.with_expiration(SolaceConstants.DEFAULT_TIMEOUT_MS) \
.with_priority(1) \
.with_sequence_number(12345) \
.with_application_message_id(constants.APPLICATION_MESSAGE_ID) \
.with_application_message_type("app_msg_type") \
.with_http_content_header("text/html", _sol_constants.ENCODING_TYPE) \
.build(message)
Comments
-
The XMLContent is a legacy payload type that is not supported in Python on publish.
Is there a reason you need the payload to be this type vs. a binary attachment?
0 -
We are expecting that our customer will send the message on the content as well as message on the attachment and would like to know how to read the content message via python subscriber.
How can our python subscriber be able to read the content when we receive it in the queue? Is it the same as get_payload_as_string() or get_payload_as_bytes().decode("utf-8") ?
0 -
Is it a JMS publisher?
get_payload_as_string() will read the XMLContent if it exists. It is an exception to get the payload of a message with both XMLContent and binary attachment set.
0 -
@amackenzie , I am not sure if they are using JMS as a publisher. It's good to know that python can read Content or Attachment that is queued in a topic. Thanks!
0