@@ -35,38 +35,44 @@ def _wrap_subscription(
3535 """Internal method to create an intercepting function for incoming messages
3636 to interpret recipes. This function is then used to subscribe to a channel
3737 on the transport layer.
38- :param transport_layer: Reference to underlying transport object.
39- :param subscription_call: Reference to the subscribing function of the
40- transport layer.
41- :param channel: Channel name to subscribe to.
42- :param callback: Real function to be called when messages are received.
43- The callback will pass three arguments,
44- a RecipeWrapper object (details below), the header as
45- a dictionary structure, and the message.
46-
47- :param allow_non_recipe_messages: Pass on incoming messages that do not
48- include recipe information. In this case the first
49- argument to the callback function will be 'None'.
50- :param log_extender: If the recipe contains useful contextual information
51- for log messages, such as a unique ID which can be used
52- to connect all messages originating from the same
53- recipe, then the information will be passed to this
54- function, which must be a context manager factory.
55- :return: Return value of call to subscription_call.
38+
39+ Args:
40+ transport_layer: Reference to underlying transport object.
41+ subscription_call: Reference to the subscribing function of the transport layer.
42+ channel: Channel name to subscribe to.
43+ callback:
44+ Real function to be called when messages are received.
45+ The callback will pass three arguments: a RecipeWrapper object,
46+ the header as a dictionary structure, and the message.
47+ allow_non_recipe_messages:
48+ Pass on incoming messages that do not include recipe information.
49+ In this case the first argument to the callback function will be None.
50+ log_extender:
51+ If the recipe contains useful contextual information for log messages,
52+ such as a unique ID which can be used to connect all messages
53+ originating from the same recipe, then the information will be passed
54+ to this function, which must be a context manager factory.
55+
56+ Returns:
57+ Return value of call to subscription_call.
5658 """
5759
5860 allow_non_recipe_messages = kwargs .pop ("allow_non_recipe_messages" , False )
5961 log_extender = kwargs .pop ("log_extender" , None )
6062
6163 @functools .wraps (callback )
6264 def unwrap_recipe (header , message ):
63- """This is a helper function unpacking incoming messages when they are
64- in a recipe format. Other messages are passed through unmodified.
65- :param header: A dictionary of message headers. If the header contains
66- an entry 'workflows-recipe' then the message is parsed
67- and the embedded recipe information is passed on in a
68- RecipeWrapper object to the target function.
69- :param message: Incoming deserialized message object.
65+ """Unpack incoming messages when they are in a recipe format.
66+
67+ Other messages are passed through unmodified.
68+
69+ Args:
70+ header:
71+ A dictionary of message headers. If the header contains an entry
72+ 'workflows-recipe' then the message is parsed and the embedded
73+ recipe information is passed on in a RecipeWrapper object to the
74+ target function.
75+ message: Incoming deserialized message object.
7076 """
7177 if mangle_for_receiving :
7278 message = mangle_for_receiving (message )
@@ -125,13 +131,17 @@ def wrap_subscribe(
125131 transport/common_transport.py. Intercept all incoming messages and parse
126132 for recipe information.
127133 See common_transport.subscribe for possible additional keyword arguments.
128- :param transport_layer: Reference to underlying transport object.
129- :param channel: Queue name to subscribe to.
130- :param callback: Function to be called when messages are received.
131- The callback will pass three arguments,
132- a RecipeWrapper object (details below), the header as
133- a dictionary structure, and the message.
134- :return: A unique subscription ID
134+
135+ Args:
136+ transport_layer: Reference to underlying transport object.
137+ channel: Queue name to subscribe to.
138+ callback:
139+ Function to be called when messages are received. The callback will
140+ pass three arguments: a RecipeWrapper object, the header as a
141+ dictionary structure, and the message.
142+
143+ Returns:
144+ A unique subscription ID
135145 """
136146
137147 return _wrap_subscription (
@@ -157,13 +167,17 @@ def wrap_subscribe_broadcast(
157167 subscribe_broadcast call in transport/common_transport.py. Intercept all
158168 incoming messages and parse for recipe information.
159169 See common_transport.subscribe_broadcast for possible arguments.
160- :param transport_layer: Reference to underlying transport object.
161- :param channel: Topic name to subscribe to.
162- :param callback: Function to be called when messages are received.
163- The callback will pass three arguments,
164- a RecipeWrapper object (details below), the header as
165- a dictionary structure, and the message.
166- :return: A unique subscription ID
170+
171+ Args:
172+ transport_layer: Reference to underlying transport object.
173+ channel: Topic name to subscribe to.
174+ callback:
175+ Function to be called when messages are received. The callback will
176+ pass three arguments: a RecipeWrapper object, the header as a
177+ dictionary structure, and the message.
178+
179+ Returns:
180+ A unique subscription ID
167181 """
168182
169183 return _wrap_subscription (
0 commit comments