0

So I'm trying to use apache servicemix/camel to aggregate some messages coming through a JMS queue. The logic I have is dead-simple I just want it to use the last message received and only send it through 3 seconds after the last one.

I have servicemix setup as a message broker and I'm able to use it in such a capacity however it doesn't seem to trigger the route. I've never done this before so odds are I'm horribly off-base but here is what I have so far (put this in deploy/fedora-messaging/camel-context.xml)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd">

    <camelContext xmlns="http://camel.apache.org/schema/spring">
       <route>
        <from uri="activemq:topic:fedora.apim.update.merge"/>

        <aggregate completionTimeout="3000">
            <correlationExpression>
                <simple>header.pid</simple>
            </correlationExpression>
          <to uri="log:events"/>
           <to uri="activemq:topic:fedora.apim.update"/>
        </aggregate>
    </route>
   </camelContext>

 <bean id="activemq"
      class="org.apache.activemq.camel.component.ActiveMQComponent">
      <property name="brokerURL" value="tcp://localhost:61616"/>
   </bean>
</beans>

The osgi application appears to start and run without error, and messages are received and queued in the topic:fedora.apim.update.merge however they just sit in the queue and never get consumed or pushed out to the destination queue.

рüффп
  • 5,172
  • 34
  • 67
  • 113
jbayer
  • 16

1 Answers1

0

I tested your route as a standalone application (outside of a ServiceMix container) with following broker configuration and everything worked as expected:

<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
    persistent="false">
    <transportConnectors>
        <transportConnector uri="tcp://localhost:61616" />
    </transportConnectors>
</broker>

So, I guess, we can assume that your Camel route definition is not the problem but the ActiveMQ configuration and/or ServiceMix set-up.

EDIT:

Note, that messages to JMS topic destinations are lost if no active subscriber is connected to the destination. If you need some kind of persistence use durable subscribers or JMS queue destinations.

Peter Keller
  • 7,526
  • 2
  • 26
  • 29