Unable to get message in priority sequence Spring camel rabbitmq

落花浮王杯 提交于 2019-12-12 03:54:02

问题


I am a beginner in using spring camel rabbitmq.

I am able to set message priority in message header by setting it in exchange out headers on the producer side, like this :

exchange.getOut().setHeader("rabbitmq.PRIORITY", 1);

BUT while consuming the messages they dont come in there order of priority. HELP !!

I can see in web interface of rabbitmq that priority header in appropriately set


回答1:


Please carefully read the "Interaction with consumers" section of this document. You should also search for an answer on the RabbitMQ Users List or post your question there if it has not been asked.




回答2:


got the issue. problem was that I was not able to set x-max-priority using camel endpoints. Need to add it in queueArgsConfigurer option in queue. To do this we need to implement ArgsConfigurer interface like this :

@Component(value="QueueArgsConfigurer")
public class QueueArgsConfigurer implements ArgsConfigurer {
@Override
public void configurArgs(Map<String, Object> map) {
    map.put("x-max-priority", 3);
}

}

And add to queue endpoint queueArgsConfigurer option like this: queueArgsConfigurer=#QueueArgsConfigurer Since I am using spring I get the QueueArgsConfigurer by its bean name.



来源:https://stackoverflow.com/questions/44582445/unable-to-get-message-in-priority-sequence-spring-camel-rabbitmq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!