0

In order to perform parallel processing of jms messages, I have configured the JmsComponent and connectionFactory as below.

After reading some posts and the official tutorial, seems that the below configuration should work for ActiveMQ. However, my testing shows that it doesn't work on Solace. Can someone give me a hint on this? Thanks.

// Route Definition - Camel Java DSL from(INBOUND_ENDPOINT).setExchangePattern(ExchangePattern.InOnly).threads(5).bean(ThroughputMeasurer.class);

<!-- JMS Config -->
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="cachedConnectionFactory" />
    <property name="acknowledgementModeName" value="AUTO_ACKNOWLEDGE" />
    <property name="deliveryPersistent" value="false" />
    <property name="asyncConsumer" value="true" />
    <property name="concurrentConsumers" value="5" />
</bean>

<!-- jndiTemplate is omitted here -->

<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="ceConnectionFactory" />
</bean>

<bean id="cachedConnectionFactory"
    class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory" ref="connectionFactory" />
    <property name="sessionCacheSize" value="30" />
</bean>
JNYRanger
  • 6,829
  • 12
  • 53
  • 81
Lewis Wong
  • 269
  • 1
  • 3
  • 17

2 Answers2

1

I believe the problem here is that your consumer is bound to an exclusive queue, and only 1 consumer is allowed to process message. Binding to an non-exclusive queue should solve the problem.

Exclusive queues only allow the first consumer to consume from the queue. All other consumers that are bound to the queue will not receive data. In the event that the first consumer disconnects, the next oldest consumer will begin receiving data. The other consumers can be thought of as being "standby" consumers that will take over the moment the first consumer disconnects.

Non-exclusive queues are used for load balancing. Messages that are spooled to the queue will be distributed to all consumers in a round-robin manner.

Russell Sim
  • 1,693
  • 2
  • 14
  • 22
0

Check:

  • Are there any exception messages in the log?
  • Is the jndiName correct? Perhaps it should be jms/ceConnectionFactory?
  • Is the URI INBOUND_ENDPOINT correct?
  • ...

Try to setup ActiveMQ first, and migrate the configuration to Solace.

Peter Keller
  • 7,526
  • 2
  • 26
  • 29
  • 1
    I happened to found that that isn't camel problems. The root cause is Solace JMS API is much much slower than its native counterpart, which keeps the threads idle. To verify that I have tried to put a sleep and log some message ThroughputMeasurer.class, the result shows that all the logs are printed below a sleep. – Lewis Wong Oct 31 '14 at 16:00