[ 
https://issues.apache.org/jira/browse/AMQ-7232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16866534#comment-16866534
 ] 

Gary Tully commented on AMQ-7232:
---------------------------------

[~lionel.cons] I see your point, but there is no magic here. There are three 
messages in play. The queue counters reflect what the broker sees. If PT1 
produces a persistent message, the topic send will not be stored, but there 
will be two journal entries for each of the consumer queues.
virtual topics are implemented as an interceptor that just does queue.send(), 
from the point of view of the implementation, there are only "solid" lines. I 
hope this helps explain.

> Incorrect message counters when using virtual destinations
> ----------------------------------------------------------
>
>                 Key: AMQ-7232
>                 URL: https://issues.apache.org/jira/browse/AMQ-7232
>             Project: ActiveMQ
>          Issue Type: Bug
>            Reporter: Lionel Cons
>            Priority: Major
>         Attachments: Virtual Destinations.jpg
>
>
> ActiveMQ supports [virtual 
> destinations|https://activemq.apache.org/virtual-destinations] to magically 
> link one or more queues to a topic.
> It also supports [JMX attributes|https://activemq.apache.org/jmx.html] to 
> count messages going through the different destinations in a broker. There 
> are both per-destination attributes ({{EnqueueCount}} and {{DequeueCount}}) 
> and per-broker attributes ({{TotalEnqueueCount}} and {{TotalDequeueCount}}).
> Unfortunately, these two features do not work well together.
> Take for instance the following scenario:
>  * one topic ({{/topic/T}})
>  * two virtual queues attached to it({{/queue/Consumer.A.T}} and 
> {{/queue/Consumer.B.T}})
>  * one topic producer ({{PT1}})
>  * two queue consumers on each virtual queue ({{CA1}}, {{CA2}}, {{CB1}} and 
> {{CB2}})
> !Virtual Destinations.jpg!
> When sending a single message, we get:
>  * {{/topic/T}}: {{EnqueueCount += 1}} and {{DequeueCount += 0}}
>  * {{/queue/Consumer.A.T}}: {{EnqueueCount += 1}} and {{DequeueCount += 1}}
>  * {{/queue/Consumer.B.T}}: {{EnqueueCount += 1}} and {{DequeueCount += 1}}
>  * at broker level: {{TotalEnqueueCount += 3}} and {{TotalDequeueCount += 2}}
> This is not consistent: when the message leaves the topic to go to the 
> virtual queues, {{DequeueCount}} (on the topic) does not change while 
> {{EnqueueCount}} (on the queues) does change.
> At broker level, {{TotalEnqueueCount}} gets incremented too much, giving the 
> impression that 3 messages have been received.
> The main question is: should the counters be incremented when a message is 
> magically forwarded from the topic to the attached virtual queues?
> I would argue that these counters should *not* change when messages move 
> internally (i.e. along dashed lines). This way, we can continue to have 
> {{TotalEnqueueCount}} being the sum of all {{EnqueueCount}} and at the same 
> time representing the number of messages received (globally) by the broker. 
> Idem for {{TotalDequeueCount}} and {{DequeueCount}}.
> IMHO, these counters should only change when messages move along solid lines. 
> If we want to track the internals (i.e. dashed lines) then we should have an 
> additional counter, a bit like we already have {{ForwardCount}} for network 
> of brokers.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to