camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artur Jablonski <ajablon...@ravenpack.com>
Subject Camel + Spring + Spring Boot, waiting for the routes to start
Date Tue, 11 Apr 2017 11:30:54 GMT
Hello,

I have the Camel + Spring + SpringBoot combo working


I have my RouteBilder Spring Component that's being pickup up and started
during Spring startup.
The route starts fine as I can see SpringCamelContext output in the logs.

What I am trying to do is to send a message to direct endpoint using
injected ProducerTemplate but if I do it like this

@Produce(uri = "direct:myQueue")
private ProducerTemplate producerTemplate;

@EventListener(ContextRefreshedEvent.class)
public void send()
    throws Exception
{
    producerTemplate.start();
    producerTemplate.sendBody("hello");
}


I am getting

 No consumers available on endpoint: direct://myQueue

because the route has not started yet and if I try blocking parameter on
uri like this:

@Produce(uri = "direct:myQueue?block=true")

then the whole thing freezes for 30 secs (default timeout) and then blows
up with the same exception

I also tried to call the producerTemplate.sendBody() form @PostConstruct
annotaded method with the same effect.


How do I wait for the CamelContext to be fully started in this context????


Cheerio
Arur

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message