We're using the event notification framework in Camel to perform logging of 
certain route metrics based on ExchangeSentEvents. Generally this works just 
fine as long as the route we are monitoring is part of a larger route where it 
is being called via something like a to(). If the sub-route is used standalone 
and we inject it into the consumer using an interface and @Produce, the proxy 
does not seem to generate ExchangeSentEvent or any other events off of the 
proxied route. I can circumvent the issue by wrapping the route or using 
ProducerTemplate instead of an interface, but both of those seem a bit tedious. 

Is the interface-based proxy expected to not produce events by design? The 
ProducerTemplate seems to send them, but I wanted to hide the Camel APIs as 
much as possible from the consumer classes.

from("direct:test").to(somewhere);
from("direct:wrapped-test").to("direct:test");

// does NOT emit ExchangeSentEvent
@Produce(uri = "direct:test")
TestInterface test;

// does emit ExchangeSentEvent
@Produce(uri = "direct:wrapped-test")
TestInterface test;

// does emit ExchangeSentEvent
@Produce(uri = "direct:test")
ProducerTemplate testTemplate;

Thanks for any input,
Kevin

Reply via email to