camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Minimal Spring config for a webapp
Date Wed, 17 Sep 2008 10:22:22 GMT
2008/9/17 Martin Gilday <martin.lists@imap.cc>:
> Hi Camel riders,
>
> I'm in the process of writing a web app which needs to simply place a
> message on a JMS queue.  This is then picked up by an independent
> project with Camel routes in it.  What I am trying to do is write the
> smallest Camel config I need with Spring for the web app.  All I think I
> really need is a Camel ProducerTemplate and a JmsComponent definition
> which details the ActiveMQ connection details.
>
> I am hoping to just use the following (I've removed namespace
> definitions)
>
> <beans>
>  <camel:template id="camelTemplate" />
>
>  <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
>    <property name="connectionFactory">
>      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>        <property name="brokerURL" value="tcp://localhost:61616" />
>      </bean>
>    </property>
>  </bean>
> </beans>

BTW if you are using ActiveMQ I'd recommend using the ActiveMQ component...
http://activemq.apache.org/camel/activemq.html

as this is then configured to use pooling correctly.

e.g.

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


> Do I need to define a <camel:camelContext> at all?

Yes, right now its mandatory, it makes the CamelContext object which
is injected into the ProducerTemplate etc.

> Has anything changed regarding the <camel:template /> element since
> CamelTemplate was deprecated for ProducerTemplate? I've set up a
> AbstractJUnit4SpringContextTests with @Autowired on a ProducerTemplate
> field and asserted it exists and is an instance of
> DefaultProducerTemplate.  Was it ever considered to adjust the element
> name to be camel:producerTemplate so it is more obvious what it is?  Is
> it likely there will ever be another *Template in Camel that would make
> this element name confusing?

I think its gonna stay template AFAIK

If its any help there's a little tutorial on using camel with web apps...
http://activemq.apache.org/camel/tutorial-on-using-camel-in-a-web-application.html
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message