Module yami :: Class OutgoingMessage
[frames] | no frames]

Class OutgoingMessage

object --+
         |
        OutgoingMessage

Outgoing message.

The handler allowing to track the progress of outgoing message, inspect its state and to obtain the reply content.

Note: The objects of this class can be safely used from multiple threads.

Instance Methods
 
__init__(self, msg)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__enter__(self)
 
__exit__(self, exc_type, exc_val, exc_tb)
 
__del__(self)
 
close(self)
Deallocates internal resources associated with this object.
 
get_state(self)
Returns the state of this message.
 
wait_for_transmission(self, timeout=0)
Waits for the transmission to finish.
 
wait_for_completion(self, timeout=0)
Waits for the full message roundtrip.
 
get_reply(self)
Provides access to the reply content.
 
get_exception_msg(self)
Returns the human-readable reason for message rejection.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  POSTED = 1
  TRANSMITTED = 2
  ABANDONED = 3
  REPLIED = 4
  REJECTED = 5
Properties

Inherited from object: __class__

Method Details

__init__(self, msg)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

close(self)

 

Deallocates internal resources associated with this object.

This function is called automatically if the object is used as a context manager.

get_state(self)

 

Returns the state of this message.

This function allows to inspect the progress of the message transmission and returns a 3-tuple: state, sent and total_byte_count. During transmission the sent value is always smaller than total_byte_count. When these two values become equal, it means that the transmission was either succesful or abandoned.

wait_for_transmission(self, timeout=0)

 

Waits for the transmission to finish.

Waits for the transmission to finish - that is, to either send all the message data or to abandon it. If the timeout value is greater than 0, it means relative timeout in milliseconds; the function returns True if the transmission was finished before the timeout expired and False otherwise. If the timeout value is non-positive, there is no timeout and the function can wait indefinitely. After this function returns True the state of the message is either TRANSMITTED, ABANDONED, REPLIED or REJECTED.

wait_for_completion(self, timeout=0)

 

Waits for the full message roundtrip.

Waits for the full message roundtrip - that is, for some confirmation that the message has been received and reacted upon by the target agent. If the timeout value is greater than 0, it means relative timeout in milliseconds; the function returns True if the message was completed before the timeout expired and False otherwise. If the timeout value is non-positive, there is no timeout and the function can wait indefinitely. After this function returns True the state of the message is either ABANDONED, REPLIED or REJECTED.

Note: This function should not be called if the intended semantics of the message is "one-way" - in this case this function would block indefinitely.