0

Is there any way you can control the order delivery of messages in a topic in EMS or Tibco (using a JMS Topic Subscriber)? Something like the message selector, but instead of filtering to do ordering.

I would like to use a header like JMSXDeliveryCount, so that new messages will get a higher priority. I know that there's RedeliveryDelay, but that works only for queues, not topics.

Even JMSPriority could be an option if I can set it after getting the message with a topic subscriber. Can I do that? Maybe with a Java Code activity?

Adrian Ber
  • 20,474
  • 12
  • 67
  • 117

2 Answers2

0

The broker will deliver messages in order as it receives them, but re-ordering messages is a distributed computing / EIP problem (see sequencer). The issue is the broker does't know how many messages are coming or how long to keep the window open for re-ordering messages. This activity is best done outside the broker in your application where that information is understood.

EIP frameworks and ESB's have done a nice job of standardizing a handler for this type of workflow.

ref: EIP Sequencer http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageSequence.html

Matt Pavlovich
  • 4,087
  • 1
  • 9
  • 17
  • My question is about EMS not Camel. – Adrian Ber Dec 13 '16 at 04:45
  • Right.. I was just using Camel's documentation and syntax to illustrate the logic / algorithm. Any EIP or integration framework can perform the function. The point is.. don't rely on the broker to do it. – Matt Pavlovich Dec 13 '16 at 14:33
  • I edited my answer to remove the references to Camel's resequencer example – Matt Pavlovich Dec 13 '16 at 14:50
  • Actually JMSPriority is already used to order messages. And if a message with a higher priority comes in it will be redelivered first, without any concern about future messages. My problem is if I can set this for messages redelivered. – Adrian Ber Jan 04 '17 at 16:20
0

JMSPriority is indeed an option, but it cannot be set on an already received message. The solution is to confirm the message and republished it with a different priority.

Adrian Ber
  • 20,474
  • 12
  • 67
  • 117