activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: [camel] Spring and Custom Components
Date Sat, 12 May 2007 15:13:08 GMT
On 5/11/07, Jeff Gunther <jeff.gunther@intalgent.com> wrote:
> On May 11, 2007, at 11:16 PM, James Strachan wrote:
>
> > On 5/10/07, Jeff Gunther <jeff.gunther@intalgent.com> wrote:
> >> Hi James,
> >>
> >> Thank you for the very detailed follow up! That worked wonderfully.
> >
> > Great! Just out of interest, do you fancy contributing your
> > component :)
>
> Sure. What's the best method to send you the component?

Great! :)

There's a general document on contributing here...
http://activemq.apache.org/camel/contributing.html

but basically, just raise a JIRA and attach whatever code/patches you
like and we can take it from there.


> >> Related to this issue, how would I set the ConnectionFactory for the
> >> JMS Component?
> >
> > Here's an example that shows you how to do it in Java code...
> > http://activemq.apache.org/camel/walk-through-an-example.html
> >
> > Also I've just updated the wiki to show how to do the same thing via
> > Spring XML also (you might need to hit refresh on your browser)
> > http://cwiki.apache.org/CAMEL/how-do-i-add-a-component.html
> > http://cwiki.apache.org/CAMEL/how-do-i-configure-endpoints.html
>
>  From my testing, it appears that the modification you made to the
> JmsComponent starts it's own broker. Is this accurate?

Yes - the broker is started if you use the brokerURL of vm://localhost...


> If so, how can
>  I connect to a standalone broker

If you prefer to connect to a remote broker then use tcp://host:port
instead. To handle auto-reconnection use failover:tcp://host:port


> or how can I configure the
> JmsComponent to use an ActiveMQ persistence adapter and MySQL data-
> source?

You could explicitly configure the broker inside the spring.xml as
well - though you do have to be a little careful that the broker is
started first before the ConnectionFactory (so usually you need to use
the spring xml dependsOn stuff) - as if you are not careful the vm://
transport will auto-create a broker for you first


> Currently, I'm using the following Spring configuration to use a
> ActiveMQ persistence adapter and a MySQL data-source:
>
>         <bean id="broker" class="org.apache.activemq.broker.BrokerService"
> init-method="start" destroy-method="stop">
>                 <property name="brokerName" value = "broker"/>
>                 <property name="persistent" value="true"/>
>                 <property name="useJmx" value = "false"/>
>                 <property name="transportConnectorURIs">
>                         <list>
>                                 <value>vm://localhost</value>
>                                 <value>tcp://localhost:9000</value>
>                         </list>
>                 </property>
>                 <property name="persistenceAdapter" ref="persistenceAdapter"/>
>         </bean>
>
>         <bean id="persistenceAdapter"
> class="org.apache.activemq.store.PersistenceAdapterFactoryBean">
>             <property name="dataSource" ref="mysql-ds"/>
>             <property name="dataDirectory" value="activemq-data"/>
>             <property name="journalLogFiles" value="5"/>
>         </bean>
>
>         <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>             <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>             <property name="url" value="jdbc:mysql://localhost/activemq?
> relaxAutoCommit=true"/>
>             <property name="username" value="root"/>
>             <property name="password" value=""/>
>             <property name="poolPreparedStatements" value="true"/>
>         </bean>

Looks good to me. You could try the Spring 2 XML stuff if you want -
but the above looks fine.

If you prefer to run the broker separately, you could just edit the
activemq.xml that ships with ActiveMQ to configure the MySQL stuff and
use the tcp:// transport to connect to it

-- 
James
-------
http://macstrac.blogspot.com/

Mime
View raw message