Hello,
Using Camel 3.18.0 with Spring-boot 2.6.2 and consuming messages in a route 
from an Oracle Advanced queue.

Doing some performance testing consuming JMS messages that showed using a 
@JmsListener annotated receiver class and the Camel producer template was 
significantly faster than using a "regular" JMS component consumer route. (See 
some code snippets below for both cases).
The JMS Component was configured to use a caching connection factory with 10 
cached sessions and max 20 concurrent consumers.
But the speed difference was like 2x slower when compared to the straight up 
Spring @JmsListener annotated class.

Any thoughts?

Is it possible to configure the Camel JMS component to use the Spring annotated 
@JmsListener message receiver class directly?    (I mean with out using the 
producer template and a direct route component ?)
I'm trying to figure out how to configure this, but not finding anything.

Appreciate any help with this.
Thanks,
jvh


--------------------------------------------------------------------------------------
 
/*** slower JMS Camel consumer route ***/
      from("oracleaq:queue:myOracleAQ"
            + "?transacted=true"
            + "&lazyCreateTransactionManager=false"
            + "&jmsMessageType=Text"
            + "&exceptionListener=#aqInboundExceptionListener")

--------------------------------------------------------------------------------------
 
/***  faster JMS Listener class ****/
@Component
public class JmsOracleAqConsumer {

   @Autowired
   private ProducerTemplate producerTemplate;

   @JmsListener(destination = "myOracleAQ", containerFactory = 
"jmsListenerContainerFactory")
   public void receiveMessage(final TextMessage textMessage) throws 
JMSException {
      producerTemplate.sendBody("direct:fromOracleAq", textMessage.getText());  
        // but uses the producer template to send to a direct component
   }
 }

/**** JMS Listener Container Factory Bean with 20 threads ****/
    @Bean
    public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(final 
DataSource dataSource) throws JMSException {
        final DefaultJmsListenerContainerFactory factory = new 
DefaultJmsListenerContainerFactory();
        factory.setConnectionFactory(connectionFactory(dataSource));
        factory.setConcurrency("20");
        factory.setSessionTransacted(true);
        factory.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
        factory.setExceptionListener(aqInboundExceptionListener());
        return factory;
    }

/****  Connection factory bean  ****/
    @Bean
    public QueueConnectionFactory connectionFactory(final DataSource 
dataSource) throws JMSException {
       return AQjmsFactory.getQueueConnectionFactory(dataSource);
    }
--------------------------------------------------------------------------------------
 

Reply via email to