On 11/17/2010 09:54 PM, Wolgemuth Greg wrote:
Reply is in-line.

On Wed, 2010-11-17 at 10:13 -0800, Thomas Nguyen wrote:
Hello,



I am testing QPID for the first time and am having trouble with messages
being routed from an exchange to a queue.  I am using a C++ broker and
the Java client to publish messages.  First off here is my initial
exchange and queue setup:



-bash-3.2$ ./qpid-config add exchange topic test.exchange --durable

-bash-3.2$ ./qpid-config add queue test.queue --durable

-bash-3.2$ ./qpid-config bind test.exchange test.queue routingKey



-bash-3.2$ ./qpid-config exchanges -b

Exchange '' (direct)

     bind [test.queue] =>  test.queue

     bind [reply-myhost.com.19752.1] =>  reply-myhost.com.19752.1

     bind [topic-myhost.com.19752.1] =>  topic-myhost.com.19752.1

Exchange 'qpid.management' (topic)

     bind [schema.#] =>  topic-myhost.com.19752.1

     bind [console.obj.*.*.org.apache.qpid.broker.agent] =>
topic-myhost.com.19752.1

Exchange 'amq.direct' (direct)

     bind [reply-myhost.com.19752.1] =>  reply-myhost.com.19752.1

Exchange 'amq.topic' (topic)

Exchange 'amq.fanout' (fanout)

Exchange 'amq.match' (headers)

Exchange 'test.exchange' (topic)

     bind [routingKey] =>  test.queue



-bash-3.2$ ./qpid-config queues -b

Queue 'test.queue'

     bind [test.queue] =>  ''

     bind [routingKey] =>  test.exchange

Queue 'reply-myhost.com.19794.1'

     bind [reply-myhost.com.19794.1] =>  ''

     bind [reply-myhost.com.19794.1] =>  amq.direct

Queue 'topic-myhost.com.19794.1'

     bind [topic-myhost.com.19794.1] =>  ''

     bind [schema.#] =>  qpid.management

     bind [console.obj.*.*.org.apache.qpid.broker.agent] =>
qpid.management

-bash-3.2$



I'm only concerned with the 'test.exchange' exchange and 'test.queue'
queue.  After setting up the exchange and queue I send a message to the
exchange using the Java client and expect to find the 'test.queue' has a
new message.  The Java code I run is pasted here:
http://pastie.org/1304220.  Here is the status of the exchange and queue
using qpid-tool after publishing a message to the exchange:



qpid: show org.apache.qpid.broker:exchange

Object of type org.apache.qpid.broker:exchange: (last sample time:
23:44:11)

     Type       Element            104     105              106
107        108         109        110


========================================================================
============================================

     property   vhostRef           103     103              103
103        103         103        103

     property   name                       qpid.management  amq.direct
amq.topic  amq.fanout  amq.match  test.exchange

     property   type               direct  topic            direct
topic      fanout      headers    topic

     property   durable            False   False            True
True       True        True       True

     property   autoDelete         False   False            False
False      False       False      False

     property   altExchange<NULL>   <NULL>            <NULL>
<NULL>      <NULL>       <NULL>      <NULL>

     property   arguments          {}      {}               {}
{}         {}          {}         {}

     statistic  producerCount      0       0                0           0
0           0          0

     statistic  producerCountHigh  0       0                0           0
0           0          0

     statistic  producerCountLow   0       0                0           0
0           0          0

     statistic  bindingCount       3       2                1           0
0           0          1

     statistic  bindingCountHigh   3       2                1           0
0           0          1

     statistic  bindingCountLow    1       0                0           0
0           0          1

     statistic  msgReceives        0       29551            6328        0
12          0          1

     statistic  msgDrops           0       26164            7           0
4           0          0

     statistic  msgRoutes          0       3387             6321        0
8           0          1

     statistic  byteReceives       0       3648438          2121538     0
72          0          12

     statistic  byteDrops          0       3179885          48          0
24          0          0

     statistic  byteRoutes         0       468553           2121490     0
48          0          12



qpid: show org.apache.qpid.broker:queue

Object of type org.apache.qpid.broker:queue: (last sample time:
23:44:21)

     Type       Element                111
112                                          113


========================================================================
========================================================================
==============================

     property   vhostRef               103
103                                          103

     property   name                   test.queue
mgmt-myhost.com.19824  repl-myhost.com.19824

     property   durable                True
False                                        False

     property   autoDelete             False
True                                         True

     property   exclusive              False
True                                         True

     property   arguments              {u'qpid.file_size': 24L,
u'qpid.file_count': 8L}  {}                                           {}

     property   altExchange<NULL>
<NULL>                                        <NULL>

     statistic  msgTotalEnqueues       0 messages
737                                          41

     statistic  msgTotalDequeues       0
735                                          41

     statistic  msgTxnEnqueues         0
0                                            0

     statistic  msgTxnDequeues         0
0                                            0

     statistic  msgPersistEnqueues     0
0                                            0

     statistic  msgPersistDequeues     0
0                                            0

     statistic  msgDepth               0
2                                            0

     statistic  byteDepth              0 octets
270                                          0

     statistic  byteTotalEnqueues      0
100204                                       15667

     statistic  byteTotalDequeues      0
99934                                        15667

     statistic  byteTxnEnqueues        0
0                                            0

     statistic  byteTxnDequeues        0
0                                            0

     statistic  bytePersistEnqueues    0
0                                            0

     statistic  bytePersistDequeues    0
0                                            0

     statistic  consumerCount          0 consumers
1                                            1

     statistic  consumerCountHigh      0
1                                            1

     statistic  consumerCountLow       0
0                                            0

     statistic  bindingCount           2 bindings
3                                            2

     statistic  bindingCountHigh       2
3                                            2

     statistic  bindingCountLow        2
0                                            0

     statistic  unackedMessages        0 messages
0                                            0

     statistic  unackedMessagesHigh    0
0                                            0

     statistic  unackedMessagesLow     0
0                                            0

    statistic  messageLatencySamples  0
0                                            0

     statistic  messageLatencyMin      0
0                                            0

     statistic  messageLatencyMax      0
0                                            0

     statistic  messageLatencyAverage  0
0                                            0



So the exchange reflects that a message has been published but the queue
does not reflect that it was routed the message.  Anyone know what I am
doing wrong?
The topic exchange can be thought of as a "publish/subscribe" exchange,
in contrast to the direct exchange behaviour of "store and forward". In
other words, a topic exchange will not leave messages in a queue - all
subscribers to a queue will receive a copy of any message sent to that
queue immediately, when using a topic exchange. If a message is sent to
a queue on a topic exchange, and that queue has no subscribers, the
messages simply vanishes (it is sent to no-one, and is then discarded).

If you want the behaviour of having messages persist on the queue, with
or without a subscriber, try establishing a 'direct' queue instead.


I don't believe this is correct. Messages are not dropped if no subscriber to
the queue in the cpp broker, unless for example ttl is set on the messages.

I've had a brief look at the mail, but have not had 10 minutes to look into
what is wrong yet. maybe someone else on the list will get to it before me...

Carl.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscr...@qpid.apache.org

Reply via email to