activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Queue hogging by a single consumer.
Date Fri, 18 Aug 2006 10:06:13 GMT
More details here along with example code in the Lingo project...
http://activemq.org/site/how-should-i-implement-request-response-with-jms.html

here's some pseudocode...

// client side
Destination tempDest = session.createTemporaryQueue();
session.createConsumer(tempDest);

// send a request..
message.setJMSReplyTo(tempDest);
message.setJMSCorrelationID(myCorrelationID);
producer.send(message);


// server side
public void onMessage(Message request) {

Message response = session.createMessage();
response.setJMSCorrelationID(request.getJMSCorrelationID())

producer.send(request.getJMSReplyTo(), response)
}



On 8/18/06, ahamad <arashadsaifi@indiatimes.com> wrote:
>
>
> >
> James.Strachan wrote:
> >
> >>On 8/17/06, Naveen Rawat <naveen@in.effectsoft.com> wrote:
> >>> Hi James,
> >>>
> >>> Thanks for your response.
> >>>
> >>>
> >>> > Are you trying to implement request-response with A, B, C making
> >>> > requests on Z and getting the response? Or can A, B, C process any
> >>> > message from Z?
> >>>
> >>>
> >>> Exactly the first case.
> >>> A, B, C making requests on Z and getting the response from Z
> >>>
> >>>
> >>>
> >> >> I'm not sure if your issue is that say A doesn't see the responses
for
> >> >> its request (if thats the case use either 3 queues, use temporary
> >> > >queues for the responses or use a selector and a correlationID on the
> >> >> request & response) - or is it that you have a small number of
> >> > >responses from Z and they are being hogged by one consumer - in which
> >> >> case setting a small prefetch and a round robin dispatch policy will
> >> >> fix this.
> >>>
> >>>
> >> >Its that,  A doesn't see the responses for its requests made.
> >>>
> >> >I would really appreciate if I can get some help stuff on -
> >>  >       1) Creating, destroying and maintaining data in temporary
> >> queues.
> >>  >       2) Setting selector and correlationID in messages.
> >
> >>Details here
> >
> >>http://incubator.apache.org/activemq/how-should-i-implement-request-response-with-jms.html
> >
> >>for 1) just call session.createTemporaryQueue() and set that queue on
> >>the Message.setJMSReplyTo() property so that services can reply to
> >>your temporary queue. They are deleted when A terminates so there's no
> >>issue with maintaining data.
> >
> >  Message.setJMSReplyTo( destination) API wants to set the destination so
> > please tell me How I can set the destination for that and How Sender gets
> > this responce without set the MessageListener  at the sender site. Please
> > help me ...
> >
> >
> >>for 2) just add a JMSCorrelationID() to the request messages you send
> >>as requests. You can then use a selector such as "JMSCorrelationID =
> >>'abc'" on the consumer for responses so that responses are filtered to
> >>only return A's results etc
> >
> >>The contract of Z whichever option you go with is the to copy the
> >>JMSCorrelationID property from the request to the response message and
> >>send the response message to the request.getJMSReployTo() destination
> >
> >>--
> >
> >>James
> >>-------
> >>http://radio.weblogs.com/0112098/
> >
> >>
>
> Thanks
> Arashad Ahmad
> --
> View this message in context: http://www.nabble.com/Queue-hogging-by-a-single-consumer.-tf2119797.html#a5866866
> Sent from the ActiveMQ - Dev forum at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message