On 19/03/2019 12:15, Gordon Sim wrote:
On 19/03/2019 9:17 am, Toralf Lund wrote:
Hi,

Is there any way I can find out how many applications or processes have connected to a certain queue on a qpid cpp broker?

Related question: If I enter "show <id>" for a numeric queue id in qpid-tool, it shows me a "consumerCount" value. What exactly does this represent? I though it might give me something like what I'm asking for above, but I see numbers like 204 and 458 for queues that are supposed to have only a couple of subscribers...

What does qpid-stats -q show for that queue?

$ qpid-stat -b cirm -q pgs.compass.control
Properties:
  Name                 Durable  AutoDelete  Exclusive FlowStopped  FlowStoppedCount  Consumers  Bindings
=========================================================================================================
  pgs.compass.control  N        N           N N            0                 257        2

Optional Properties:
  Property      Value
=============================================================================================================================================================================================
  arguments     {u'qpid.ha-uuid': UUID('110fa007-74bc-4533-b510-4e2404155e95'), u'qpid.max_count': 100, u'qpid.policy_type': u'ring', u'qpid.replicate': 'all', u'qpid.browse-only': u'True'}
  alt-exchange

Statistics:
  Statistic                   Messages  Bytes
  ==============================================
  queue-depth                 0         0
  total-enqueues              91        28,617
  total-dequeues              91        28,617
  persistent-enqueues         0         0
  persistent-dequeues         0         0
  transactional-enqueues      0         0
  transactional-dequeues      0         0
  flow-to-disk-depth          0         0
  flow-to-disk-enqueues       0         0
  flow-to-disk-dequeues       0         0
  acquires                    0
  releases                    0
  discards-ttl-expired        91
  discards-limit-overflow     0
  discards-ring-overflow      0
  discards-lvq-replace        0
  discards-subscriber-reject  0
  discards-purged             0
  reroutes                    0

The consumer count should indeed be the number of current consumers (subscribers) on the queue.

Right.

So I guess the problem is actually that there are somehow a lot of "spurious" subscribers. I suspected something like that all along, but I kind of assumed there would be 1 or 2 extra ones, not several 100. The original issue was that it looked like someone else consumed all the messages before they reached the intended receiver. That's for the queue shown above - the consumer count is unexpectedly high on others, too, but those are shared, "browse-only" queues, so it's kind of hard to notice any effects. You may notice that "browse-only" is also "True" above, but the queue was only set up that way as a workaround after messages were lost.

I actually just noticed something that might be causing this:

It turns out that the applications attempts to receive messages from the queues will every once in a while fail with error "Failed to connect (reconnect disabled)". After that, I see indications that the following piece of code actually re-opens the connection:

      if(!connection.isOpen()) {
        cerr << "Open AMQP connection...\n";

        connection.open();
        /* "session" might contain a dangling pointer to session object
   from
           a previously open connection - reset it. */
        session=qpid::messaging::Session();
      }

      if(session.isValid() && session.hasError()) {
        session.close();
        session=qpid::messaging::Session();
      }
      if(!session.isValid())
        session=connection.createSession();

I don't think connection.close() is ever called. "connection" is of type qpid::messaging::Connection, of course.

Could  that fit with what I'm seeing? Is there a chance that Connection::isOpen() returns false after an error, yet the connection isn't really released? How should I detect and handle that situation?

Related question to related question: It there any proper documentation for qpid-tool? I've read https://urldefense.proofpoint.com/v2/url?u=https-3A__qpid.apache.org_releases_qpid-2Dcpp-2D1.37.0_cpp-2Dbroker_book_chapter-2DManaging-2DCPP-2DBroker.html&d=DwICaQ&c=KV_I7O14pmwRcmAVyJ1eg4Jwb8Y2JAxuL5YgMGHpjcQ&r=Q0oqxzgUp3xCCIiJDwS-RbNDndQ-KZDhj8wwveNoqU4&m=IW8dpoHLD8lt4A8nL_IMlHpiyevxre4ruTbRvUATO0k&s=NKBpvTIkzNv5BHoil8bbI2rA1ZGhg0sad8jowdoJt4g&e=, but it only has a very brief overview that appears to be out-of-date.

No, I don't think there is I'm afraid. You can type help at it and it will list the commands available.

Too bad :-(

I guess the "help" information was good enough in a sense in this case, it was just that I got unsure about everything when the values didn't seem to make sense, given an "obvious" interpretation of the field names...

- Toralf



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to