英文:
Configure @JmsListener to limit rate of messages
问题
我已经实现了@JmsListener
来监听来自生产者的消息。
应用程序 <- 消费者 <- 生产者
因此,如上所示,消费者
正在从生产者那里消费消息,并调用应用程序(APP)来处理这些消息,在这种情况下,应用程序运行缓慢,我们希望限制我们从队列中消费消息的速率 (消费者 <- 生产者)
@JmsListener(
containerFactory = XXX destination = XXX) public void receive(Message message) throws JMSException {
}
寻找限制生产者消息速率的方法,可以通过限制订阅或者与并发有关的方式来实现,但是在@JmsListener
注解中并没有找到相关支持。
英文:
I have implemented @JmsListener
to listen the messages from Producer.
APP <- Consumer <- Producer
So, as shown above Consumer
is consuming messages from producer and calling application(APP) to process those messages, in this case application is slow and we wanted to limit the rate of messages we are consuming from queue (Consumer <- Producer)
@JmsListener(
containerFactory = XXX destination = XXX) public void receive(Message message) throws JMSException {
}
Finding the way to limit the rate of messages from Producer, It can be done by limiting subscription or something with concurrency but not find any support @JmsListener
annotation
答案1
得分: 1
有一个@JmsListener并发选项:
> 监听器的并发限制,如果有的话。会覆盖用于创建监听器容器的容器工厂定义的值。
>
> 并发限制可以是一个“较低-较高”的字符串 — 例如,“5-10” — 或者是一个简单的上限字符串 — 例如,“10”,在这种情况下,下限将为1。
>
> 请注意,底层容器可能支持或不支持所有功能。例如,它可能无法进行扩展,这种情况下只使用上限。
英文:
There is a @JmsListener concurrency option:
> The concurrency limits for the listener, if any. Overrides the value
> defined by the container factory used to create the listener
> container.
>
> The concurrency limits can be a "lower-upper" String — for example,
> "5-10" — or a simple upper limit String — for example, "10", in which
> case the lower limit will be 1.
>
> Note that the underlying container may or may not support all
> features. For instance, it may not be able to scale, in which case
> only the upper limit is used.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论