From the perspective of Zato service authors, publish/subscribe offers a few methods for publications and reception
of messages:

Method

Notes

self.pubsub.publish

Sends a message to input topic

self.pubsub.subscribe

Subscribes to a topic, returning subscription key on output

self.pubsub.get_messages

Receives all outstanding messages from input queue by subscription key

self.pubsub.resume_wsx_subscription

Invoked on behalf of WebSocket clients to resume delivery of messages
for an already existing subscription key after clients reconnect to Zato

Note that get_messages expects a subscription key - this is because there may be multiple subscriptions
for each topic so the method needs to know from whose queue to return the messages and it is subscription key
that points to each queue.

Security-wise, methods publish and subscribe check if the endpoints given to them on input have
correct permissions to topics that the endpoints are about to publish or subscribe to.

On the other hand, get_messages assumes that the service that execute it has already carried out any necessary
input validation and authentication or authorization checks, i.e. the method should be used in
trusted code paths because it potentially allows one to access any arbitrary topics and subscriptions.

Resumes delivery for input sub_key to a previously created subscription of a WebSocket client that reconnected
after having its TCP-level connection dropped (e.g. after closing a web browser’s window).

Input data is validated and sub_key is checked to have been issued to the same endpoint that
the calling WebSocket channel is associated with - if this is not fulfilled, an exception is raised (type Exception should
be caught).

Parameters:

sub_key (str) – Subscription key to resume delivery for

service (object) – Service that invokes the method (i.e. self)

Returns:

None

# -*- coding: utf-8 -*-from__future__importabsolute_import,division,print_function,unicode_literalsfromzato.server.serviceimportServiceclassResumeWSXSubscription(Service):defhandle(self):# Prepare inputsub_key='zpsk.wsx.6b0b83ebea3f6e6a64e8e73f'# Resume delivery for that key,# if there is no exception, it means that everything went fineself.pubsub.resume_wsx_subscription(sub_key,self)