You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by jjw tectec <jj...@gmail.com> on 2016/01/15 20:17:12 UTC

federated broker system - end-to-end messaging not working

Hello,

I'm trying to set up a federated broker system and testing 3 brokers so
far: B1->B2->B3. I'm not seeing messages published to B1 received by
subscriber attached to B3. However, in my tests, Pub->B1->B2->Sub and
Pub->B2->B3->Sub are both working. Below are some configuration details
that I've used. Can somebody help?

Script for creating queues/exchanges, bindings, and routes:
qpid-config -a $B1 add queue $QUEUE --durable
qpid-config -a $B2 add queue $QUEUE --durable
qpid-config -a $B2 add exchange topic $EX --durable
qpid-config -a $B3 add exchange topic $EX --durable

 qpid-config -a $B2 bind $EX $QUEUE keyX --durable

 qpid-route -v -d queue add $B2 $B1 $EX $QUEUE
 qpid-route -s -v -d queue add $B3 $B2 $EX $QUEUE
=================

In the publisher code:
address.setType("queue");
msg.setSubject("keyX");

In the subscriber code:
address.setType("topic");

==================
When doing:
  Pub -> B1 -> B2 -> B3 -> Sub
I was hoping that the message will carry "keyX" as the routing key, gets
published into B1's queue, delivered into B2's exchange, then B2 will use
"keyX" to route message into B2's queue, delivered into B3's exchange,
delivered to Sub.

But since I'm not seeing messages flow from one end to the other, looks
like B2's binding between its exchange and queue is not working the way I
wanted it to. Am I missing something?

Hope to get your help. Thanks very much,

jjw

Re: federated broker system - end-to-end messaging not working

Posted by jjw tectec <jj...@gmail.com>.
Ok, thank you so much!

On Tue, Jan 19, 2016 at 1:58 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 01/19/2016 07:56 PM, jjw tectec wrote:
>
>> Thanks Gordon. Adding the link option worked. However, even after
>>
>> msg.setProperty("x-amqp-0-10.routing-key", "keyX"); // publisher
>>
>> msg.getProperties()["x-amqp-0-10.routing-key"].asString() is still the
>> queue name, not "keyX" (at the subscriber);
>>
>> Is this an expected behavior?
>>
>
> Yes. In AMQP 0-10, the only way to send directly to the queue is to set
> the routing key to the queue name, which is what is done by the library
> when you send the message on a sender created with the queue as the target
> address.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: federated broker system - end-to-end messaging not working

Posted by Gordon Sim <gs...@redhat.com>.
On 01/19/2016 07:56 PM, jjw tectec wrote:
> Thanks Gordon. Adding the link option worked. However, even after
>
> msg.setProperty("x-amqp-0-10.routing-key", "keyX"); // publisher
>
> msg.getProperties()["x-amqp-0-10.routing-key"].asString() is still the
> queue name, not "keyX" (at the subscriber);
>
> Is this an expected behavior?

Yes. In AMQP 0-10, the only way to send directly to the queue is to set 
the routing key to the queue name, which is what is done by the library 
when you send the message on a sender created with the queue as the 
target address.


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


Re: federated broker system - end-to-end messaging not working

Posted by jjw tectec <jj...@gmail.com>.
Thanks Gordon. Adding the link option worked. However, even after

msg.setProperty("x-amqp-0-10.routing-key", "keyX"); // publisher

msg.getProperties()["x-amqp-0-10.routing-key"].asString() is still the
queue name, not "keyX" (at the subscriber);

Is this an expected behavior?

Thank you!

jjw

On Tue, Jan 19, 2016 at 11:53 AM, Gordon Sim <gs...@redhat.com> wrote:

> On 01/19/2016 05:23 PM, jjw tectec wrote:
>
>> Hi Gordon,
>>
>> Yes, changing the key name to queue name made messages flow end-to-end.
>> I had also suspected that the routing key wasn't set the way I wanted it
>> be. So I had tried to set and get routing-key property at the client
>> sides:
>>
>> publisher:
>> msg.setProperty("x-amqp-0-10.routing-key", "keyX");
>>
>> subscriber:
>> cout << msg.getProperties()["x-amqp-0-10.routing-key"].asString();
>>
>> But the above code caused the following compilation errors:
>>
>> /usr/bin/ld: /tmp/ccNXSPL7.o: undefined reference to symbol
>> '_ZN4qpid5types7VariantD1Ev'
>> //usr/local/lib/libqpidtypes.so.1: error adding symbols: DSO missing from
>> command line
>>
>> Do you know why was that?
>>
>
> Are you adding -lqpidtypes to your link options when compiling/linking?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: federated broker system - end-to-end messaging not working

Posted by Gordon Sim <gs...@redhat.com>.
On 01/19/2016 05:23 PM, jjw tectec wrote:
> Hi Gordon,
>
> Yes, changing the key name to queue name made messages flow end-to-end.
> I had also suspected that the routing key wasn't set the way I wanted it
> be. So I had tried to set and get routing-key property at the client sides:
>
> publisher:
> msg.setProperty("x-amqp-0-10.routing-key", "keyX");
>
> subscriber:
> cout << msg.getProperties()["x-amqp-0-10.routing-key"].asString();
>
> But the above code caused the following compilation errors:
>
> /usr/bin/ld: /tmp/ccNXSPL7.o: undefined reference to symbol
> '_ZN4qpid5types7VariantD1Ev'
> //usr/local/lib/libqpidtypes.so.1: error adding symbols: DSO missing from
> command line
>
> Do you know why was that?

Are you adding -lqpidtypes to your link options when compiling/linking?


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


Re: federated broker system - end-to-end messaging not working

Posted by jjw tectec <jj...@gmail.com>.
Hi Gordon,

Yes, changing the key name to queue name made messages flow end-to-end.
I had also suspected that the routing key wasn't set the way I wanted it
be. So I had tried to set and get routing-key property at the client sides:

publisher:
msg.setProperty("x-amqp-0-10.routing-key", "keyX");

subscriber:
cout << msg.getProperties()["x-amqp-0-10.routing-key"].asString();

But the above code caused the following compilation errors:

/usr/bin/ld: /tmp/ccNXSPL7.o: undefined reference to symbol
'_ZN4qpid5types7VariantD1Ev'
//usr/local/lib/libqpidtypes.so.1: error adding symbols: DSO missing from
command line

Do you know why was that?
Thanks very much

jjw

On Mon, Jan 18, 2016 at 4:20 AM, Gordon Sim <gs...@redhat.com> wrote:

> On 01/15/2016 07:17 PM, jjw tectec wrote:
>
>> Hello,
>>
>> I'm trying to set up a federated broker system and testing 3 brokers so
>> far: B1->B2->B3. I'm not seeing messages published to B1 received by
>> subscriber attached to B3. However, in my tests, Pub->B1->B2->Sub and
>> Pub->B2->B3->Sub are both working. Below are some configuration details
>> that I've used. Can somebody help?
>>
>> Script for creating queues/exchanges, bindings, and routes:
>> qpid-config -a $B1 add queue $QUEUE --durable
>> qpid-config -a $B2 add queue $QUEUE --durable
>> qpid-config -a $B2 add exchange topic $EX --durable
>> qpid-config -a $B3 add exchange topic $EX --durable
>>
>>   qpid-config -a $B2 bind $EX $QUEUE keyX --durable
>>
>>   qpid-route -v -d queue add $B2 $B1 $EX $QUEUE
>>   qpid-route -s -v -d queue add $B3 $B2 $EX $QUEUE
>> =================
>>
>> In the publisher code:
>> address.setType("queue");
>> msg.setSubject("keyX");
>>
>> In the subscriber code:
>> address.setType("topic");
>>
>> ==================
>> When doing:
>>    Pub -> B1 -> B2 -> B3 -> Sub
>> I was hoping that the message will carry "keyX" as the routing key, gets
>> published into B1's queue, delivered into B2's exchange, then B2 will use
>> "keyX" to route message into B2's queue, delivered into B3's exchange,
>> delivered to Sub.
>>
>> But since I'm not seeing messages flow from one end to the other, looks
>> like B2's binding between its exchange and queue is not working the way I
>> wanted it to. Am I missing something?
>>
>
> The way that AMQP 0-10 is defined, the 'destination' of a transfer is
> always an exchange. When sending 'direct' to a queue, the qpid::messaging
> library will set the destination to '' (the so-called 'default exchange')
> and set the routing key to the queue name. (If there is a subject that is
> different from this, it will be carried as an application property named
> 'qpid.subject').
>
> So in your case the message as published to 'queue' on B1 will not have
> the routing key set to 'keyX' as you expect, and hence it will be dropped
> by B2 as there is no matching binding.
>
> Would it be possible to rename 'queue' on B1 as 'keyX' (or use 'queue' as
> the key in the binding against the exchange pn B2?
>
> Alternatively, could you change the exchange used to be a fanout exchange
> and not require key based bindings?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: federated broker system - end-to-end messaging not working

Posted by Gordon Sim <gs...@redhat.com>.
On 01/15/2016 07:17 PM, jjw tectec wrote:
> Hello,
>
> I'm trying to set up a federated broker system and testing 3 brokers so
> far: B1->B2->B3. I'm not seeing messages published to B1 received by
> subscriber attached to B3. However, in my tests, Pub->B1->B2->Sub and
> Pub->B2->B3->Sub are both working. Below are some configuration details
> that I've used. Can somebody help?
>
> Script for creating queues/exchanges, bindings, and routes:
> qpid-config -a $B1 add queue $QUEUE --durable
> qpid-config -a $B2 add queue $QUEUE --durable
> qpid-config -a $B2 add exchange topic $EX --durable
> qpid-config -a $B3 add exchange topic $EX --durable
>
>   qpid-config -a $B2 bind $EX $QUEUE keyX --durable
>
>   qpid-route -v -d queue add $B2 $B1 $EX $QUEUE
>   qpid-route -s -v -d queue add $B3 $B2 $EX $QUEUE
> =================
>
> In the publisher code:
> address.setType("queue");
> msg.setSubject("keyX");
>
> In the subscriber code:
> address.setType("topic");
>
> ==================
> When doing:
>    Pub -> B1 -> B2 -> B3 -> Sub
> I was hoping that the message will carry "keyX" as the routing key, gets
> published into B1's queue, delivered into B2's exchange, then B2 will use
> "keyX" to route message into B2's queue, delivered into B3's exchange,
> delivered to Sub.
>
> But since I'm not seeing messages flow from one end to the other, looks
> like B2's binding between its exchange and queue is not working the way I
> wanted it to. Am I missing something?

The way that AMQP 0-10 is defined, the 'destination' of a transfer is 
always an exchange. When sending 'direct' to a queue, the 
qpid::messaging library will set the destination to '' (the so-called 
'default exchange') and set the routing key to the queue name. (If there 
is a subject that is different from this, it will be carried as an 
application property named 'qpid.subject').

So in your case the message as published to 'queue' on B1 will not have 
the routing key set to 'keyX' as you expect, and hence it will be 
dropped by B2 as there is no matching binding.

Would it be possible to rename 'queue' on B1 as 'keyX' (or use 'queue' 
as the key in the binding against the exchange pn B2?

Alternatively, could you change the exchange used to be a fanout 
exchange and not require key based bindings?


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