У меня есть очень простой построитель маршрутов Camel:
Код: Выделить всё
import org.apache.camel.builder.RouteBuilder;
public class SimpleTestRouteBuilder extends RouteBuilder
{
public SimpleTestRouteBuilder(int i)
{
// do something with i...
}
@Override
public void configure() throws Exception
{
// from("direct:messageReceiver").id("testReceipt")
// .log("received");
from("timer:/foo?repeatCount=1") // read from the specified queue
.routeId("fromrequestto0")
.to("smpp://localhost:2775");
from("timer:/foo2?repeatCount=1") // read from the specified queue
.routeId("fromresponseto1")
.to("smpp://localhost:2776");
}
}
Код: Выделить всё
@ConfigurationPropertiesScan
public class Application
{
@Autowired private CamelContext context;
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
CommandLineRunner init(ProducerTemplate template)
{
return args ->
{
Integer i = args.length == 0 ? 1 : Integer.parseInt(args[0]);
try
{
context.addRoutes(new SimpleTestRouteBuilder(i));
}
catch (Exception e)
{
// swallow
}
};
}
}
Код: Выделить всё
camel:
routecontroller:
enabled: true
backoffDelay: 5000
backoffMaxAttempts: 17280
initialDelay: 1000
threadPoolSize: 2
unhealthyOnExhausted: false
unhealthyOnRestarting: false
includeRoutes: "*"
Если первый маршрут запускается , но второй нет; затем приложение продолжает работать и включается контролирующий контроллер маршрута, повторяя маршрут до тех пор, пока второй SMS-C не станет доступным. (это то, что я хочу, чтобы произошло в обоих случаях, но это странно, потому что я бы подумал, что разминка верблюда и здесь не удалась?)
Почему существует разница в поведении в зависимости от маршрут здесь?
Подробнее здесь: https://stackoverflow.com/questions/790 ... all-routes