activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: Unable to create MessageProducer
Date Mon, 12 Nov 2007 16:02:36 GMT
On 12/11/2007, TOPPER_HARLEY <> wrote:
> >"It could just be the socket has been dropped.":
> Is socket dropping a common occurence or simply related to the quality of
> the network one is running on (my TCP level knowledge isn't great).

Its normally a glitch in the network - or that the broker died.

> Would
> vm: style for the brokerURL prevent this since it would be insice JVM?


> This is our setup:
> We have a number of predefined topics which we use when broadcasting updates
> and number temp queues for direct request/responses communication (one for
> each of our clients). We maintain one connection on the server side and as
> we send data from different threads, we cache a threadlocal session object
> (since ActiveMQSession is for single thread use). For each individual
> message send, we create and destroy a MessageProducer based on the
> destination as follows:
> try {
>       // Thread local retrieval
>       final Session session = this.getSession();
>       producer = session.createProducer(destination);
>       producer.send(message);
> } finally {
>      if (producer != null) {
>          try {
>              producer.close();
>          } catch (final JMSException e) {
>                  e.printStackTrace();
>          }
>       }
> }

This is an inefficient way of using JMS BTW...

you should try pool producers if you can.

> >"You night wanna enable failover...":
> We have only been assigned one port for the broker (specified obviously as
> part of the brokerURL property) so I dont know if failover can assist us:

Failover causes the client to reconnect to the broker if the socket dies.

>  my
> understanding of failover is that you need more than one URI and AMQ
> switches to another one if one broker goes down:

Not true - it works fine with a single broker URI


Open Source SOA

View raw message