Results 1 to 8 of 8

Thread: MessageChannelPartitionHandler, basic jms question

  1. #1

    Default MessageChannelPartitionHandler, basic jms question

    Hi,
    It's been a while since I've played with messaging in Java, so forgive me

    I want multiple subscribers (remote instances) to process messages. Each message should only be processed one time, so it's not a JMS topic.

    Can I have multiple subscribers on a single JMS queue, or do I need to create a new JSM queue for each subscriber?

    Thank you,
    Phillip

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    Queue consumers are not called "subscribers". There is nothing to stop you using a single queue from multiple consumers - that's usually known as the Competing Consumers Pattern.

  3. #3

    Default

    Awesome, exactly what I was looking for.
    Competing Consumers Pattern.

  4. #4
    Join Date
    Jun 2007
    Posts
    17

    Default

    Can I use the Competing Consumers Pattern to solve the problem below?

    I use DefaultMessageListenerContainer defines a listener to pick up messages in a queue and process them.

    The issue I need to solve is that when a service used to process the messages is down I want to put the messages back to the queue and to be processed later, say in 10 minutes.

    How to set the 10 minutes to the messages when put them back to the queue so the listener will not pick them up or filter them out in the next 10 minutes?

    Is there a way to filter the message in jms queue by a dynamically generated timestamp?

  5. #5

    Default

    If a service used to process the messages is down, then how would the messages be moved off the queue in the first place?

    I would design your system so that the process that is processing the message is the same that is pulling it off the queue.

  6. #6
    Join Date
    Jun 2007
    Posts
    17

    Default

    Sorry it was not made clear.

    The listener to process the messages in a jms queue is not down but a service the listener calls as a part of the process is down. When that happens the listener gets the message but can not complete the process so put it back to the queue. The service may be brought up in 10 minutes. At that time the message can be processed.

  7. #7

    Default

    There is a Retry handling that I think it work for you. Do a search for Retry in the spring batch documentation.

  8. #8
    Join Date
    Jun 2007
    Posts
    17

    Default

    It's solved.

    Basically I used org.apache.activemq.ActiveMQConnectionFactory so configue a redeliveryPolicy for it. It defines initialRedeliveryDelay that can be set to 10 minutes.

Posting Permissions

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