You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bogdan_1 <bi...@monexgroup.com> on 2008/11/03 20:05:35 UTC
RE: camel persistence
hi,
i use activemq and camel on top of that for message routing. how can i
persist the messages in the JMS layer ?
if i can configure it in the camel xml file via spring, what will it look
like ?
bellow is the camel.xml file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:camel="http://activemq.apache.org/camel/schema/spring"
xmlns:broker="http://activemq.apache.org/schema/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.1.0.xsd
">
<!-- START SNIPPET: example -->
<camelContext useJmx="true"
xmlns="http://activemq.apache.org/camel/schema/spring">
<!-- now lets write messages from the queue to a directory -->
<route errorHandlerRef="deadLetterErrorHandler">
<from uri="jms:a"/>
<choice>
<when>
<xpath>$foo = 'bar'</xpath>
<choice>
<when>
<xpath>$bar != 'foo'</xpath>
<to uri="jms:b"/>
</when>
</choice>
<choice>
<when>
<xpath>$bar != 'foo1'</xpath>
<to uri="jms:c"/>
</when>
</choice>
<choice>
<when>
<xpath>$bar != 'foo2'</xpath>
<to uri="jms:d"/>
</when>
</choice>
</when>
<otherwise>
<to uri="jms:d"/>
</otherwise>
</choice>
</route>
</camelContext>
<bean id="deadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
<property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
</bean>
<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
<property name="maximumRedeliveries" value="-1"/>
<property name="initialRedeliveryDelay" value="30000"/>
<property name="maximumRedeliveryDelay" value="600000"/>
<property name="useExponentialBackOff" value="true"/>
<property name="backOffMultiplier" value="2" />
</bean>
<broker:broker useJmx="true" persistent="true" brokerName="localhost">
<broker:transportConnectors>
<broker:transportConnector name="tcp"
uri="tcp://localhost:61616"/>
</broker:transportConnectors>
</broker:broker>
<!-- lets configure the Camel JMS consumer to use the ActiveMQ broker
declared above -->
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost"/>
</bean>
</property>
</bean>
<bean id="dest" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL"
value="tcp://secure.monexportal.com:61616"/>
</bean>
</property>
</bean>
</beans>
thank you
--------------------------------------------
Claus Ibsen wrote:
>
> Hi
>
> See transactional client EIP pattern:
> http://activemq.apache.org/camel/transactional-client.html
>
> A good solution is to use JMS as the persistence layer to ensure message
> not being lost.
>
> However what kind of transport are you using to send the messages from
> Camel to the client?
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Bogdan_1 [mailto:bivascu@monexgroup.com]
> Sent: 30. oktober 2008 20:06
> To: camel-user@activemq.apache.org
> Subject: camel persistence
>
>
> anyone has some reference material on how camel manages transactions ?
> what is camel's persistence mechanism.
>
> if in the process of sending a message the computer on which camel runs
> goes
> down, as far as i see camel will lose the message. is there any way that i
> can make camel persist the message until delivery succeeds ?
>
> thanks
> --
> View this message in context:
> http://www.nabble.com/camel-persistence-tp20253402s22882p20253402.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
--
View this message in context: http://www.nabble.com/camel-persistence-tp20253402s22882p20308584.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel persistence
Posted by James Strachan <ja...@gmail.com>.
2008/11/3 Bogdan_1 <bi...@monexgroup.com>:
>
> hi,
> i use activemq and camel on top of that for message routing. how can i
> persist the messages in the JMS layer ?
Sending to a JMS endpoint using the default persistent delivery mode.
(i.e. if you don't disable message persistence).
> if i can configure it in the camel xml file via spring, what will it look
> like ?
That looks fine to me.
Its usually better to use transacted JMS though - see the 'Enabling
Transacted Consumption' note here...
http://activemq.apache.org/camel/jms.html
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/