nagendra
nagendra

Reputation: 593

Spring integration Jms.inboundGateway is very slow compared to JmsListener

I am seeing a performance degradation when using spring integration

IntegrationFlows.from(Jms.inboundGateway(connectionFactory)
                        .destination("orderQueue")
                        .jmsMessageConverter(new MarshallingMessageConverter(jaxbMarshaller()))
                       .transform(orderTransformer)
                       .handle(orderService, "saveOrder")
                       .get();

same code using JmsListener performs better

 @JmsListener(destination = "orderQueue")
 public void receiveMessage(Message message) throws IOException {
    Order order = (Order)jaxb2Marshaller.unmarshal(new StringSource(((TextMessage) message).getText()));
        OrderDetails orderDetails = orderTransformer.transform(order);
        orderService.saveOrder(orderDetails);
 }

can some one help what needs to be configured in spring integration to perform it well.

Upvotes: 0

Views: 178

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121560

You don’t compare apples with apples. You @JmsListener is one-way handler, according to the void return type. The Inbound Gateway is fo request-reply scenarios

From there I assume that you really don’t return anything from your latest handler. There a JMS thread is blocked for nothing.

Upvotes: 1

Related Questions