You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Michael Dewitte <mi...@gmail.com> on 2011/03/15 16:17:59 UTC

JMS - ActiveMQ transport

Hi,

still trying to find my way in some aspects of ServiceMix...

ActiveMQ is installed when installing a ServiceMix instance. What do I have
to do if I want to have a JMS IN endPoint (I want to facade a service with
JMS) ?

Do I have to install another ActiveMQ instance or do I reuse the existing
one ? Do I have to use Camel ActiveMQ component or is it another possibility
(and what would be the prefered one in different cases ?)

I know there's also the JBI component, but since it's not developped
furthermore in favor of the Camel components, I assume it wouldn't be a very
good idea to start new developments based on it...





--
View this message in context: http://servicemix.396122.n5.nabble.com/JMS-ActiveMQ-transport-tp3706931p3706931.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: JMS - ActiveMQ transport

Posted by Johan Edstrom <jo...@acj-consulting.com>.
This method also btw integrates
nicely with Aries - TX and aries JNDI.

as such :

<?xml version="1.0" encoding="UTF-8"?>
<blueprint default-activation="lazy"
           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-bp="http://camel.apache.org/schema/blueprint"
           xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
           xsi:schemaLocation="
            http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
            http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint.xsd
            ">

  <cm:property-placeholder persistent-id="edu.ucar.ral.wcsri.pubsub.submgt" id="subManager">

    <cm:default-properties>

      <!-- Security -->
      <cm:property name="wcs.securityEnabled" value="false"/>
      <cm:property name="wcs.securityRealm" value="nnew"/>

      <!-- AMQ specific -->
      <cm:property name="amq.http.connector.url" value="tcp://localhost:61616"/>
      <cm:property name="submgt.abandoned.days" value="30"/>
      <cm:property name="submgt.deleted.hold.days" value="15"/>
      <cm:property name="submgt.transformer.list"
                   value="DESCRIPTION COVERAGE|jms:queue:pubsub.xformer.DescribeCoverage,GET COVERAGE|jms:queue:pubsub.xformer.GetCoverage"/>

    </cm:default-properties>

  </cm:property-placeholder>

  <camel-bp:camelContext xmlns="http://camel.apache.org/schema/blueprint" id="sub-management">
    <!-- Handles the ack messages -->
    <route>
      <from uri="jms:topic:ActiveMQ.Advisory.MessageConsumed.TempQueue.>"/>
      <to uri="ackProcessor"/>
    </route>
    <!-- Handles the queue access/disconnect messages -->
    <route>
      <from uri="jms:topic:ActiveMQ.Advisory.TempQueue"/>
      <to uri="connectionProcessor"/>
    </route>
    <!-- Handles the handshake -->
    <route>
      <from uri="jms:queue:pubsub.handshake"/>
      <to uri="handshakeProcessor"/>
    </route>
    <!-- Handles the cleanup of the subscription meta data -->
    <route>
      <!-- Fire quartz every 5 minutes -->
      <from uri="timer://foo?fixedRate=true&amp;period=600000"/>
      <!--
      <from uri="quartz://cleanup?cron=0+0/5+*+*+*+?"/>
      -->
      <to uri="cleanupProcessor"/>
    </route>
  </camel-bp:camelContext>

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

  <reference id="transactionManager" interface="org.springframework.transaction.PlatformTransactionManager"/>


  <reference id="jmsConnectionPool" interface="javax.jms.ConnectionFactory" />

</blueprint>


On Mar 15, 2011, at 10:18 AM, Gert Vanthienen wrote:

> L.S.,
> 
> If you just use the activemq:// url as in the quickstart guide, that
> will just setup a plain connection to the broker.  For using the
> connection pool provided, use the code samples that Johan sent a few
> minutes ago, leaving out the filter=(...) bit because if there's only
> one ConnectionFactory sitting in the OSGi service registry, there's no
> need for a filter and that filter won't match anything in a plain
> ServiceMix instance.
> 
> BTW, I added a quick note to
> https://issues.apache.org/jira/browse/SMX4-753 to make sure we
> implement the default behavior for {{activemq://}} to leverage that
> connection pool - we want to make it as simple as possible for people
> to use that.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> FuseSource
> Web: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> On Tue, Mar 15, 2011 at 4:43 PM, Michael Dewitte
> <mi...@gmail.com> wrote:
>> Thanks, but I was not able to find any pointer on how to use the connection
>> pool from camel... samples from Camel tell you how to setup the connection
>> to an ActiveMQ instance, but I haven't found how to use the pool available
>> from osgi to the local broker instance...
>> 
>> Can I directly use (as read in the new 4.3.0-snapshot documentation -
>> http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/quickstart/activemq.html)
>> the following in a camelContext, as a route definition :
>> 
>> *
>> 
>> <route>
>>        <from uri="activemq://events"/>
>>        <to uri="log:events"/>
>>      </route>
>> 
>> *
>> 
>> 
>> and that would make use of the connexion factory you mentioned to the local
>> broker instance ? Would you have any pointer to the config I can manage for
>> the pool ?
>> 
>> Sorry if the question can seem basic, but finding his way as a newbie is not
>> always easy...
>> 
>> Mike
>> 
>> 
>> 2011/3/15 Johan Edstrom <jo...@acj-consulting.com>
>> 
>>> You have a broker started by default, you also have a connection pool
>>> available
>>> as a default via the osgi registry.
>>> 
>>> To use camel, you can use the feature camel-jms / camel-activemq,
>>> and that'll give you all the workings necessary for working with JMS
>>> 
>>> Then just follow the examples in camel-jms.
>>> 
>>> /je
>>> 
>>> On Mar 15, 2011, at 9:17 AM, Michael Dewitte wrote:
>>> 
>>>> Hi,
>>>> 
>>>> still trying to find my way in some aspects of ServiceMix...
>>>> 
>>>> ActiveMQ is installed when installing a ServiceMix instance. What do I
>>> have
>>>> to do if I want to have a JMS IN endPoint (I want to facade a service
>>> with
>>>> JMS) ?
>>>> 
>>>> Do I have to install another ActiveMQ instance or do I reuse the existing
>>>> one ? Do I have to use Camel ActiveMQ component or is it another
>>> possibility
>>>> (and what would be the prefered one in different cases ?)
>>>> 
>>>> I know there's also the JBI component, but since it's not developped
>>>> furthermore in favor of the Camel components, I assume it wouldn't be a
>>> very
>>>> good idea to start new developments based on it...
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context:
>>> http://servicemix.396122.n5.nabble.com/JMS-ActiveMQ-transport-tp3706931p3706931.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>> 
>>> 
>> 


Re: JMS - ActiveMQ transport

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

If you just use the activemq:// url as in the quickstart guide, that
will just setup a plain connection to the broker.  For using the
connection pool provided, use the code samples that Johan sent a few
minutes ago, leaving out the filter=(...) bit because if there's only
one ConnectionFactory sitting in the OSGi service registry, there's no
need for a filter and that filter won't match anything in a plain
ServiceMix instance.

BTW, I added a quick note to
https://issues.apache.org/jira/browse/SMX4-753 to make sure we
implement the default behavior for {{activemq://}} to leverage that
connection pool - we want to make it as simple as possible for people
to use that.

Regards,

Gert Vanthienen
------------------------
FuseSource
Web: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



On Tue, Mar 15, 2011 at 4:43 PM, Michael Dewitte
<mi...@gmail.com> wrote:
> Thanks, but I was not able to find any pointer on how to use the connection
> pool from camel... samples from Camel tell you how to setup the connection
> to an ActiveMQ instance, but I haven't found how to use the pool available
> from osgi to the local broker instance...
>
> Can I directly use (as read in the new 4.3.0-snapshot documentation -
> http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/quickstart/activemq.html)
> the following in a camelContext, as a route definition :
>
> *
>
> <route>
>        <from uri="activemq://events"/>
>        <to uri="log:events"/>
>      </route>
>
> *
>
>
> and that would make use of the connexion factory you mentioned to the local
> broker instance ? Would you have any pointer to the config I can manage for
> the pool ?
>
> Sorry if the question can seem basic, but finding his way as a newbie is not
> always easy...
>
> Mike
>
>
> 2011/3/15 Johan Edstrom <jo...@acj-consulting.com>
>
>> You have a broker started by default, you also have a connection pool
>> available
>> as a default via the osgi registry.
>>
>> To use camel, you can use the feature camel-jms / camel-activemq,
>> and that'll give you all the workings necessary for working with JMS
>>
>> Then just follow the examples in camel-jms.
>>
>> /je
>>
>> On Mar 15, 2011, at 9:17 AM, Michael Dewitte wrote:
>>
>> > Hi,
>> >
>> > still trying to find my way in some aspects of ServiceMix...
>> >
>> > ActiveMQ is installed when installing a ServiceMix instance. What do I
>> have
>> > to do if I want to have a JMS IN endPoint (I want to facade a service
>> with
>> > JMS) ?
>> >
>> > Do I have to install another ActiveMQ instance or do I reuse the existing
>> > one ? Do I have to use Camel ActiveMQ component or is it another
>> possibility
>> > (and what would be the prefered one in different cases ?)
>> >
>> > I know there's also the JBI component, but since it's not developped
>> > furthermore in favor of the Camel components, I assume it wouldn't be a
>> very
>> > good idea to start new developments based on it...
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://servicemix.396122.n5.nabble.com/JMS-ActiveMQ-transport-tp3706931p3706931.html
>> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>

Re: JMS - ActiveMQ transport

Posted by Michael Dewitte <mi...@gmail.com>.
Great ! Thanks, I'll play with that tomorrow and see if I can do it !

Mike

2011/3/15 Johan Edstrom <jo...@acj-consulting.com>

> In spring :
>
>  <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
>    <property name="connectionFactory" ref="jmsConnectionPool"/>
>  </bean>
>
>  <camel-osgi:camelContext xmlns="http://camel.apache.org/schema/spring"
> id="asyncGDSPojo">
>    <endpoint id="gdsProcessorQueue"
> uri="jms:queue:${gds.processorQueue}?concurrentConsumers=${gds.numberConcurrentConsumers}"/>
>    <route>
>      <from ref="gdsProcessorQueue"/>
>      <to uri="gdsPojoWrapper"/>
>    </route>
>  </camel-osgi:camelContext>
>
> <osgi:reference id="jmsConnectionPool"
> interface="javax.jms.ConnectionFactory" filter="(wcsri.client=true)"/>
>
>
> In aries blueprint as of camel 2.6 (2.7 is slated for release)
>
> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
>    <property name="connectionFactory" ref="jmsConnectionPool"/>
>    <property name="concurrentConsumers"
> value="${gds.numberConcurrentConsumers}"/>
>
>  </bean>
>
>  <camelContext id="asyncGDSPojo" xmlns="
> http://camel.apache.org/schema/blueprint">
>    <!-- Need to fix the hardcoded value here  this is fixed/available in
> Camel 2.7 and onwards.-->
>    <endpoint id="gdsProcessorQueue" uri="jms:queue:gds.processor"/>
>    <route>
>      <from ref="gdsProcessorQueue"/>
>      <to uri="gdsPojoWrapper"/>
>    </route>
>  </camelContext>
>
> <reference id="jmsConnectionPool" interface="javax.jms.ConnectionFactory"
> filter="(wcsri.client=true)"/>
>
>
> On Mar 15, 2011, at 9:43 AM, Michael Dewitte wrote:
>
> > Thanks, but I was not able to find any pointer on how to use the
> connection
> > pool from camel... samples from Camel tell you how to setup the
> connection
> > to an ActiveMQ instance, but I haven't found how to use the pool
> available
> > from osgi to the local broker instance...
> >
> > Can I directly use (as read in the new 4.3.0-snapshot documentation -
> >
> http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/quickstart/activemq.html)
> > the following in a camelContext, as a route definition :
> >
> > *
> >
> > <route>
> >        <from uri="activemq://events"/>
> >        <to uri="log:events"/>
> >      </route>
> >
> > *
> >
> >
> > and that would make use of the connexion factory you mentioned to the
> local
> > broker instance ? Would you have any pointer to the config I can manage
> for
> > the pool ?
> >
> > Sorry if the question can seem basic, but finding his way as a newbie is
> not
> > always easy...
> >
> > Mike
> >
> >
> > 2011/3/15 Johan Edstrom <jo...@acj-consulting.com>
> >
> >> You have a broker started by default, you also have a connection pool
> >> available
> >> as a default via the osgi registry.
> >>
> >> To use camel, you can use the feature camel-jms / camel-activemq,
> >> and that'll give you all the workings necessary for working with JMS
> >>
> >> Then just follow the examples in camel-jms.
> >>
> >> /je
> >>
> >> On Mar 15, 2011, at 9:17 AM, Michael Dewitte wrote:
> >>
> >>> Hi,
> >>>
> >>> still trying to find my way in some aspects of ServiceMix...
> >>>
> >>> ActiveMQ is installed when installing a ServiceMix instance. What do I
> >> have
> >>> to do if I want to have a JMS IN endPoint (I want to facade a service
> >> with
> >>> JMS) ?
> >>>
> >>> Do I have to install another ActiveMQ instance or do I reuse the
> existing
> >>> one ? Do I have to use Camel ActiveMQ component or is it another
> >> possibility
> >>> (and what would be the prefered one in different cases ?)
> >>>
> >>> I know there's also the JBI component, but since it's not developped
> >>> furthermore in favor of the Camel components, I assume it wouldn't be a
> >> very
> >>> good idea to start new developments based on it...
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>
> http://servicemix.396122.n5.nabble.com/JMS-ActiveMQ-transport-tp3706931p3706931.html
> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
>
>

Re: JMS - ActiveMQ transport

Posted by Johan Edstrom <jo...@acj-consulting.com>.
In spring :

 <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="jmsConnectionPool"/>
  </bean>

  <camel-osgi:camelContext xmlns="http://camel.apache.org/schema/spring" id="asyncGDSPojo">
    <endpoint id="gdsProcessorQueue" uri="jms:queue:${gds.processorQueue}?concurrentConsumers=${gds.numberConcurrentConsumers}"/>
    <route>
      <from ref="gdsProcessorQueue"/>
      <to uri="gdsPojoWrapper"/>
    </route>
  </camel-osgi:camelContext>

<osgi:reference id="jmsConnectionPool" interface="javax.jms.ConnectionFactory" filter="(wcsri.client=true)"/>


In aries blueprint as of camel 2.6 (2.7 is slated for release)

<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="jmsConnectionPool"/>
    <property name="concurrentConsumers" value="${gds.numberConcurrentConsumers}"/>
   
  </bean>

  <camelContext id="asyncGDSPojo" xmlns="http://camel.apache.org/schema/blueprint">
    <!-- Need to fix the hardcoded value here  this is fixed/available in Camel 2.7 and onwards.-->
    <endpoint id="gdsProcessorQueue" uri="jms:queue:gds.processor"/>
    <route>
      <from ref="gdsProcessorQueue"/>
      <to uri="gdsPojoWrapper"/>
    </route>
  </camelContext>

<reference id="jmsConnectionPool" interface="javax.jms.ConnectionFactory" filter="(wcsri.client=true)"/>


On Mar 15, 2011, at 9:43 AM, Michael Dewitte wrote:

> Thanks, but I was not able to find any pointer on how to use the connection
> pool from camel... samples from Camel tell you how to setup the connection
> to an ActiveMQ instance, but I haven't found how to use the pool available
> from osgi to the local broker instance...
> 
> Can I directly use (as read in the new 4.3.0-snapshot documentation -
> http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/quickstart/activemq.html)
> the following in a camelContext, as a route definition :
> 
> *
> 
> <route>
>        <from uri="activemq://events"/>
>        <to uri="log:events"/>
>      </route>
> 
> *
> 
> 
> and that would make use of the connexion factory you mentioned to the local
> broker instance ? Would you have any pointer to the config I can manage for
> the pool ?
> 
> Sorry if the question can seem basic, but finding his way as a newbie is not
> always easy...
> 
> Mike
> 
> 
> 2011/3/15 Johan Edstrom <jo...@acj-consulting.com>
> 
>> You have a broker started by default, you also have a connection pool
>> available
>> as a default via the osgi registry.
>> 
>> To use camel, you can use the feature camel-jms / camel-activemq,
>> and that'll give you all the workings necessary for working with JMS
>> 
>> Then just follow the examples in camel-jms.
>> 
>> /je
>> 
>> On Mar 15, 2011, at 9:17 AM, Michael Dewitte wrote:
>> 
>>> Hi,
>>> 
>>> still trying to find my way in some aspects of ServiceMix...
>>> 
>>> ActiveMQ is installed when installing a ServiceMix instance. What do I
>> have
>>> to do if I want to have a JMS IN endPoint (I want to facade a service
>> with
>>> JMS) ?
>>> 
>>> Do I have to install another ActiveMQ instance or do I reuse the existing
>>> one ? Do I have to use Camel ActiveMQ component or is it another
>> possibility
>>> (and what would be the prefered one in different cases ?)
>>> 
>>> I know there's also the JBI component, but since it's not developped
>>> furthermore in favor of the Camel components, I assume it wouldn't be a
>> very
>>> good idea to start new developments based on it...
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> View this message in context:
>> http://servicemix.396122.n5.nabble.com/JMS-ActiveMQ-transport-tp3706931p3706931.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
>> 


Re: JMS - ActiveMQ transport

Posted by Michael Dewitte <mi...@gmail.com>.
Thanks, but I was not able to find any pointer on how to use the connection
pool from camel... samples from Camel tell you how to setup the connection
to an ActiveMQ instance, but I haven't found how to use the pool available
from osgi to the local broker instance...

Can I directly use (as read in the new 4.3.0-snapshot documentation -
http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/quickstart/activemq.html)
the following in a camelContext, as a route definition :

*

<route>
        <from uri="activemq://events"/>
        <to uri="log:events"/>
      </route>

*


and that would make use of the connexion factory you mentioned to the local
broker instance ? Would you have any pointer to the config I can manage for
the pool ?

Sorry if the question can seem basic, but finding his way as a newbie is not
always easy...

Mike


2011/3/15 Johan Edstrom <jo...@acj-consulting.com>

> You have a broker started by default, you also have a connection pool
> available
> as a default via the osgi registry.
>
> To use camel, you can use the feature camel-jms / camel-activemq,
> and that'll give you all the workings necessary for working with JMS
>
> Then just follow the examples in camel-jms.
>
> /je
>
> On Mar 15, 2011, at 9:17 AM, Michael Dewitte wrote:
>
> > Hi,
> >
> > still trying to find my way in some aspects of ServiceMix...
> >
> > ActiveMQ is installed when installing a ServiceMix instance. What do I
> have
> > to do if I want to have a JMS IN endPoint (I want to facade a service
> with
> > JMS) ?
> >
> > Do I have to install another ActiveMQ instance or do I reuse the existing
> > one ? Do I have to use Camel ActiveMQ component or is it another
> possibility
> > (and what would be the prefered one in different cases ?)
> >
> > I know there's also the JBI component, but since it's not developped
> > furthermore in favor of the Camel components, I assume it wouldn't be a
> very
> > good idea to start new developments based on it...
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://servicemix.396122.n5.nabble.com/JMS-ActiveMQ-transport-tp3706931p3706931.html
> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: JMS - ActiveMQ transport

Posted by Johan Edstrom <jo...@acj-consulting.com>.
You have a broker started by default, you also have a connection pool available
as a default via the osgi registry.

To use camel, you can use the feature camel-jms / camel-activemq, 
and that'll give you all the workings necessary for working with JMS

Then just follow the examples in camel-jms.

/je

On Mar 15, 2011, at 9:17 AM, Michael Dewitte wrote:

> Hi,
> 
> still trying to find my way in some aspects of ServiceMix...
> 
> ActiveMQ is installed when installing a ServiceMix instance. What do I have
> to do if I want to have a JMS IN endPoint (I want to facade a service with
> JMS) ?
> 
> Do I have to install another ActiveMQ instance or do I reuse the existing
> one ? Do I have to use Camel ActiveMQ component or is it another possibility
> (and what would be the prefered one in different cases ?)
> 
> I know there's also the JBI component, but since it's not developped
> furthermore in favor of the Camel components, I assume it wouldn't be a very
> good idea to start new developments based on it...
> 
> 
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/JMS-ActiveMQ-transport-tp3706931p3706931.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.