使用Spring JMS接收任务分配
我正在尝试从 JMS 队列接收 JMS 消息。收到消息后,它们被转发到不同的服务器进行处理。
我想用有关与之通信的服务器和进程状态的信息来实例化消息侦听器。
使用可用的 Spring 消息监听器容器类,只能创建与多个线程一起使用的消息监听器的单个无状态实例。
是否有将多个消息监听器实例添加到消息监听器容器的解决方案?
I am trying to receive JMS messages from a JMS queue. On receiving messages they are forwarded to different servers for processing.
I want to instantiate Message Listeners with information about server it is communicating with and process status.
Using available Spring Message Listener Container Classes only a single stateless instance of Message Listener can be created which is used with multiple threads.
Is there a solution for adding multiple instances of Message Listener to Message Listener Container?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Spring 的 MessageListenerContainers 被设计为仅保存一个 MessageListener 并通过它们运行多个线程,就像多个线程通过 servlet 实例运行一样。
您可以实现您所讨论的内容的一种方法是注册一个 MessageListener,并让它充当您实例化到其中的一组其他侦听器的外观,并使外观将请求转发给它们。
Spring's MessageListenerContainers are designed to only hold one MessageListener and run multiple threads through them, in the same way that multiple threads run through a servlet instance.
A way that you could implement what you are talking about is register the one MessageListener, and have it act as a facade to a set of other listeners that you instantiate into it, and have the facade forward requests to them.