Python and Publishing to Queue using solace's API
Good morning all,
Continuing my Solace journey today and after a lot of reading, there is no where that i can find which details how to publish to an actual queue from the python API.
I have seen a single example which is using a different SEMP API, but it doesnt make sense to me to utilise two different connection methodologies so pursuing the Solace API itself.
After yesterdays faff of connecting to the cloud, I can now utilise the demo's from your git repository with 'relative' ease, modifying the SolaceConstants... However none of the demo's show publishing to a queue where it will sit and await the subscriber. - They all just talk to a topic which is non-persistant.
send message -> no subscriber -> bin it
I am looking for the settings as shown below:
send message -> hold in queue -> subscribe and get message
Which API call/demo do you have showing the send message part of the API ?
For current settings:
- I have a queue setup matching your try-me called 'try-me-queue'
The class currently being used from your demo to send to a Topic (doesnt seem to work with queue)
class HowToDirectPublishMessage: def direct_message_publish(messaging_service: MessagingService, destination, message): """ to publish str or byte array type message""" try: direct_publish_service = messaging_service.create_direct_message_publisher_builder(). \ on_back_pressure_reject(buffer_capacity=0).build() pub_start = direct_publish_service.start_async() pub_start.result() direct_publish_service.publish(destination=destination, message=message) finally: direct_publish_service.terminate()
This is called by the main func:
destination_name = Topic.of(constants.TOPIC_ENDPOINT_DEFAULT) HowToDirectPublishMessage.direct_message_publish(messaging_service, destination_name, constants.MESSAGE_TO_SEND)
Is there maybe a Queue.of('My Queue Name Here') option which is not obvious?