On Tue, Jul 17, 2012 at 5:52 AM, ghada <[email protected]> wrote: > Hello, > > I am a debutante in programming the Apache QPID. > I want to achieve a Java program "Publisher/subscriber" that sets up a > publisher and two subscribers sharing the same topic. > I searched in forums for examples but I found nothing. > Can someone help me? > > Best regards, > Ghada
Please read the following section to get an overall idea about the Qpid JMS client http://qpid.apache.org/books/0.16/Programming-In-Apache-Qpid/html/QpidJMS.html It will give information on how to setup, connection options, address format etc.. Then you could construct a program as follows. Publisher ======== Connection con = // get the connection Session ssn = con.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = ssn.createTopic("my-topic"); MessageProducer prod = ssn.createProducer(topic); prod.send(ssn.createTextMessage("message")); Subscribers ============= Connection con = // get the connection Session ssn = con.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = ssn.createTopic("my-topic"); MessageConsumer con = ssn.createConsumer(topic); con.receive() Messages sent to "my-topic", will be received by all subscribers on "my-topic". The above code is just a rough illustration only. Hope this helps. Regards, Rajith > -- > View this message in context: > http://qpid.2158936.n2.nabble.com/Pub-Sub-Example-tp7579729.html > Sent from the Apache Qpid users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
