You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Matthieu Vincent <mv...@gmail.com> on 2012/12/18 18:04:02 UTC

[Camel] Send messages to external activemq queue from servicemix

Hi,

I'd like to send JMS message from my servicemix platform through an
external (standalone) activemq broker. I've tried many configuration but
each time I deploy my bundle, it starts an internal broker in servicemix.

Does anyone already succeeded to configure such process ?

Here is my latest configuration :

<?xml version="1.0" encoding="UTF-8"?><blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
       xmlns:camel="http://camel.apache.org/schema/blueprint"
       xmlns:activemq="http://activemq.apache.org/schema/core"
       xsi:schemaLocation="
   http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
   http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
   http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
   http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd
   ">

  <!-- Camel context where routes are defined programmatically in
classes in defined package -->
  <camelContext trace="true" id="blueprintContext"
xmlns="http://camel.apache.org/schema/blueprint">
    <camel:route>
      <camel:from uri="file://inbox?delete=true" />
      <camel:to uri="activemq:queue:esb-to-ext">
    </camel:route>
  </camelContext>

  <activemq:broker>
    <activemq:managementContext>
      <activemq:managementContext createConnector="false" />
    </activemq:managementContext>
    <activemq:transportConnectors>
       <activemq:transportConnector uri="tcp://0.0.0.0:16161"  />
    </activemq:transportConnectors> -->
  </activemq:broker>

  <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp://0.0.0.0:16161" />
  </bean></blueprint>

Re: [Camel] Send messages to external activemq queue from servicemix

Posted by Rich Newcomb <ri...@gmail.com>.
Hi Matthieu,

A new broker is being created because you have an <activemq:broker> defined
in your blueprint context.
You should remove this element if you do not want a new broker to be
created by the blueprint container.

Next,  you will ned to include a jmsConnectionFactory in the activemq bean,
which indicates the specific connection factory you are using.

Here is an example that I created recently, which also happend to use a
transaction manager ::

...

    <bean id="transactionManager"
             class=
"org.springframework.jms.connection.JmsTransactionManager">
            <property name="connectionFactory" ref="jmsConnectionFactory"/>
    </bean>

    <bean id="jmsConnectionFactory" class=
"org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL"  value=
"tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=3&amp;jms.redeliveryPolicy.initialRedeliveryDelay=500)"
/>
    </bean>

    <bean name="activemq" class=
"org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="jmsConnectionFactory"/>
        <property name="transactionManager" ref="transactionManager"/>
        <property name="transacted" value="true"/>
    </bean>


On Tue, Dec 18, 2012 at 9:04 AM, Matthieu Vincent <mv...@gmail.com>wrote:

> Hi,
>
> I'd like to send JMS message from my servicemix platform through an
> external (standalone) activemq broker. I've tried many configuration but
> each time I deploy my bundle, it starts an internal broker in servicemix.
>
> Does anyone already succeeded to configure such process ?
>
> Here is my latest configuration :
>
> <?xml version="1.0" encoding="UTF-8"?><blueprint
> xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:cm="
> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
>        xmlns:camel="http://camel.apache.org/schema/blueprint"
>        xmlns:activemq="http://activemq.apache.org/schema/core"
>        xsi:schemaLocation="
>    http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>    http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0
> http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
>    http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>    http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd
>    ">
>
>   <!-- Camel context where routes are defined programmatically in
> classes in defined package -->
>   <camelContext trace="true" id="blueprintContext"
> xmlns="http://camel.apache.org/schema/blueprint">
>     <camel:route>
>       <camel:from uri="file://inbox?delete=true" />
>       <camel:to uri="activemq:queue:esb-to-ext">
>     </camel:route>
>   </camelContext>
>
>   <activemq:broker>
>     <activemq:managementContext>
>       <activemq:managementContext createConnector="false" />
>     </activemq:managementContext>
>     <activemq:transportConnectors>
>        <activemq:transportConnector uri="tcp://0.0.0.0:16161"  />
>     </activemq:transportConnectors> -->
>   </activemq:broker>
>
>   <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>     <property name="brokerURL" value="tcp://0.0.0.0:16161" />
>   </bean></blueprint>
>

Re: [Camel] Send messages to external activemq queue from servicemix

Posted by Matthieu Vincent <mv...@gmail.com>.
Hi,

 i did make it work without the broker part :)

For configuration, it works just with :

<bean id="siti.activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp://0.0.0.0:16161"/>
</bean>


The weird part, is that servicemix succeed to launch a broker even if it is
configured on the same host and port than my standalone activemq broker.

Mat


2012/12/19 Claus Ibsen <cl...@gmail.com>

> Hi
>
> As Rich said you should remove the <broker>.
>
> Instead add the activemq Camel component as shown here
> http://camel.apache.org/activemq
>
> And also consider using connection pooling to make it more efficient.
>
> On Tue, Dec 18, 2012 at 6:04 PM, Matthieu Vincent <mv...@gmail.com>
> wrote:
> > Hi,
> >
> > I'd like to send JMS message from my servicemix platform through an
> > external (standalone) activemq broker. I've tried many configuration but
> > each time I deploy my bundle, it starts an internal broker in servicemix.
> >
> > Does anyone already succeeded to configure such process ?
> >
> > Here is my latest configuration :
> >
> > <?xml version="1.0" encoding="UTF-8"?><blueprint
> > xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> >        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >        xmlns:cm="
> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> >        xmlns:camel="http://camel.apache.org/schema/blueprint"
> >        xmlns:activemq="http://activemq.apache.org/schema/core"
> >        xsi:schemaLocation="
> >    http://www.osgi.org/xmlns/blueprint/v1.0.0
> > http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> >    http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0
> > http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
> >    http://camel.apache.org/schema/blueprint
> > http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
> >    http://activemq.apache.org/schema/core
> > http://activemq.apache.org/schema/core/activemq-core.xsd
> >    ">
> >
> >   <!-- Camel context where routes are defined programmatically in
> > classes in defined package -->
> >   <camelContext trace="true" id="blueprintContext"
> > xmlns="http://camel.apache.org/schema/blueprint">
> >     <camel:route>
> >       <camel:from uri="file://inbox?delete=true" />
> >       <camel:to uri="activemq:queue:esb-to-ext">
> >     </camel:route>
> >   </camelContext>
> >
> >   <activemq:broker>
> >     <activemq:managementContext>
> >       <activemq:managementContext createConnector="false" />
> >     </activemq:managementContext>
> >     <activemq:transportConnectors>
> >        <activemq:transportConnector uri="tcp://0.0.0.0:16161"  />
> >     </activemq:transportConnectors> -->
> >   </activemq:broker>
> >
> >   <bean id="activemq"
> > class="org.apache.activemq.camel.component.ActiveMQComponent">
> >     <property name="brokerURL" value="tcp://0.0.0.0:16161" />
> >   </bean></blueprint>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Re: [Camel] Send messages to external activemq queue from servicemix

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

As Rich said you should remove the <broker>.

Instead add the activemq Camel component as shown here
http://camel.apache.org/activemq

And also consider using connection pooling to make it more efficient.

On Tue, Dec 18, 2012 at 6:04 PM, Matthieu Vincent <mv...@gmail.com> wrote:
> Hi,
>
> I'd like to send JMS message from my servicemix platform through an
> external (standalone) activemq broker. I've tried many configuration but
> each time I deploy my bundle, it starts an internal broker in servicemix.
>
> Does anyone already succeeded to configure such process ?
>
> Here is my latest configuration :
>
> <?xml version="1.0" encoding="UTF-8"?><blueprint
> xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
>        xmlns:camel="http://camel.apache.org/schema/blueprint"
>        xmlns:activemq="http://activemq.apache.org/schema/core"
>        xsi:schemaLocation="
>    http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>    http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0
> http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
>    http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>    http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd
>    ">
>
>   <!-- Camel context where routes are defined programmatically in
> classes in defined package -->
>   <camelContext trace="true" id="blueprintContext"
> xmlns="http://camel.apache.org/schema/blueprint">
>     <camel:route>
>       <camel:from uri="file://inbox?delete=true" />
>       <camel:to uri="activemq:queue:esb-to-ext">
>     </camel:route>
>   </camelContext>
>
>   <activemq:broker>
>     <activemq:managementContext>
>       <activemq:managementContext createConnector="false" />
>     </activemq:managementContext>
>     <activemq:transportConnectors>
>        <activemq:transportConnector uri="tcp://0.0.0.0:16161"  />
>     </activemq:transportConnectors> -->
>   </activemq:broker>
>
>   <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>     <property name="brokerURL" value="tcp://0.0.0.0:16161" />
>   </bean></blueprint>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen