qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Robie <jonathan.ro...@redhat.com>
Subject Re: Publish-Subscribe queue question
Date Tue, 02 Nov 2010 21:10:26 GMT
On 11/01/2010 09:04 PM, zhaoyi0113@gmail.com wrote:
>
> In this thread
>
> http://apache-qpid-users.2158936.n2.nabble.com/What-is-the-different-between-qpid-client-Session-h-and-qpid-messaging-Session-h-tt5569296.html#a5569296
>
> you told me that the new API is in active development. what I think is that
> the new API is not finished and not safe to use. So I will use old API until
> the new API is ready.

Your call. Out of curiosity, what is it that you think is not ready or 
may be unsafe? Personally, I would feel perfectly safe using the new API.

> Could you let me know how I can create a topic in old API? The pub-sub
> example uses queue to handle the pub-sub pattern, how can I use topic to
> handle this?

Sure, here's a very simple example using the AMQP direct exchange, where 
the publishers and subscribers match based on a simple routing key:

Declare queues:
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/direct/declare_queues.cpp?revision=726140&view=markup

Publisher:
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/direct/direct_producer.cpp?view=markup

Listener:
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/direct/listener.cpp?view=markup

Here's the code for a topic publisher that uses hierarchical keys and 
the AMQP topic exchange:

http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/pub-sub/topic_publisher.cpp?view=markup

And a topic listener:

http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/pub-sub/topic_listener.cpp?view=co

These examples are included with older versions of Qpid. You might want, 
for example, to download the examples that come with Qpid release 0.5.

Jonathan


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message