qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalle" <ka...@airdice.com>
Subject Re: Messaging scenarios
Date Tue, 03 Jan 2012 14:36:20 GMT
Hi,

It seems that what ever magic I was missing was bundled into using straight up JMS API.

What they did in here:

http://www.novell.com/documentation/extend52/Docs/help/MP/jms/tutorial/durable-1.htm

helped me along. Thanks all! 

-- 
Kalle


On Tuesday 3. January 2012 at 14.31, Kalle wrote:

> forwarding wrongly targeted message to users list. 
> 
> -- 
> Kalle
> 
> 
> Forwarded message:
> 
> > From: Kalle <kalle@airdice.com (mailto:kalle@airdice.com)>
> > To: Gordon Sim <gsim@redhat.com (mailto:gsim@redhat.com)>
> > Date: Tuesday 3. January 2012 14.26.38
> > Subject: Re: Messaging scenarios
> > 
> > 
> > Thanks for all the answers so far!
> > 
> > Here is some of my code (edited for clarity, sorry that it will not compile though).
The situation has evolved, I now try to achieve the queue definitions is application code.
> > 
> > 
> > String qpid = "amqp...";
> > AMQConnectionFactory connectionFactory = new AMQConnectionFactory(qpid);
> > AMQConnection connection = (AMQConnection) connectionFactory.createConnection();
> > connection.start();
> > AMQSession_0_10 session = connection.createSession(TRANSACTIONS,Session.CLIENT_ACKNOWLEDGE,
1));
> > 
> > AMQBindingURL url = new AMQBindingURL("topic://configuration/server1?" + 
> > exclusive='false'&qpid.last_value_queue='true'&qpid.last_value_queue_key='configuration'");
> > 
> > Topic config = new AMQTopic(url); 
> > 
> > MessageConsumer configconsumer = this.session.createSubscriber(config); 
> > 
> > Message configMessage = configconsumer.receive(1000L); 
> > 
> > if (configMessage == null) { 
> > LOGGER.info (http://LOGGER.info)("Configuration was not found in QPID, seeding default");
> > 
> > 
> > .. create configuration object ..
> > 
> > 
> > BytesMessage m = this.session.createBytesMessage(); 
> > m.setStringProperty("configuration", "server1");
> > m.writeBytes(configuration.toByteArray());
> > MessageProducer configproducer = this.session.createPublisher(config);
> > configproducer.send(m, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, 0L);
> > Thread.sleep(100L);
> > configproducer.close();
> > }
> > 
> > 
> > So I'm trying to use the AMQP API instead of JMS (although it seems an unholy combination
of both in the end).
> > 
> > 
> > At the moment this does not work; if I run it twice, both applications log 'configuration
not found'.
> > 
> > 
> > On Tuesday 3. January 2012 at 13.28, Gordon Sim wrote:
> > > As Bruno pointed out, you need to ensure the messages are also marked
> > > durable.
> > > 
> > 
> > 
> > I assume I can achieve this by sending it with persistent delivery mode? 
> > > Also, in passing, it seems redundant to have a ring queue of 1 message
> > > and set the LVQ option. If there is only ever one message on the queue 
> > > the LVQ matching will never be needed (each message will simply replace 
> > > the existing one, regardless of the key).
> > > 
> > 
> > 
> > Agreed. I think in the future I would have multiple different configuration objects,
thus not needing either ring or size definitions. The idea is to have an exchange:
> > 
> > topic://configurations/
> > 
> > with multiple underlying topics
> > 
> > topic://configuration/server1
> > topic://configuration/server2/service1
> > 
> > et cetera. In this scenario LVQ may make more sense?
> > > 
> > > There is no pub-queue, there is (in AMQP 0-10) an 'exchange' to which 
> > > the temporary queues are all bound. Publishers send message to this 
> > > exchange and all queues with a matching binding receive a copy of it.
> > > 
> > 
> > 
> > In BindingURL this would mean a binding parameter with the topic name? 
> > 
> > 
> > 
> > Thanks!
> > 
> > --
> > Kalle.
> > 
> 
> 
> 



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message