0

Am trying to read from RabbitMQ queue using Amqp.InboundAdapter, process it & then push it onto another queue.

So the flow looks like this:

Amqp.InboundAdapter --> service activator --> Amqp.outboundAdapter

But the problem is the processing speed are very very slow. The delivery rate at the rabbitmq console is 0.2/sec or 1sec which is very slow.

What could be causing this slowness?

IntegrationFlows.from(
            Amqp.inboundAdapter(connectionFactory, IncomingQueue)
                    .configureContainer(c -> {
                        c.concurrentConsumers(classicFlatFileConcurrentConsumers);
                        c.prefetchCount(incomingPrefetchCount);
                        c.adviceChain(new Advice[]{retryOperationsInterceptor});
                        c.channelTransacted(false);
                    })
            )
            .handle(myTransformer)
            .split()
            .filter(ResultDTO.class, dto -> dto.getID() != null)
            .handle(Amqp.outboundAdapter(rabbitTemplate).routingKey(OutputQueueName))
            .get();

Note that am using rabbitTemplate in Amqp.OutboundAdapter, which has usePublisherConnection set to True.

When I don't use spring integration, then the message rates are high around 1000 msg/sec in the rabbitmq console.

  • May we have some simple project from you to play with? With both Spring Integration and not implementations for comparison. Thanks – Artem Bilan Feb 22 '19 at 16:01
  • Someone recently experienced this because (s)he mistakenly used an outbound gateway instead of an adapter and the gateway blocks waiting for a reply that never came (for 1 second by default). Changing it to an adapter solved the problem. Your code shows an adapter but I thought I would mention it since the experience was almost identical. – Gary Russell Feb 22 '19 at 16:59
  • @GaryRussell Am using Adapter only. Still the slowness. Am using usePublisherConnection = True. – user3561281 Feb 22 '19 at 17:14
  • As Artem said - you need to provide the code for all your components - transformer/filter etc. Otherwise we can't help. – Gary Russell Feb 22 '19 at 17:16
  • I just copied your code into an app (minus the filter and transformer) and had no performance problems. I split 10k messages into 100k and saw incoming rates on the outbound queue over 9,000/s. – Gary Russell Feb 22 '19 at 17:33
  • @user3561281, is your problem solved? If so, could you please suggest a solution here. thanks – Amit Sadafule Mar 22 '19 at 08:11

0 Answers0