IPWorks IoT 2020 Python Edition

Questions / Feedback?

receive_mode Property

Controls what mode new receiver links are created with.

Syntax

def get_receive_mode() -> int: ...
def set_receive_mode(value: int) -> None: ...

receive_mode = property(get_receive_mode, set_receive_mode)

Default Value

0

Remarks

This property controls which receive mode newly created receiver links should use to receive messages from the sender. Valid values are:

  • rmAutomatic (0 - default)
  • rmFetch (1)

Receiving Messages Automatically

A receiver link operating in rmAutomatic (0) mode strives to ensure that the sender always has sufficient credit so that messages are received as soon as they are available, thus simulating a "subscription-based"/"push-based" messaging model.

In this mode, receiver links will be created with the amount of credit, and the credit threshold, specified by the DefaultCredit and DefaultCreditThreshold configuration settings. Anytime the link's credit reaches the credit threshold, the class will automatically set it back to its initial value.

Fetching Messages On-Demand

A receiver link operating in rmFetch (1) mode requires the fetch_message method to be called in order for a message to be received, thus simulating a "polling"/"pull-based" messaging model.

In this mode, receiver links will be created with no credit (regardless of what DefaultCredit is set to). When fetch_message is called, the class will supply the sender with a single credit and then block until a message is received (if the fetch_timeout property is set to zero).

If fetch_timeout is non-zero, the class will only block for the specified number of seconds; once that time expires, it will instruct the sender to consume the credit. If the sender chooses to consume the credit by incrementing the value of the LinkDeliveryCount property rather than by sending a message, then the class will throw an error indicating a timeout.

Refer to fetch_message and fetch_timeout for more information.

amqp.ReceiveMode = AmqpReceiveModes.rmFetch;
amqp.CreateReceiverLink("SessionID", "ReceiverLinkName", "SomeTarget");

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