class SolaceMessagePublishReceiptListener(MessagePublishReceiptListener):
def __init__(self):
self._publish_count = 0
@property
def get_publish_count(self):
return self._publish_count
def on_publish_receipt(self, publish_receipt: 'PublishReceipt'):
with lock:
self._publish_count += 1
print(f"\tSOLACE -- \n", f"\tMessage: {publish_receipt.message}\n",
f"\tIs persisted: {publish_receipt.is_persisted}\n", f"\tTimestamp: {publish_receipt.time_stamp}\n",
f"\tException: {publish_receipt.exception}\n")
if publish_receipt.user_context:
print(f'\tUsercontext received: {publish_receipt.user_context.get_custom_message}')
used the receipt listener by:
publisher= messaging_service.messaging_service\
.create_persistent_message_publisher_builder().build()
publisher.start()
print('SOLACE -- PERSISTENT publisher started')
# adding the message recipient to the publisher
publish_receipt_listener = SolaceMessagePublishReceiptListener()
publisher.set_message_publish_receipt_listener(publish_receipt_listener)
messages published synchronously
publisher.publish_await_acknowledgement(outbound_message, topic, 2000)
However, after publishing the message successfully, we are not getting any acknowledgment from the listener.
Anyone tried this receipt listener in the solacePubSub python API?