Xbus recipient API¶
Description of the API Xbus recipients must implement in order to register into an Xbus network.
Version of this document: 0.2.
Methods described in this document:
get_metadata()
ping()
has_clearing()
has_immediate_reply()
start_event()
send_item()
end_event()
end_envelope()
stop_envelope()
Workflows¶
Recipients can receive multiple events concurently, the only constraint is that the broker cannot send start_event
to a recipient until it is “ready”.
Events corresponding to a particular envelope are sequential.
There is no start_envelope
event, the recipient is expected to infer the begining of envelopes with the envelope IDs passed in each event.
get_metadata¶
-
get_metadata
()¶ Required.
Called to ask for information about the recipient.
Return type: dict Returns: A dictionary. Required return dictionary keys:
- name (string): Name of the recipient.
- version (float): Version of the recipient.
- api_version (float): Version of the Xbus recipient API.
- host (string): Host name of the server hosting the recipient.
- start_date (string): ISO 8601 date-time of When the recipient was started.
- local_time (string): ISO 8601 time on the recipient server.
Optional return dictionary keys:
- locale (string): Locale code, in a format specified by BCP 47 <http://tools.ietf.org/html/bcp47>.
ping¶
-
ping
(token) Required.
Called when Xbus wants to check whether the recipient is up.
Parameters: token (str) – String that must be sent back. Returns: The token string sent as parameter.
has_clearing¶
-
has_clearing
()¶ Required.
Called to determine whether the recipient supports the “data clearing” feature; and if it does, to get more information about that process.
Returns: 2-element tuple: - Boolean indicating whether the feature is supported.
- URL of the data clearing database (or nothing if the feature is not supported). The database must respect the schema described in the “Data clearing” section of the Xbus documentation.
has_immediate_reply¶
-
has_immediate_reply
()¶ Required.
Called to determine whether the recipient supports the “immediate reply” feature.
Returns: 2-element tuple: - Boolean indicating whether the feature is supported.
- List of event type names the recipient declares immediate reply support for.