(Migrated) 2.0 REST Publish/subscribe guide

(This message has been automatically imported from the retired mailing list)

Hello,

please find below a link to the Publish/subscribe guide - a feature new
in the upcoming 2.0 release that lets one build loosely coupled networks
of REST producer/consumer applications exchanging messages through
Redis-based topics.

https://zato.io/docs/2.0/pubsub/index.html
https://zato.io/docs/2.0/project/changelog.html

HI

Just been reading the docs on pub/sub.

Is it possible for a zato service to publish a message to a topic directly rather than calling the REST publish message itself…

ie take the zato tutorial example for instance. If you have multiple external parties that want to know about possible fraud, rather than calling each one explicitly, one could publish to the topic, and all the subscribers will get the messages.

Cheers

Tim

Regards,

Tim Hoffman
Team Lead - Relay

RESOURCE EQUIPMENT LIMITED
276 Treasure Rd Welshpool WA 6106 | PO Box 328 Welshpool DC WA 6986

T. +61 8 6141 6500 | F. +61 8 9258 9804 | D. +61 8 6141 6532 | M. +61 448 414 044 | E. THoffman@rel.com.au | W. http://www.REL.com.au

The whole team at REL would like to wish you and your family a Merry Christmas and a very safe and Happy New Year
Our offices will be closed from noon Wednesday 24th of December, 2014,
Reopening at 8:00am Monday, 12th of January, 2015.

Obviously all of your needs will continue to be serviced 24 hour per day, 7 days per week over this period, by our “on call team”, where and when you need them by simply calling our branch office number anytime or your local REL contact directly.

“SAFETY IS NO ACCIDENT AT RESOURCE EQUIPMENT LTD. COMMITTED TO ZERO HARM”


From: Zato-discuss [zato-discuss-bounces@lists.zato.io] on behalf of Dariusz Suchojad [dsuch@zato.io]
Sent: 09 January 2015 22:43
To: zato-discuss@lists.zato.io
Subject: [Zato-discuss] 2.0 REST Publish/subscribe guide

Hello,

please find below a link to the Publish/subscribe guide - a feature new
in the upcoming 2.0 release that lets one build loosely coupled networks
of REST producer/consumer applications exchanging messages through
Redis-based topics.

https://zato.io/docs/2.0/pubsub/index.html
https://zato.io/docs/2.0/project/changelog.html

On 10/01/15 08:50, Tim Hoffman wrote:

Is it possible for a zato service to publish a message to a topic directly rather than calling the REST publish message itself…

Hi Tim,

yes, services can publish messages as well.

self.pubsub.publish(‘My Message’, ‘/topic/name’)

This is the API services use:

https://github.com/zatosource/zato/blob/master/code/zato-common/src/zato/common/pubsub/init.py#L870

Though for the initial release of pub/sub only .publish will be supported.

As you can see, there’s also .subscribe and a lot of other calls but in
2.0 services won’t be able to subscribe to REST topics. The calls are
used by other parts of the platform.

I’ll update the docs to include .publish usage examples - thanks for asking!

On 10/01/15 08:50, Tim Hoffman wrote:

ie take the zato tutorial example for instance. If you have multiple external parties
that want to know about possible fraud, rather than calling each one explicitly,
one could publish to the topic, and all the subscribers will get the messages.

I hit ‘Send’ too soon - this is a very interesting idea. I’ll see about
re-writing parts of the tutorial to use the built-in pub/sub.

I guess there won’t be room for ZeroMQ in that case but perhaps it’s not
an issue.

thanks again,

Given we can publish internally, it raises the obvious question and that is can a zato service subscribe to a topic internally as well?

T

Regards,

Tim Hoffman
Team Lead - Relay

RESOURCE EQUIPMENT LIMITED
276 Treasure Rd Welshpool WA 6106 | PO Box 328 Welshpool DC WA 6986

T. +61 8 6141 6500 | F. +61 8 9258 9804 | D. +61 8 6141 6532 | M. +61 448 414 044 | E. THoffman@rel.com.au | W. http://www.REL.com.au

“SAFETY IS NO ACCIDENT AT RESOURCE EQUIPMENT LTD. COMMITTED TO ZERO HARM”

-----Original Message-----
From: Dariusz Suchojad [mailto:dsuch@zato.io]
Sent: Saturday, 10 January 2015 4:20 PM
To: Tim Hoffman; zato-discuss@lists.zato.io
Subject: Re: [Zato-discuss] 2.0 REST Publish/subscribe guide

On 10/01/15 08:50, Tim Hoffman wrote:

Is it possible for a zato service to publish a message to a topic directly rather than calling the REST publish message itself…

Hi Tim,

yes, services can publish messages as well.

self.pubsub.publish(‘My Message’, ‘/topic/name’)

This is the API services use:

https://github.com/zatosource/zato/blob/master/code/zato-common/src/zato/common/pubsub/init.py#L870

Though for the initial release of pub/sub only .publish will be supported.

As you can see, there’s also .subscribe and a lot of other calls but in
2.0 services won’t be able to subscribe to REST topics. The calls are
used by other parts of the platform.

I’ll update the docs to include .publish usage examples - thanks for asking!

On 13/01/15 01:24, Tim Hoffman wrote:

Given we can publish internally, it raises the obvious question
and that is can a zato service subscribe to a topic internally as well?

This is not exactly how the implementation works, but outwardly it can
be said that each Zato service is already always subscribed to the topic
whose name is equal to that of the service.

So you can simply publish internally without a need for a previous
subscription.