Results 1 to 3 of 3

Thread: DefaultMessageListenerContainer not really concurrent

  1. #1
    Join Date
    Oct 2008
    Posts
    3

    Default DefaultMessageListenerContainer not really concurrent

    I've got a DMLC with concurrentConsumers set to a non-1 value and ActiveMQ 5.1, no app server, no transactions. I noticed that if one thread gets a message, the next message may go to that same thread, even if that thread is still working in onMessage(). In other words, ActiveMQ doesn't seem to send the message to the consumers that are in receive(), it just sends it to any of the consumers, perhaps one that's blocked for a long time.

    Has anyone seen this? Is it an ActiveMQ-specific problem? I was forced to spawn a thread in onMessage() to avoid blocking any consumers, and in fact then dropped my concurrentConsumers to 1, which solved it. This means I can't use transactions or client-ack, though, and it seems weird to have this DMLC with fancy but useless multi-consumer logic.

    Lawrence

  2. #2
    Join Date
    Jan 2008
    Location
    San Diego
    Posts
    780

    Default

    Spawning a thread in your on message handler is a very bad idea.

    I'm not familiar with activemq but what you are describing sounds like a prefetch setting. Prefetch causes the message provider to queue several messages for the consumer which means that they won't be available for another consumer (e.g. another of your threads) until either they are consumed or the consumer rolls back and they are made available to the queue again.

    We use tibco and we turned off all prefetching as it was causing some erroneous behavior in certain situations...

  3. #3
    Join Date
    Oct 2008
    Posts
    3

    Default

    Quote Originally Posted by chudak View Post
    Spawning a thread in your on message handler is a very bad idea.
    Why?

    Quote Originally Posted by chudak View Post
    I'm not familiar with activemq but what you are describing sounds like a prefetch setting.
    Yes, you're right. This is probably the fifth time I've run into unpleasant ActiveMQ behavior that was later attributed to prefetch. But it's the default setting, which means that turning it off runs ActiveMQ through infrequently-used code. I've had poor luck with such code in ActiveMQ. :-)

    Lawrence

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •