[zeromq-dev] Error handling in client code.

Martin Sustrik sustrik at fastmq.com
Mon May 11 10:48:12 CEST 2009


Hi Theo,

Sorry for delay. Our mail server was down of Friday :(

> I'm interested.  My interest in zeromq is not so much its performance, 
> but its light weight relative to other solutions out there.  0MQ looks 
> light and self contained and I really appreciate that over running 
> something like RabbitMQ (which requires an erlang install) or ApacheMQ 
> which requires a 44MB install. I also really don't need a lot of the 
> features that either bring and the concept of zeromq seems to satisfy my 
> basic requirements.

So the two possibilities are:

1. Return error code instead of assert when zmq_server is not accessible 
(see the previous email).

2. Get rid of zmq_server altogether. This would mean that you have to 
supply IP addresses or hostnames instead of symbolic names. To achieve 
this kind of behaviour use a dummy_locator instead of the locator 
supplied with 0MQ package. The source code can be found here (it's 
pretty simple):

http://svn.fastmq.org/svn/zeromq/branches/dj/libzmq/zmq/dummy_locator.hpp
http://svn.fastmq.org/svn/zeromq/branches/dj/libzmq/dummy_locator.cpp

In your code just use dummy_locator_t instead of locator and supply 
component addresses ("192.168.0.115:5555") instead of a symbolic name 
("my_queue").

> I'm not sure what I want here w.r.t. zeromq.  Here's the basic 
> architecture of the app:
> 
> I have a long running process written in C (A) that pulls durable queues 
> from multiple datacenters (aggregating metric and status data).  This 
> process inserts data into a relational database for mining.  I'd also 
> like this process to queue messages to a real-time event processing 
> system (B) written in Java.  The Java process needs to be long running 
> as well (as the event processing is based on context of data -- and if 
> it restarts, it is an expensive process to restore context in the 
> temporal stream of events.  So, if A goes done, I don't want B to assert 
> and if B goes down I don't want A to assert.  And if they use a broker 
> (like zmq_server) I don't want a momentary disruption of that broker to 
> cause those processes to stop.  Those processes already have extensive 
> alerting mechanisms in them as that are mission critical.
> 
> I *think* I want (B) to have a global queue called "firehose" to which 
> (A) sends events and (A) to have a global queue called "alerts" over 
> which (B) returns a heavily filtered stream.

See the attached diagram. I believe it summarises your use case. If you 
go with the option 2 (dummy locator), both the components in the 
datacenters and B would have to know IP address/hostname of A. That 
seems like a pretty reasonable assumption.

Hope this helps.
Martin

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: theo.png
Type: image/png
Size: 10517 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090511/021d596a/attachment.png>


More information about the zeromq-dev mailing list