FAQ Database Discussion Community


RabbitMQ channel best practice

java,tomcat,rabbitmq,channel,spring-rabbit
I am creating a REST api to send message to RabbitMQ and was trying to understand what are the best practice for creating/closing channels. I am using RabbitMQ Java client api. Currently I have a class RabbitMQPublisherConnection where I spring inject RabbitMQ connection. This class is then spring injected to...

Extract headers from message using spring-rabbit without declaring queues in annotation

java,rabbitmq,messaging,spring-rabbit,spring-rabbitmq
Now I can do like this: @RabbitListener(queues = {ENTITY_KEY + "-snapshots", ENTITY_KEY + "-updates"}) public void handleMessage(ProviderOddsOffer offer, @Header("update_type") Long updateType) { ... } Can I do it without declaring queues in annotation itself?...

spring-rabbit client using lots of cpu

java,rabbitmq,spring-amqp,spring-rabbit
I am running a spring-boot application in ec2 on a c3.large machine. It initializes a spring-rabbit client, which starts up its own thread. After profiling my application using YourKit, I see that a lot of time is spent inside the rabbit client thread, inside: com.rabbitmq.client.impl.AMQConnection$MainLoop.run() specifically down in java.io.DataStream.readUnsignedByte() To...

RabbitMQ: server side Calculation for every received Message

rabbitmq,message-queue,spring-amqp,spring-rabbit
I'm working with RabbitMQ and I want on the server side to conduct a calculation each time an Exchange receives a message. I have a queue for ratings and when too many bad reviews (let's say more than ten) received, then a consumer should be notified. What options are there...

Spring-AMQP Transactionnal publish without Exception

java,spring,rabbitmq,spring-amqp,spring-rabbit
I am trying to use a Transactionnal RabbitMQ channel with Spring-AMQP but I want to actually swallow Exceptions to log them and being able to recover them. Using channelTransacted=true forces the Channel to also join the current transactionManager (Hibernate in my case) and that results in the commit Exception being...

Spring amqp not publishing message to the queue but to Exchange

spring,rabbitmq,spring-boot,spring-amqp,spring-rabbit
I am trying to test & benchmark spring-amqp for RabbitMQ with multiple queues so I was creating rabbit template for each queue and using it to send message. The message sent is successful and I can see a message published in the exchange but I don't see anything in the...

Several beans implementating the same interface

spring,spring-el,spring-rabbit
The exact usage is like this: @Slf4j public class Client<E, Key> { @Getter @NonNull private final UpdateListener<E, Key> updateListener; @NonNull private final SubscriptionFactory subscriptionFactory; @NonNull private final Map<Key, Instant> updatedRegistry = new ConcurrentHashMap<>(); public Client(UpdateListener<E, Key> updateListener, SubscriptionFactory subscriptionFactory) { this.updateListener = updateListener; this.subscriptionFactory = subscriptionFactory;...

spring REST message bus communication

spring-mvc,amqp,spring-amqp,spring-rabbit
I am looking for spring module that can help me to integrate spring REST web services with message bus(RabbitMQ). REST web service are acting as a consumer of AMQP messages from the client. Whenever messages are sent over the bus it is an AMQP message and to make it work...

Trying to migrate over from xml name space config to a java @Configurable cannot replicate

spring-amqp,spring-rabbit,spring-rabbitmq
I am trying to migrate from XML Spring amqp config to a java annotation based one because it is "simpler". Not sure what I am doing wrong the XML config works fine but the java @Configurable throws a "Caused by: java.net.SocketException: Connection reset" exception. XML config (works perfectly): <?xml version="1.0"...

Spring AMQP - how to set arguments on a Queue?

spring,rabbitmq,amqp,spring-amqp,spring-rabbit
I'm try to set arguments on a queue, however Spring's Queue class doesn't have a setter method for arguments. http://docs.spring.io/spring-amqp/api/org/springframework/amqp/core/Queue.html Any ideas? Thanks....