[zeromq-dev] amqp client mode from C
Martin Sustrik
sustrik at fastmq.com
Tue Jul 14 12:24:39 CEST 2009
Hi Michael,
> I was able to get my test code to work thanks to your suggestions with
> these lines in the config file
>
> <root>
> <node name = "E" location = "zmq.tcp://localhost:9999"/>
> <node name = "Q" location = "zmq.tcp://localhost:8888"/>
> </root>
>
> these lines in the sender:
>
> eid = zmq_create_exchange (object, "E", ZMQ_SCOPE_LOCAL, "",
> ZMQ_STYLE_DATA_DISTRIBUTION);
> zmq_bind (object, "E", "Q", NULL, "MyQueue");
>
> and these lines in the receiver:
>
> qid = zmq_create_queue (object, "Q", ZMQ_SCOPE_GLOBAL, "lo",
> ZMQ_NO_LIMIT, ZMQ_NO_LIMIT, ZMQ_NO_SWAP);
> zmq_bind (object, "E", "Q", "MyQueue", NULL);
>
> I haven't really tried the AMQP stuff yet.
>
> btw, how would you go about checking if the connection to the zmq
> directory service was successful?
>
> object = zmq_create("localhost:5682");
If what you want is simply to connect to AMQP broker, you can actually
do without zmq_server altogether.
All you have to do is implement a dummy directory service. That will use
the connection string you supply instead of treating it as symbolic name
and asking zmq_server to resolve it. The code can be found here:
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
Then modify the locator cration in libczmq/zmq.cpp like this:
- context->locator = new zmq::locator_t (host_);
+ context->locator = new zmq::dummy_locator_t;
HTH
Martin
More information about the zeromq-dev
mailing list