You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by andi welchlin <an...@gmail.com> on 2017/11/28 16:19:45 UTC

QPID C++ Broker: Message Routing

Hello,

I tried to create a route between exchanges. When I sent a message to the
exchange on the first broker I did not get the message when I tried to read
from the second broker.

What I did is simple:

- Startet two qpid daemons one on port 9001 and one on port 9002.
- qpid-config -b localhost:9001 add exchange topic ex
- qpid-config -b localhost:9002 add exchange topic ex
- qpid-route route add localhost:9001 localhost:9002 ex exroute


--------------------------------------------------------------------
Looked if route are there:

qpid-route route map localhost:9001

Finding Linked Brokers:
    localhost:9001... Ok
    localhost:9002...
Ok

Dynamic Routes:
  none found

Static Routes:

  localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute


And on second broker:

qpid-route route map localhost:9002

Finding Linked Brokers:
    localhost:9002... Ok
    localhost:9001...
Ok

Dynamic Routes:
  none found

Static Routes:

  localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute
--------------------------------------------------------------------


I started qpid-receive:

qpid-receive -b localhost:9001 -a ex
--connection-option='{protocol:amqp1.0}' --timeout 999

... and sent a message using qpid-send:

qpid-send -b localhost:9002 -a ex --connection-option='{protocol:amqp1.0}'
--content-string "msg1"



I would have expected to see the message with qid-receive but nothing
happened. Did I miss something?

I am using the C++ broker 1.36.0.


Kind Regards,
Andreas

Re: QPID C++ Broker: Message Routing

Posted by Gordon Sim <gs...@redhat.com>.
On 28/11/17 16:52, andi welchlin wrote:
> I could do it without a key like:
> 
> qpid-route route add localhost:9001 localhost:9002 ex ''
> 
> But will this lead to defined behaviour? With a key given which is empty?

For a topic exchange that will I think only match where the routing key 
is also an empty string. For a topic exchange maybe try '#' instead.

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


Re: QPID C++ Broker: Message Routing

Posted by andi welchlin <an...@gmail.com>.
I could do it without a key like:

qpid-route route add localhost:9001 localhost:9002 ex ''

But will this lead to defined behaviour? With a key given which is empty?


On Tue, Nov 28, 2017 at 5:19 PM, andi welchlin <an...@gmail.com>
wrote:

> Hello,
>
> I tried to create a route between exchanges. When I sent a message to the
> exchange on the first broker I did not get the message when I tried to read
> from the second broker.
>
> What I did is simple:
>
> - Startet two qpid daemons one on port 9001 and one on port 9002.
> - qpid-config -b localhost:9001 add exchange topic ex
> - qpid-config -b localhost:9002 add exchange topic ex
> - qpid-route route add localhost:9001 localhost:9002 ex exroute
>
>
> --------------------------------------------------------------------
> Looked if route are there:
>
> qpid-route route map localhost:9001
>
> Finding Linked Brokers:
>     localhost:9001... Ok
>     localhost:9002...
> Ok
>
> Dynamic Routes:
>   none found
>
> Static Routes:
>
>   localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute
>
>
> And on second broker:
>
> qpid-route route map localhost:9002
>
> Finding Linked Brokers:
>     localhost:9002... Ok
>     localhost:9001...
> Ok
>
> Dynamic Routes:
>   none found
>
> Static Routes:
>
>   localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute
> --------------------------------------------------------------------
>
>
> I started qpid-receive:
>
> qpid-receive -b localhost:9001 -a ex --connection-option='{protocol:amqp1.0}'
> --timeout 999
>
> ... and sent a message using qpid-send:
>
> qpid-send -b localhost:9002 -a ex --connection-option='{protocol:amqp1.0}'
> --content-string "msg1"
>
>
>
> I would have expected to see the message with qid-receive but nothing
> happened. Did I miss something?
>
> I am using the C++ broker 1.36.0.
>
>
> Kind Regards,
> Andreas
>
>

Re: QPID C++ Broker: Message Routing

Posted by Gordon Sim <gs...@redhat.com>.
On 28/11/17 16:48, andi welchlin wrote:
> Thank you, Gordon. It works.
> 
> Is it possible to set the route without any key? I do not need it but I had
> to give it a key, otherwise the qpid-route utility exits with usage output:

You could try with '#' (which means everything on a topic exchange). (If 
you don't need separate keys, you could also just use a fanout exchange).

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


Re: QPID C++ Broker: Message Routing

Posted by andi welchlin <an...@gmail.com>.
Thank you, Gordon. It works.

Is it possible to set the route without any key? I do not need it but I had
to give it a key, otherwise the qpid-route utility exits with usage output:

---------------------------------
qpid-route route add localhost:9001 localhost:9002 ex

Usage:  qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker>
<exchange> [tag] [exclude-list] [mechanism]
        qpid-route [OPTIONS] dynamic del <dest-broker> <src-broker>
<exchange>

        qpid-route [OPTIONS] route add   <dest-broker> <src-broker>
<exchange> <routing-key> [tag] [exclude-list] [mechanism]
        qpid-route [OPTIONS] route del   <dest-broker> <src-broker>
<exchange> <routing-key>
        qpid-route [OPTIONS] queue add   <dest-broker> <src-broker>
<exchange> <queue> [mechanism]
        qpid-route [OPTIONS] queue del   <dest-broker> <src-broker>
<exchange> <queue>
        qpid-route [OPTIONS] route list  [<dest-broker>]
        qpid-route [OPTIONS] route flush [<dest-broker>]
        qpid-route [OPTIONS] route map   [<broker>]

        qpid-route [OPTIONS] link add  <dest-broker> <src-broker>
[mechanism]
        qpid-route [OPTIONS] link del  <dest-broker> <src-broker>
        qpid-route [OPTIONS] link list [<dest-broker>]
---------------------------------

Cheers,
Andreas


On Tue, Nov 28, 2017 at 5:30 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 28/11/17 16:19, andi welchlin wrote:
>
>> Hello,
>>
>> I tried to create a route between exchanges. When I sent a message to the
>> exchange on the first broker I did not get the message when I tried to
>> read
>> from the second broker.
>>
>> What I did is simple:
>>
>> - Startet two qpid daemons one on port 9001 and one on port 9002.
>> - qpid-config -b localhost:9001 add exchange topic ex
>> - qpid-config -b localhost:9002 add exchange topic ex
>> - qpid-route route add localhost:9001 localhost:9002 ex exroute
>>
>>
>> --------------------------------------------------------------------
>> Looked if route are there:
>>
>> qpid-route route map localhost:9001
>>
>> Finding Linked Brokers:
>>      localhost:9001... Ok
>>      localhost:9002...
>> Ok
>>
>> Dynamic Routes:
>>    none found
>>
>> Static Routes:
>>
>>    localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute
>>
>>
>> And on second broker:
>>
>> qpid-route route map localhost:9002
>>
>> Finding Linked Brokers:
>>      localhost:9002... Ok
>>      localhost:9001...
>> Ok
>>
>> Dynamic Routes:
>>    none found
>>
>> Static Routes:
>>
>>    localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute
>> --------------------------------------------------------------------
>>
>>
>> I started qpid-receive:
>>
>> qpid-receive -b localhost:9001 -a ex
>> --connection-option='{protocol:amqp1.0}' --timeout 999
>>
>> ... and sent a message using qpid-send:
>>
>> qpid-send -b localhost:9002 -a ex --connection-option='{protocol
>> :amqp1.0}'
>> --content-string "msg1"
>>
>>
>>
>> I would have expected to see the message with qid-receive but nothing
>> happened. Did I miss something?
>>
>
> Your route is for 'ex/exroute'. If you use that in the sender and receiver
> I think it should work. If you want the routes to be dynamically adjusted
> to match actual binding syou need the dynamic option to qpid-route. (If you
> just want simple pub-sub with no need for distinct routing keys, you can
> change your topic to type fanout).
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: QPID C++ Broker: Message Routing

Posted by Gordon Sim <gs...@redhat.com>.
On 28/11/17 16:19, andi welchlin wrote:
> Hello,
> 
> I tried to create a route between exchanges. When I sent a message to the
> exchange on the first broker I did not get the message when I tried to read
> from the second broker.
> 
> What I did is simple:
> 
> - Startet two qpid daemons one on port 9001 and one on port 9002.
> - qpid-config -b localhost:9001 add exchange topic ex
> - qpid-config -b localhost:9002 add exchange topic ex
> - qpid-route route add localhost:9001 localhost:9002 ex exroute
> 
> 
> --------------------------------------------------------------------
> Looked if route are there:
> 
> qpid-route route map localhost:9001
> 
> Finding Linked Brokers:
>      localhost:9001... Ok
>      localhost:9002...
> Ok
> 
> Dynamic Routes:
>    none found
> 
> Static Routes:
> 
>    localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute
> 
> 
> And on second broker:
> 
> qpid-route route map localhost:9002
> 
> Finding Linked Brokers:
>      localhost:9002... Ok
>      localhost:9001...
> Ok
> 
> Dynamic Routes:
>    none found
> 
> Static Routes:
> 
>    localhost:9001(ex=ex) <= localhost:9002(ex=ex) key=exroute
> --------------------------------------------------------------------
> 
> 
> I started qpid-receive:
> 
> qpid-receive -b localhost:9001 -a ex
> --connection-option='{protocol:amqp1.0}' --timeout 999
> 
> ... and sent a message using qpid-send:
> 
> qpid-send -b localhost:9002 -a ex --connection-option='{protocol:amqp1.0}'
> --content-string "msg1"
> 
> 
> 
> I would have expected to see the message with qid-receive but nothing
> happened. Did I miss something?

Your route is for 'ex/exroute'. If you use that in the sender and 
receiver I think it should work. If you want the routes to be 
dynamically adjusted to match actual binding syou need the dynamic 
option to qpid-route. (If you just want simple pub-sub with no need for 
distinct routing keys, you can change your topic to type fanout).

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