You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Felix Thomas <fe...@gmail.com> on 2015/11/11 11:37:02 UTC

Consume messages & rollback

Hello,

    I  have a scenario like
   1) reading from a queue  (Rabbitmq or ActiveMQ)
   2) Processing- transformation
   3) Send to another queue .

  I want my process to be failsafe i..e. unless the message is sent to the
endpoint the original message in the producer queue should not get
consumed(deleted). I am not sure how camel handles it internally , is it in
local cahce etc.  But incase my camel process goes down due to system
failure or power etc. The process should not have lost any messages in
between .i.e. count of messages in original and end point should match.

I saw the transcational client documentation , but it looks like it
requires spring and it only for the producer. Is there any way I can
configure my standalone camel process route to be fail safe.

regards,
Felix T

Re: Consume messages & rollback

Posted by fxthomas <fe...@gmail.com>.
hello, 

   Okay even if I use spring transaction, i still don't get it if the
processing is fail safe even if I set Ack to false

    For example I have a route as below and even a dead letter channel
configured.  In the error handler I am logging the message in a DB in case
if it was not delivered.  But what will happen  in case the message was not
logged in the DB due to some environment error etc. What happens to the
message , will the Active MQ  get the ACK . Because as far I have read in
the documentation of camel , as soon as the Processor has finished execution
the ack is sent back. (Hope I am right) even if there was a error or not
after it . How can my scenario be handled in a effective way. 

<route errorHandlerRef="CustomErrorHandler" customId="true" id="ROUTE_DATA"
xmlns="http://camel.apache.org/schema/spring">
 <from uri="direct:ACTIVEMQ"/>
 <process ref="CustomMapping" id="process2"/>
     <multicast parallelProcessing="true"
executorServiceRef="customThreadPoolProfile" id="multicast2">
         <pipeline id="pipeline1">
             <marshal id="marshal1">
                 <custom ref="kyroFormat"/>
             </marshal>
             <to uri="rabbitmq://localhost/HDFSMASTER" id="to9"/>
        </pipeline>
        <pipeline id="pipeline2">
             <process ref="CustomSantizerProcessor" id="process3"/>
             <marshal id="marshal2">
                  <custom ref="kyroFormat"/>
             </marshal>
             <to uri="rabbitmq://localhost/EXCHANGEMASTER" id="to10"/>
        </pipeline>
   </multicast>
</route>
 

		<route customId="false" id="CustomErrorRoute"
			xmlns="http://camel.apache.org/schema/spring">
			<from uri="direct:ErrorRoute" />
			<transform>
				<method ref="CustomErrorProcessor" method="createErrorEntry" />
			</transform>
			<to uri="sqlComponent:{{sql.insertNewError}}" />
  	</route>   

regards,
Felix T

    



--
View this message in context: http://camel.465427.n5.nabble.com/Consume-messages-rollback-tp5773638p5773865.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Consume messages & rollback

Posted by yogu13 <yo...@gmail.com>.
Camel's JMS component uses spring, i am afraid if for some reason do not want
Spring as part of the stack then you will have to custom code the endpoint
for yourself.

Transactions support is what you need for achieving the required behaviour
which camel supports.

Regards,
-Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/Consume-messages-rollback-tp5773638p5773676.html
Sent from the Camel - Users mailing list archive at Nabble.com.