0

I am setting up a ServieMix instance using apache-camel as the routing engine, with my routes defined in a blueprint.xml. I am trying to configure ActiveMQ for my blueprint to be completely isolated from anything else (use its own, private, broker).

Here is my camel blueprint XML

<?xml version="1.0" encoding="UTF-8"?>
<blueprint 
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
>

    <bean id="record_ip" class="my.service.RecordIP"/>

    <bean id="jmsConnectionFactory" 
       class="org.apache.activemq.ActiveMQConnectionFactory">
       <property name="brokerURL" value="vm://myBroker?create=true&amp;waitForStart=10000" />
       <property name="userName" value="shadow"/>
       <property name="password" value="broker"/>
    </bean>

    <bean id="pooledConnectionFactory" 
       class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
       <property name="maxConnections" value="8" />
       <property name="connectionFactory" ref="jmsConnectionFactory" />
    </bean>

    <bean id="jmsConfig" 
       class="org.apache.camel.component.jms.JmsConfiguration">
       <property name="connectionFactory" ref="pooledConnectionFactory"/>
       <property name="concurrentConsumers" value="10"/>
    </bean>

    <bean id="activemq" 
        class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="configuration" ref="jmsConfig"/>
    </bean>

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">

      <route id="tracing_route">
        <from uri="jetty:http://localhost:9696/trace"/>
        <inOnly uri="activemq:queue:ip_capture"/>
      </route>

      <route id="ip_capture">
        <from uri="activemq:queue:ip_capture?concurrentConsumers=1&amp;maxConcurrentConsumers=64&amp;maxMessagesPerTask=100"/>
        <bean ref="record_ip"/>
        <log message="Finished!" loggingLevel="WARN" />
      </route>
    </camelContext>

</blueprint>

I don't think it's using the setup at all because I get the following error

Could not refresh JMS Connection for destination 'ip_capture' - retrying in 5000 ms. Cause: Error while attempting to add new Connection to the pool; nested exception is javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Broker named 'amq-broker' does not exist.

And amq-broker is the default broker.

I'm pouring through everything I can find but something important is missing

I am using

  • ServiceMix 7.0.0
  • apache-camel/camel-blueprint 2.16.4
  • activemq-client/camel/blueprint 5.14.3

So long story sort, How do I properly configure ActiveMQ for my blueprint to be completely isolated from anything else?

Tezra
  • 8,463
  • 3
  • 31
  • 68
  • 1
    You can install ActiveMQ as a service in the operating system and launch it using [Runtime.exec](https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec(java.lang.String)). This way it is completely indepenend from Karaf. You may also check how [JBoss Fuse](https://github.com/jboss-fuse/fuse/blob/e9964e38543fb301735fad48c6d477e30003e016/esb/fuse-karaf-framework/src/main/filtered-resources/features.xml) embeds it (`activemq-karaf` artifact seems a good starting point) – Alessandro Da Rugna Jun 20 '17 at 10:39
  • @AlessandroDaRugna I mean independent from any other pre-existing (default) broker, not independent from ServiceMix. – Tezra Jun 20 '17 at 12:11
  • As far as I can see your blueprint context sets up an AMQ client, but not the broker itself. Check out the [OSGi Integration](http://activemq.apache.org/osgi-integration.html) documentation on how to start the broker in Karaf (which is the OSGi container that ServiceMix uses). – Ralf Jul 17 '17 at 12:23

1 Answers1

0

I ended up not really needing to do this, because for all intents and purposes, the broker is independent, and setting up a new one doesn't change anything.

Tezra
  • 8,463
  • 3
  • 31
  • 68