Yugang Zhou
Yugang Zhou

Reputation: 7283

How to configure durable-subscriber with spring in a cluster

I have an application publishing some messages. Let's say a PaymentHasBeenMadeEvent

{ orderId:'1234'
  totalPaid:'$100'
  balanceStatus: 'BALANCED'
}

There are several applications care about the event. For example, the shipping application triggers a procedure on the event or the accounting application sends an email on the event.

So I want to publish this event using JMS durable-topic. I should configure each application with a unique client id as I've studied.

What confuses me is that the shipping application is deployed as a cluster with several nodes. But I want the event to be consumed only once by the shipping application. How can I do that?

Or the solution is a flaw as I misunderstood something?

Upvotes: 1

Views: 817

Answers (2)

Manu
Manu

Reputation: 3635

You can use shared subscriber, which was added in JMS 2.0. If you are using Spring 4.1, you can set the subscriptionShared flag as true, so that only one instance in the cluster will receive the message.

Worth referring New Messaging Features in JMS 2.0 too.

Upvotes: 1

user1564836
user1564836

Reputation: 1

use the group syntax. Prepend each listener's topic with the same group. i.e [[payment_group_name]]payment.has.been.made

Upvotes: 0

Related Questions