That sounds fine - it doesn't really matter what header you use as the
'correlation token', you could make up your own header if you wish.

Though the reason I said to use JMSCorrelationID was that most well
behaving JMS services should always copy the JMSCorrelationID from any
incoming message and apply it to the outbound message. So using
JMSCorrelationID is more loosely coupled & should work with any JMS
service.

In this case on the client side (A, B, C) there is no real gain in
using Message Groups - which are designed to perform sticky load
balancing of requests - since you are already using a selector meaning
that there will be only 1 consumer of a message so nothing to load
balance. You might want to use message groups on the service side of
things - the Z - so that you could perform sitcky load balancing if
you have a pool of Z consumers.

On 8/18/06, Naveen Rawat <[EMAIL PROTECTED]> wrote:


Hi James,

Thanks for the response.


I achieved the desired behavior for persistent responses and my consumer
application requires applicability to non-persistent
responses for which I would be trying out your suggestions soon.

Queries down there. :)



> > Great James
> > Your suggestion is working. A major hurdle seems solved.
> > A little query down there.
> >
> >
> >
> > > > 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.
> > >
> > > 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
> >
> >
> > I went for this (2nd) one. Even though now a result is obtained, I would
> > like to ask which one approach is more favoured by you.
> > Is it the temporary queues overhead matter that makes 2nd score over 1st?
> > Any other reason please tell.
>
> The main difference is, do you want the response to be persistent.
> e.g. if A dies and comes back again later - do you want it to resume
> processing old results? In which case use a persistent queue and
> correlation IDs. If the responses are transient then use a temporary
> queue so the old messages get discarded by the broker when A dies.
>



You suggested using correlation ID (with persistent queues) for responses to
be persistent and I did it with Group ID following  the

documents -
        http://incubator.apache.org/activemq/message-groups.html
        
http://incubator.apache.org/activemq/how-do-message-groups-compare-to-selec
tors.html

What I have done in code is -

        [..................A/B/C  Senders...........................
        . . . . . . . . .
        // Consumer part that reads the responses from a persistent queue.
        consumer = session->createConsumer(queue, "JMSXGroupID = 'cheese'") ;
        . . . . . . . . .
        . . . . . . . . .
        . . . . . . . . .
        message->setJMSXGroupID("cheese") ;
        producer->send(message) ;
        ................................................................]


        [..........Z Consumer Application (OnMessage).........
        . . . . . . . . .
                p<string> NGid;
                NGid = message->getJMSXGroupID();
        . . . . . . . . .
        . . . . . . . . .
                reqMessage->setJMSXGroupID(NGid->c_str() );
        . . . . . . . . .
        producer->send(reqMessage);
        ................................................................]



Is my approach right? Please correct me.

A bit conerned if my approach equally enable my consumer application
correctly identify to which remote sender the response is

sent?

What is the implementation difference between GroupID and CorrelationID?




                THANKS IN ADVANCE

Regards,
Navin



--

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

Reply via email to