You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "paulo.neves" <pa...@gmail.com> on 2013/10/15 14:57:25 UTC

Best practice to create checkpoint functionality

Hi,

I want to create a checkpoint functionality for logging into the database or
JMS, information like (start route execution (when message come) with
routeid, timestamp, input, breadcrumbId), (end route execution (when message
had processed) with routeid, timestamp, breadcrumbId).
My idea is to create a simple console, that give general information about
integration jobs (with timestamp that job performed, their input and when
the job ended). 
breadcrumbId is to correlate job routes execution.

Example console:

JOB                                RouteId           ProcessId               
Event                      Timestamp
<Camel contextId>            <routeId>        <breadcrumbId>      
START|END|ERROR



Is there any best practice to do that ?

1) I try EventNotifierSupport with ExchangeCreatedEvent,
ExchangeCompletedEvent but gave me several createdEvent from same endpoint e
several completedEvent from same endpoint.

my code example:
if (event instanceof ExchangeCompletedEvent) {
    		ExchangeCompletedEvent complete = (ExchangeCompletedEvent) event;
    		
    		String processId = (String)
complete.getExchange().getIn().getHeader(Exchange.BREADCRUMB_ID);
    		
    		log.info("["+processId+"] | COMPLETE | " +
complete.getExchange().getFromRouteId() + " | "
+complete.getExchange().getFromEndpoint().toString() + " | " +
complete.getExchange().getExchangeId());
    	}
    	
    	if (event instanceof ExchangeCreatedEvent) {
    		ExchangeCreatedEvent create = (ExchangeCreatedEvent) event;
    		String processId = (String)
create.getExchange().getIn().getHeader(Exchange.BREADCRUMB_ID);
    		
    		log.info("["+processId+"] | CREATED | " +
create.getExchange().getFromRouteId() + " | "
+create.getExchange().getFromEndpoint().toString() + " | " +
create.getExchange().getExchangeId() );
    	}
 

2) With intercept component I don't know how I can intercept generic begin
route execution, end route execution)


3) I think to create checkpoint component, that I put this component when I
need to check checkpoint information.
example: to("checkpoint?event=START")

Is there already any component or interceptor that gave me what I want ?
What's best practice to do that functionality ?


Thanks,

Paulo




--
View this message in context: http://camel.465427.n5.nabble.com/Best-practice-to-create-checkpoint-functionality-tp5741599.html
Sent from the Camel - Users mailing list archive at Nabble.com.