IPWorks MQ 2020 Python Edition

Questions / Feedback?

on_message_in Event

Fired when a message has been received.

Syntax

class STOMPMessageInEventParams(object):
  @property
  def message_id() -> str: ...
  @property
  def subscription_id() -> str: ...
  @property
  def destination() -> str: ...
  @property
  def data() -> bytes: ...
  @property
  def content_type() -> str: ...
  @property
  def ack() -> bool: ...
  @ack.setter
  def ack(value) -> None: ...

# In class STOMP:
@property
def on_message_in() -> Callable[[STOMPMessageInEventParams], None]: ...
@on_message_in.setter
def on_message_in(event_hook: Callable[[STOMPMessageInEventParams], None]) -> None: ...

Remarks

This events fires whenever the class has received a message.

In addition to the message details exposed by the event parameters, the ParsedHeader* properties are populated with the headers parsed from the message. When the on_message_in event handler exits, the parsed headers are cleared. The following parameters are available within this event:

  • MessageId: The unique Id of the message.
  • SubscriptionId: The subscription Id the message is associated with.
  • Destination: The message destination on the server which the message originated from.
  • Data: The message's payload.
  • ContentType: The content type of the message (may be empty).
  • Ack: Set to True or False to control whether the class should send back a positive (True, default) or negative (False) message acknowledgment.

Message acknowledgments are only sent back to the server for messages which require them. A positive acknowledgment indicates that the message has been accepted, while a negative acknowledgment represents that the message has been rejected.

The following two configuration settings are also relevant in the context of sending back message acknowledgments for incoming messages:

  • The AckTransactionId configuration setting, if not empty, specifies a transaction Id to associate the message acknowledgment with. It can only be set during the on_message_in event handler, and will be reset when the event handler ends.
  • The RequestAckReceipts configuration setting controls whether the class will request that the server confirm receipt of the message acknowledgment. It is False by default, and can be set at any time.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks MQ 2020 Python Edition - Version 20.0 [Build 8155]