*I have read your letter, but I have create a MessageProducer, please look
at the code below, and I have use  Spring2.0*
**
**

public class OrderMessageProducer {
 *private JmsTemplate template;*

 private Queue destination;

 public void setTemplate(JmsTemplate template) {
  this.template = template;
 }

 public void setDestination(Queue destination) {
  this.destination = destination;
 }

 public void send(Order order) {
  template.*convertAndSend*(this.destination, order);
 }

}



2007/11/13, James Strachan <[EMAIL PROTECTED]>:
>
> failover is just used by the brokerURL property of the connection
> factory.  Btw session and producers are cheap objects to keep around
> they are just a bit slow to create on demand. For sending the
> PooledConnectionFactory should help
>
> On 12/11/2007, TOPPER_HARLEY <[EMAIL PROTECTED]> wrote:
> >
> > >"Its normally a glitch in the network - or that the broker died." :
> > I'm pretty sure the broker was OK since a new client could get a
> connection
> > & session and create a temp queue. I previously registered another query
> (
> >
> http://www.nabble.com/Temp-queue-deleted-when-thread-interrupted-tf4393533s2354.html#a12527277
> > here ) regarding using VM style and temp queues getting deleted so this
> is
> > why we began using tcp style on server side.....
> >
> > >"This is an inefficient way of using JMS BTW...you should try pool
> > producers if you can.":
> >
> > Yes I was reading that but was wondering what is a ballpark figure to
> start
> > with for pooling e.g. 10 sessions & 10 producers (I realise its not
> possible
> > to accurately w/o application knowledge but a best guess would be
> > appreciated since they are heavy objects to create...?)
> >
> > >"Failover causes the client to reconnect to the broker if the socket
> > dies.":
> > Regarding where the failover syntax is needed, is this required in the
> > transportConnector part of the activeMQ.xml or server side, or just the
> > client i.e. as part of the
> > org.apache.activemq.ActiveMQConnectionFactory.brokerURL for the
> > SimpleMessageListenerContainer?
> >
> > /Tom
> >
> >
> >
> > James.Strachan wrote:
> > >
> > > On 12/11/2007, TOPPER_HARLEY <[EMAIL PROTECTED]> 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?
> > >
> > > Yes
> > >
> > >
> > >> 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...
> > >
> > > http://activemq.apache.org/how-do-i-use-jms-efficiently.html
> > >
> > > 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
> > >
> > > --
> > > James
> > > -------
> > > http://macstrac.blogspot.com/
> > >
> > > Open Source SOA
> > > http://open.iona.com
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/Unable-to-create-MessageProducer-tf4782623s2354.html#a13709793
> > Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >
> >
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source SOA
> http://open.iona.com
>



-- 
JackGray

Reply via email to