spring-rabbitmq

How to use RMQ and spring cloud stream for creating partition based producer?

无人久伴 提交于 2020-01-15 04:55:15
问题 I am trying to find example of spring cloud stream where it creates parition based producer for RMQ. I want to see how it will create binding for those queues as RMQ not natively support paritions for topic but it will create number of queues equivalent to number of partitions (I read this,I may be wrong). First I want to understand how to create producer using spring cloud stream on RMQ for partition based producer. 回答1: @SpringBootApplication @EnableBinding(Source.class) public class

RabbitMQ listener stops listening messages when MessageListener throws exception

微笑、不失礼 提交于 2020-01-07 05:20:27
问题 I am using Spring AMQP for processing the messages in RabbitMQ. Below is the issue: 1. (say) there are 3 messages in ready state inside RabbitMQ 2. First one is picked up by MessageListener and starts processing. (say) It ends up throwing an exception 3. In this case, the container remains up but the remaining 2 messages are not processed until i restart the container. Also the first messages stays in unacknowledged state. Is it the expected behavior? If not, how to make sure that other 2

How to log Queue name in SimpleMessageListenerContainer.java

て烟熏妆下的殇ゞ 提交于 2020-01-06 04:17:04
问题 We're having issues with one of the consumers, and need to debug the code. SimpleRabbitListenerContainerFactory allows to set a ConsumerTagStrategy, which should add tags during logging. @Bean public SimpleRabbitListenerContainerFactory analyzeTransactionListenerContainerFactory(ConnectionFactory connectionFactory, AsyncTaskExecutor asyncTaskExecutor) { connectionFactory.getVirtualHost()); SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); factory

What is the ServletFilter equalent of a RabbitMq Listener?

♀尐吖头ヾ 提交于 2020-01-06 01:34:28
问题 I have a spring-boot web application for which I implemented an MDCFilter that adds a UUID to MDC logging context that i can find in the log file. The Filter class looks like this. public class MDCFilter implements Filter { @Override public void init(FilterConfig filterConfig) { } @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { String requestId = UUID.randomUUID().toString(); MDC.put(REQUEST_ID_KEY, requestId);

SpringBoot Disable rabbitTemplate retry policy for rabbit health check

你。 提交于 2020-01-01 19:37:33
问题 My SpringBoot configuration contains very strong retry policy for rabbitTemplate retries spring: rabbitmq: template: retry: enabled: true initial-interval: 500 max-attempts: 10 multiplier: 5 max-interval: 60000 The problem with this configuration is when health endpoint is called and rabbitMQ is down, the connections hangs for really long time. Adding properties like spring.rabbitmq.connection-timeout=500 or spring.rabbitmq.template.receive-timeout=500 or spring.rabbitmq.template.reply

Sending acknowledgment to rabbitmq server in depends on converter and listener

这一生的挚爱 提交于 2019-12-31 05:57:31
问题 First of all, I present context of my case: I am using spring-boot and spring-rabbitmq . It is working for me, you should know that I must have implemented custom converter for received messages. (1) From this converter can be thrown exception, for instance in case of inproper message and so on. (2) After successfull converting (no exception) listener is invoked. Then, in the listener it can also be thrown exception. Now, I would like to force two things: (1') Don't requeue message in case of

Context of class with listener - spring-rabbitmq, internals and injecting beans based on contain of message

依然范特西╮ 提交于 2019-12-25 09:47:40
问题 I am using spring-boot and spring-rabbitmq package. I have some config class and class representing client. This client class has one listener annotated with @RabbitListener . Everything is fine with my config and client - it does work. However, I need to know some details about internals of this client class. Is something special set in a context ? I would like to be able to inject one of three available datasources (three beans). I mean that I would like to be able based on the first symbol

Spring Dataflow Move messages from one Rabbit VHost to another

你。 提交于 2019-12-25 01:44:23
问题 TLDR: Can't seem to pass messages from one RabbitMQ VHost to another RabbitMQ VHost. I'm having an issue with Spring Cloud Dataflow where it appears that despite specifying different RabbitMQ VHosts for source and sink, they don't ever get to the destination Exchange. My dataflow stream looks like this: RabbitMQ Source | CustomProcessor | RabbitMQ Sink RabbitMQ Source reads from a queue on vHostA and RabbitMQ Sink should output to ExchangeBlah on vHostB. However, no messages end up on

rabbitmq-consistent-hash-exchange with java-client / spring-rabbit

試著忘記壹切 提交于 2019-12-24 13:27:40
问题 I would like to use the capabilities of rabbitmq-consistent-hash-exchange from java client or preferably by using the spring abstraction spring-amqp. Unfortunately I failed to found an example that explain the java usage and reference a jar dependency to include, please advice. 回答1: There is no specific tag for "x-" exchanges. Use CustomExchange for it: <bean id="requestHashExchangeTest" class="org.springframework.amqp.core.CustomExchange"> <constructor-arg name="name" value="test.hash

What's the difference between SimpleMessageListenerContainer and DirectMessageListenerContainer in Spring AMQP?

老子叫甜甜 提交于 2019-12-24 08:59:13
问题 What's the difference between SimpleMessageListenerContainer and DirectMessageListenerContainer in Spring AMQP? I checked both of their documentation pages, SimpleMessageListenerContainer has almost no explanation on inner workings, and DirectMessageListenerContainer has the following explanation: The SimpleMessageListenerContainer is not so simple. Recent changes to the rabbitmq java client has facilitated a much simpler listener container that invokes the listener directly on the rabbit