activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Active MQ Message Persistence
Date Thu, 18 Sep 2008 09:16:18 GMT
2008/9/18 slimrednano <stevenlim@rednano.sg>:
>
> Hi
>
> Thanks for the prompt reply.
>
> I have set the message to be persistence=true in the spring.xml
> (applicationContext)
>
> I am not sure whether the way how I configure the bean is correct?
>
> Here I attached all my configurations for the camel and active mq components
>
> Camel Component Configuration
>
> <camel:camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
>        <package>sg.sphsearch.adserver.messaging</package>
>        <endpoint id="adserver" uri="direct:unmarshalled"/>
> </camel:camelContext>
>
>
> ActiveMQ Component Configuration
>
> <bean id="activemqOut" class="org.apache.camel.component.jms.JmsComponent">
>        <property name="connectionFactory">
>            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                <property name="brokerURL" value="${mq.broker.url}"/>
>            </bean>
>        </property>
>        <property name="deliveryPersistent" value="true"/>
>        <property name="subscriptionDurable" value="true"/>
>        <property name="explicitQosEnabled" value="true"/>
> </bean>
>
>
> The java class for camel routing
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.converter.jaxb.JaxbDataFormat;
> import org.apache.camel.spi.DataFormat;
>
> public class MessageRoutes extends RouteBuilder
> {
>
>    DataFormat jaxb = new JaxbDataFormat("xx.xx.xx.messaging.model");
>
>    @Override
>    public void configure() throws Exception
>    {
>        // Incoming routes
>        from("activemq:topic:BTMSADSERVER").
>                unmarshal(jaxb).
>                to("bean:messageService?methodName=onConsume");
>
>        // Outgoing routes
>        from("adserver").
>                marshal(jaxb).convertBodyTo(String.class).
>                to("bean:messageService?methodName=logMessage").
>                to("activemqOut:topic:ADSERVER");
>    }
> }
>
> Btw the message producer that I used is message producer from Camel
>
> @EndpointInject(name = "adserver")
> private ProducerTemplate producer;
>
> Or should I use the message producer from jms.MessageProducer?
>
> Anybody encounter this problems previously.

You should use the Camel producer - it saves you making mistakes using
the rather complex JMS API. Also I'd recommend using the Camel
ActiveMQComponent rather than the JmsComponent as it comes configured
to use JMS pooling efficiently.

I think your problem is you're not actually sending to a JMS topic,
you are sending to an in memory queue
       <endpoint id="adserver" uri="direct:unmarshalled"/>

try using a URI of activemq:topic:something.

For more help on using ActiveMQ with Camel see
http://activemq.apache.org/camel/activemq.html


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

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

Mime
View raw message