You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Bruno Matos <br...@paradigmaxis.pt> on 2013/02/01 16:07:48 UTC

Broker Federation - replying to queue

Hi,

Imagine that I have two brokers, b1 and b2 that have a federation link
witch sends every message from b1 amq.direct exchange to b2. b1 has a
client connected that sends a request to amq.direct/requests with
replyTo set to his local queue. b2 has a server connected that listens
for requests in amq.direct/requests. The server receives the request, is
it possible to send the reply to b1 queue as set in message replyTo
property? If not, any suggestion to accomplish this?

Thank you.

-- 
Bruno Matos


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Broker Federation - replying to queue

Posted by Gordon Sim <gs...@redhat.com>.
On 02/04/2013 04:25 PM, Bruno Matos wrote:
> Anyway, I was hoping that would be a more transparent way to do this.
> Replicating all the queues seams overkill.
> One way could be change the default exchange to something else, but that
> means change the behavior of many components in the system.

That was going to be my suggestion(!). In its simplest form, if you are 
creating temporary response queues on demand in the clients, would be to 
change from using e.g. '#' to 'amq.direct/#' as the address for these 
clients. That does likely require a change to all the clients though.

In a variation of this, if the senders used reply-to addresses of the 
form 'amq.fanout/<queue-name>', where <queue-name> is the name of their 
reply queue then the server connected to B2 will send the replies to 
amq.fanout, with the routing key set to <queue-name>.

You could then create a bridge from amq.fanout on B2 to the default 
exchange on B1. Unfortunately you can't do that through qpid-route as it 
forces the name of the exchange in a route to be the same, but that is a 
limitation of the options to that tool rather than the actual mechanism. 
You can use qpid-tool or a custom script instead.

Now all the replies would get to their intended queue without requiring 
any extra bindings or whatever on B1.

The disadvantage of course is that this scheme now *requires* 
federation. If you decommissioned B2 and connected the server directly 
to B1, then the modified reply-to address would no longer be valid.

And of course it still requires updating all the clients, so its likely 
not any improvement.

> Any other suggestion(s) would be really appreciated.

To get around the need to alter clients, you could instead try a 
modification to the server program such that it handled the reply-to 
differently for requests that came via federation (e.g. by pre-pending 
'amq.fanout/' to the address supplied by the client in that case.

One way of differentiating between federated requests and others would 
be to check the x-qpid.trace property on the message. (Another would be 
to have such messages come via a different queue and update the server 
to listen on both).

I'm not sure if this is any better... the bottom line is that there is 
no nice transparent solution to reply-to in federation as yet.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Broker Federation - replying to queue

Posted by Bruno Matos <br...@paradigmaxis.pt>.
Hi Ken,

It didn't work. The message stays in the B2 and no message is sent for
B1 queue.
Anyway, I was hoping that would be a more transparent way to do this.
Replicating all the queues seams overkill.
One way could be change the default exchange to something else, but that
means change the behavior of many components in the system.
Any other suggestion(s) would be really appreciated.

Thank you,
Regards.

On Sex, 2013-02-01 at 13:46 -0500, Ken Giusti wrote:
> Hi Bruno,
> 
> There's probably a few ways to solve this.
> 
> If you have complete control over creating queues on B1 and B2, then one possibility would be to create a queue on B2 with the same name as the reply to queue that is on B1, then create a federation queue route from the B2 queue over to B1's default exchange.  E.g.: assuming the reply to queue on B1 is called "response-Q":
> 
> qpid-config add queue -b B2 response-Q
> qpid-route queue add B1 B2 "" response-Q
> 
> 
> 
> -K
> 
> ----- Original Message -----
> > Hi Ken,
> > 
> > Thank you for your reply.
> > My problem is with the default exchange, the server receives a queue
> > from the other broker in the replyTo field with no exchange defined.
> > 
> > Thank you,
> > Regards.
> > 
> > On Sex, 2013-02-01 at 10:43 -0500, Ken Giusti wrote:
> > > Hi Bruno,
> > > 
> > > Since federation routes are uni-directional, you'd need to create
> > > another route to get from b2 back to b1 for the response.
> > > 
> > > Here's a simple example using the 'drain' and 'spout' clients:
> > > 
> > > If I have two brokers:
> > > 
> > > qpidd --auth no -p 8888
> > > qpidd --auth no -p 9999
> > > 
> > > And set up two routes, one in each direction:
> > > 
> > >  qpid-route dynamic add 127.0.0.1:9999 127.0.0.1:8888 amq.direct
> > >  qpid-route dynamic add 127.0.0.1:8888 127.0.0.1:9999 amq.direct
> > > 
> > > Then, from different consoles I can send replies and responses:
> > > 
> > > (from 8888 ---> 9999)
> > > ./drain -f -b 127.0.0.1:9999 "amq.direct/request; {create:always}"
> > > ./spout -b 127.0.0.1:8888 --content "FOO" "amq.direct/request"
> > > 
> > > (from 9999 ---> 8888)
> > > ./drain -f -b 127.0.0.1:8888 "amq.direct/response; {create:always}"
> > > ./spout -b 127.0.0.1:9999 --content "FOO" "amq.direct/response"
> > > 
> > > 
> > > -K
> > > 
> > > ----- Original Message -----
> > > > Hi,
> > > > 
> > > > Imagine that I have two brokers, b1 and b2 that have a federation
> > > > link
> > > > witch sends every message from b1 amq.direct exchange to b2. b1
> > > > has a
> > > > client connected that sends a request to amq.direct/requests with
> > > > replyTo set to his local queue. b2 has a server connected that
> > > > listens
> > > > for requests in amq.direct/requests. The server receives the
> > > > request,
> > > > is
> > > > it possible to send the reply to b1 queue as set in message
> > > > replyTo
> > > > property? If not, any suggestion to accomplish this?
> > > > 
> > > > Thank you.
> > > > 
> > > > --
> > > > Bruno Matos
> > > > 
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > > > For additional commands, e-mail: users-help@qpid.apache.org
> > > > 
> > > > 
> > 
> > --
> > Bruno Matos
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > For additional commands, e-mail: users-help@qpid.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
> 

-- 
Bruno Matos


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Broker Federation - replying to queue

Posted by Ken Giusti <kg...@redhat.com>.
Hi Bruno,

There's probably a few ways to solve this.

If you have complete control over creating queues on B1 and B2, then one possibility would be to create a queue on B2 with the same name as the reply to queue that is on B1, then create a federation queue route from the B2 queue over to B1's default exchange.  E.g.: assuming the reply to queue on B1 is called "response-Q":

qpid-config add queue -b B2 response-Q
qpid-route queue add B1 B2 "" response-Q



-K

----- Original Message -----
> Hi Ken,
> 
> Thank you for your reply.
> My problem is with the default exchange, the server receives a queue
> from the other broker in the replyTo field with no exchange defined.
> 
> Thank you,
> Regards.
> 
> On Sex, 2013-02-01 at 10:43 -0500, Ken Giusti wrote:
> > Hi Bruno,
> > 
> > Since federation routes are uni-directional, you'd need to create
> > another route to get from b2 back to b1 for the response.
> > 
> > Here's a simple example using the 'drain' and 'spout' clients:
> > 
> > If I have two brokers:
> > 
> > qpidd --auth no -p 8888
> > qpidd --auth no -p 9999
> > 
> > And set up two routes, one in each direction:
> > 
> >  qpid-route dynamic add 127.0.0.1:9999 127.0.0.1:8888 amq.direct
> >  qpid-route dynamic add 127.0.0.1:8888 127.0.0.1:9999 amq.direct
> > 
> > Then, from different consoles I can send replies and responses:
> > 
> > (from 8888 ---> 9999)
> > ./drain -f -b 127.0.0.1:9999 "amq.direct/request; {create:always}"
> > ./spout -b 127.0.0.1:8888 --content "FOO" "amq.direct/request"
> > 
> > (from 9999 ---> 8888)
> > ./drain -f -b 127.0.0.1:8888 "amq.direct/response; {create:always}"
> > ./spout -b 127.0.0.1:9999 --content "FOO" "amq.direct/response"
> > 
> > 
> > -K
> > 
> > ----- Original Message -----
> > > Hi,
> > > 
> > > Imagine that I have two brokers, b1 and b2 that have a federation
> > > link
> > > witch sends every message from b1 amq.direct exchange to b2. b1
> > > has a
> > > client connected that sends a request to amq.direct/requests with
> > > replyTo set to his local queue. b2 has a server connected that
> > > listens
> > > for requests in amq.direct/requests. The server receives the
> > > request,
> > > is
> > > it possible to send the reply to b1 queue as set in message
> > > replyTo
> > > property? If not, any suggestion to accomplish this?
> > > 
> > > Thank you.
> > > 
> > > --
> > > Bruno Matos
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > > For additional commands, e-mail: users-help@qpid.apache.org
> > > 
> > > 
> 
> --
> Bruno Matos
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Broker Federation - replying to queue

Posted by Bruno Matos <br...@paradigmaxis.pt>.
Hi Ken,

Thank you for your reply.
My problem is with the default exchange, the server receives a queue
from the other broker in the replyTo field with no exchange defined.

Thank you,
Regards.

On Sex, 2013-02-01 at 10:43 -0500, Ken Giusti wrote:
> Hi Bruno,
> 
> Since federation routes are uni-directional, you'd need to create another route to get from b2 back to b1 for the response.
> 
> Here's a simple example using the 'drain' and 'spout' clients:
> 
> If I have two brokers:
> 
> qpidd --auth no -p 8888
> qpidd --auth no -p 9999
> 
> And set up two routes, one in each direction:
> 
>  qpid-route dynamic add 127.0.0.1:9999 127.0.0.1:8888 amq.direct
>  qpid-route dynamic add 127.0.0.1:8888 127.0.0.1:9999 amq.direct
> 
> Then, from different consoles I can send replies and responses:
> 
> (from 8888 ---> 9999)
> ./drain -f -b 127.0.0.1:9999 "amq.direct/request; {create:always}"
> ./spout -b 127.0.0.1:8888 --content "FOO" "amq.direct/request"
> 
> (from 9999 ---> 8888)
> ./drain -f -b 127.0.0.1:8888 "amq.direct/response; {create:always}"
> ./spout -b 127.0.0.1:9999 --content "FOO" "amq.direct/response"
> 
> 
> -K
> 
> ----- Original Message -----
> > Hi,
> > 
> > Imagine that I have two brokers, b1 and b2 that have a federation
> > link
> > witch sends every message from b1 amq.direct exchange to b2. b1 has a
> > client connected that sends a request to amq.direct/requests with
> > replyTo set to his local queue. b2 has a server connected that
> > listens
> > for requests in amq.direct/requests. The server receives the request,
> > is
> > it possible to send the reply to b1 queue as set in message replyTo
> > property? If not, any suggestion to accomplish this?
> > 
> > Thank you.
> > 
> > --
> > Bruno Matos
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > For additional commands, e-mail: users-help@qpid.apache.org
> > 
> > 

-- 
Bruno Matos


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Broker Federation - replying to queue

Posted by Ken Giusti <kg...@redhat.com>.
Hi Bruno,

Since federation routes are uni-directional, you'd need to create another route to get from b2 back to b1 for the response.

Here's a simple example using the 'drain' and 'spout' clients:

If I have two brokers:

qpidd --auth no -p 8888
qpidd --auth no -p 9999

And set up two routes, one in each direction:

 qpid-route dynamic add 127.0.0.1:9999 127.0.0.1:8888 amq.direct
 qpid-route dynamic add 127.0.0.1:8888 127.0.0.1:9999 amq.direct

Then, from different consoles I can send replies and responses:

(from 8888 ---> 9999)
./drain -f -b 127.0.0.1:9999 "amq.direct/request; {create:always}"
./spout -b 127.0.0.1:8888 --content "FOO" "amq.direct/request"

(from 9999 ---> 8888)
./drain -f -b 127.0.0.1:8888 "amq.direct/response; {create:always}"
./spout -b 127.0.0.1:9999 --content "FOO" "amq.direct/response"


-K

----- Original Message -----
> Hi,
> 
> Imagine that I have two brokers, b1 and b2 that have a federation
> link
> witch sends every message from b1 amq.direct exchange to b2. b1 has a
> client connected that sends a request to amq.direct/requests with
> replyTo set to his local queue. b2 has a server connected that
> listens
> for requests in amq.direct/requests. The server receives the request,
> is
> it possible to send the reply to b1 queue as set in message replyTo
> property? If not, any suggestion to accomplish this?
> 
> Thank you.
> 
> --
> Bruno Matos
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org