[zeromq-dev] Windows and PGM
gdiethelm at dcv.cl
Thu Mar 25 23:37:20 CET 2010
> > Hmm, thinking out loud. Seems like there should be a base C++
> > "device_t" class in 0MQ. This class should be quite simple: it
> > should have a start and a stop method. These methods should call
> > methods that subclasses provide that actually implement the device.
> > The device_t class should be thread safe and calling start should
> > * Start a new application thread that the device will run in.
> > * Call the appropriate method of the subclass that starts the event
> > loop of the device in the thread.
> > * Return immediately.
> > Calling stop should do:
> > * Stop the devices event loop.
> > * Kill the thread.
> > Might also have a pause.
> > Different subclasses can implement appropriate constructors to pass
> > the configuration information to the device.
> > The key though, I think, is to run the device in a thread so it can
> > have its own event loop. Not sure, but you might want to even give
> > each device its own context.
> > Does this make any sense?
> Yes, it does. However, what I had problem with is how all that info
> that's currently available in the xml config file should be passed to
> the device class...
I am doing something similar in my own system. I think it all boils down
to defining "connections" (for lack of a better term), which are a
* Name: unique identity
* Endpoint: inproc://pipe, tcp://22.214.171.124:5000, etc.
* Type: PUB, SUB, REQ, REP, etc.
* Action: bind, connect
If you could pass a list of these to your class, then you would simply
create all these "connections" and then have a poll loop in your own
thread. So for a streamer you could have:
ear = <tcp://127.0.0.1:5001; REP; bind>
mouth = <tcp://127.0.0.1:5002; REQ; connect>
Then your class would know it has to create "ear" and "mouth" and then
This could apply to any kind of "device"; a node in my topology might
need a SUB socket, a REQ socket and an UPSTREAM socket, which I would
define this way as well.
It would certainly be nice if this was supported by 0MQ itself.
Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena.
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje.
"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law.
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message.
More information about the zeromq-dev