开发者

Using Filters to control message delivery in a HornetQ cluster?

开发者 https://www.devze.com 2023-03-12 00:24 出处:网络
Due to business requirements, I\'m working with a JMS messaging setup in which: Queues must be defined by the application container.

Due to business requirements, I'm working with a JMS messaging setup in which:

  • Queues must be defined by the application container.
  • Queues must be able to exist in a cluster, and balance load.
  • The application must allow the client to specify a subset of cluster nodes that may receive messages from this queue.

Currently every node has an identical hornetq configuration, and each node communicates with the default broadcast setup.

After reading the documentation, I had the thought that I could perhaps set a property on the message that includes a list of legal cluster nodes, then do something along the lines of 'position(${currentNode}, LEGAL_NODES) != 0'. So far I haven't had much success, mostly due to fairly spotty documentation in the hornetq documentation.

Has anyone solved a problem like this? How did you开发者_如何学编程 do it?


I ended up using this selector on each queue:

<selector string="LEGAL_NODES LIKE '%${cluster_identifier}%' OR LEGAL_NODES = ''"/>

After that, I used a Spring MessagePostProcessor to set the LEGAL_NODES property for each message.

0

精彩评论

暂无评论...
验证码 换一张
取 消