Search code examples
javascalaapache-camelevent-driven-design

Debugging errors in consuming asynchronous events in apache camel


I'm using apache camel in my application. I use camelContext producerTemplate to send messages:

template.send("seda://destination")

The consumer looks something like this:

from("seda://destination").process(new Processor {
    override def process(exchange: Exchange): Unit = {
        // some processing
    }
})

This works fine on my dev environment. But on production, I dont see control coming to consumer at all although producer sends the messages. I dont see any errors in logs as well. Is there any way to debug this? The only difference between dev and prod environment is that I have a proxy set up to communicate with services over the internet.


Solution

  • The application was basically pulling tweets using twitter streaming API. Once a tweet comes in, I was producing a message using camel's producerTemplate. There was a consumer which was picking up this message. In this consumer, there was a component which was making an http call to another service. But on my production environment, I was able to communicate with the external world only through an http proxy. The library which was making http call was using apache commons httpClient. Since the proxy was not added to this httpClient, the consumer was getting stuck at processing just one tweet. I was inititally using seda. I changed it to direct and saw that my process was stuck after processing just one tweet. The main problem was it was not timing out or throwing any errors because of which it was a little hard to narrow down the issue.