You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by avin98 <av...@yahoo.com> on 2006/07/06 03:07:16 UTC
How to post messages to the same queue in a Cluster
Hi,
I am trying to develop an application which involves quite a number of
round-trips. Basically I need to post messages to a particular queue, and
receive messages out of a particular queue.
These queues are to be in a cluster.
My question is how do I obtain connection to the same queue, everytime.
The code i have is:
InitialContext naming = new InitialContext();
// lookup queue connection factory
QueueConnectionFactory connectionFactory =
(QueueConnectionFactory)
naming.lookup(connectionFactoryName);
// create jms connection
QueueConnection connection =
connectionFactory.createQueueConnection();
System.out.println("Connection is:"+ connection);
// lookup jms queue
Queue queue = (Queue) naming.lookup(queueName);
Now, for the first time I do the lookup ...is there anyway I can store the
hostname of the queue, and get the Queue corresponding to the hostname next
time onwards ???
--
View this message in context: http://www.nabble.com/How-to-post-messages-to-the-same-queue-in-a-Cluster-tf1898012.html#a5192257
Sent from the ActiveMQ - User forum at Nabble.com.
Re: How to post messages to the same queue in a Cluster
Posted by James Strachan <ja...@gmail.com>.
I don't quite understand the question. BTW notes on implementing
request-response here...
http://incubator.apache.org/activemq/how-should-i-implement-request-response-with-jms.html
why do you care what the hostname of the broker you are connected to
is? If you are connecting to a master/slave pair of brokers to achieve
failover & high availability (which I assume is why you want a
cluster) its the same logical queue whether you connect to the master
or the slave
http://incubator.apache.org/activemq/masterslave.html
On 7/6/06, avin98 <av...@yahoo.com> wrote:
>
> Hi,
>
> I am trying to develop an application which involves quite a number of
> round-trips. Basically I need to post messages to a particular queue, and
> receive messages out of a particular queue.
>
> These queues are to be in a cluster.
>
> My question is how do I obtain connection to the same queue, everytime.
>
> The code i have is:
>
> InitialContext naming = new InitialContext();
>
> // lookup queue connection factory
> QueueConnectionFactory connectionFactory =
> (QueueConnectionFactory)
> naming.lookup(connectionFactoryName);
>
>
> // create jms connection
> QueueConnection connection =
> connectionFactory.createQueueConnection();
>
> System.out.println("Connection is:"+ connection);
>
> // lookup jms queue
> Queue queue = (Queue) naming.lookup(queueName);
>
> Now, for the first time I do the lookup ...is there anyway I can store the
> hostname of the queue, and get the Queue corresponding to the hostname next
> time onwards ???
> --
> View this message in context: http://www.nabble.com/How-to-post-messages-to-the-same-queue-in-a-Cluster-tf1898012.html#a5192257
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/