You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Michele <mi...@finconsgroup.com> on 2016/01/27 11:49:16 UTC

Idempotent Component and DLQ Error Handler

Hi everyone,

a common requirement in my business is to provide a route with an idempotent
component for inbound message. That means that when a message that has
already been processed into the route then it will discarded and it will
forwarded to queue of message already processed.

This doesn't work fine with DLQ error handler, after redelivery policy the
messageId isn't deleted from repository (The IdempotentFileRepository will
contain only message successful processed) Why? Any idea? 

This is my route (No TX):


		<route id="ProcessingMessageDataWithIdempotentStrategy_Route"
errorHandlerRef="dlqErrorHandler">
			<from uri="activemq:queue:IF_CUSTOMER_NormalizedIncomingTickets" />
			
			<idempotentConsumer messageIdRepositoryRef="IdempotentFileRepository"
skipDuplicate="false" removeOnFailure="true" >
				 
            	<header>IdempotentMessageId</header>
				<filter>
               		
                	<exchangeProperty>CamelDuplicateMessage</exchangeProperty>
                	<log message="ALERT: Found Duplicated Message in Routing
System. It will be discarded!" />
                	<setHeader
headerName="ResultCode"><constant>SUCCESS</constant></setHeader> 
                	<to
uri="activemq:queue:IF_CUSTOMER_ProcessedIncomingTickets" />
                	<stop />
            	</filter>
            	
				
				<enrich uri="direct:crm-login" strategyRef="OAuthStrategy" />
				
				<log message="Token ${in.header.OAuth-Token}" loggingLevel="DEBUG"/>
				<marshal ref="Gson" />
				<setHeader headerName="Content-Type">
					<constant>application/json</constant>
				</setHeader>
				<setHeader headerName="CamelHttpMethod">
					<constant>POST</constant>
				</setHeader>
				
				
				<setHeader headerName="CRMInsertTicketPath">
					<simple>
				
jetty:{{crm.rs.host.name}}:{{crm.rs.port}}{{crm.rs.context.path}}/tk_rt_ticket/${in.header.customer-code}/insert?httpClient.idleTimeout=30000
					</simple>
				</setHeader>

				<recipientList stopOnException="true" parallelProcessing="false"
streaming="false">
					<header>CRMInsertTicketPath</header>
					<to uri="activemq:queue:IF_CUSTOMER_ProcessedIncomingTickets" />
				</recipientList>	
			</idempotentConsumer>
		</route>


Best Regards

Michele



--
View this message in context: http://camel.465427.n5.nabble.com/Idempotent-Component-and-DLQ-Error-Handler-tp5776787.html
Sent from the Camel - Users mailing list archive at Nabble.com.