On ZeroMQ it could be something like that...first you need a broker (a
proxy) using XSUB and XPUB.
In one pharo image... (I think this part better be done in C because it
will freezy the image forever but it works)

 | frontend backend |
frontend := ZmqXSubscriberSocket new.
frontend bind: 'tcp://*:5559'.
backend := ZmqXPublisherSocket new.
backend bind: 'tcp://*:5560'.
ZmqProxy frontend: frontend backend: backend capture: nil

In any publisher or subscriber...

publisher := ZmqPublisherSocket new connect: 'tcp://localhost:5559'.

pr1 := [
|subscriber1|
subscriber1 := ZmqSubscriberSocket new connect: 'tcp://localhost:5560'.
[true] whileTrue:[
          "receive is non blocking so this is an infinite loop"

subscriber1 receiveIfAvailable: [ :messageData|

messageData isEmpty ifFalse:[Transcript show: ('Subscriber 1 got stuff ' ,
messageData);cr]]

]] forkNamed: 'subscriber1'.

"Publish doing that"
 publisher send: ('Hello Subscribers') asByteArray.

El jue, 1 jul 2021 a las 21:03, Esteban Maringolo (<emaring...@gmail.com>)
escribió:

> On Thu, Jul 1, 2021 at 3:00 PM Jesus Mari Aguirre
> <jmariagui...@gmail.com> wrote:
> >
> > As far as I know, zmq doesn't need a broker but subscribers should know
> the address of the publisher, if the network increases its complexity with
> more publishers you need a broker,  that is a proxy on zmq.
> > If I understand well you need any of them should be able to publish a
> change to all of the other images?
>
> I want to broadcast notifications of updated objects so they can be
> recomputed or reloaded from the database to reflect the latest
> changes.
> The change might happen in any of the worker images, either by user UI
> or API call.
>
> Regards!
>
> Esteban A. Maringolo
>

Reply via email to