You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ma...@gmail.com on 2021/08/09 15:39:23 UTC
How to start CamelContext and init routes in test manually?
Hello!
I'm trying to start CamelContext manually and init routes described
into my RouteBuilder class.
I use SpringBoot but could not use camel-spring-boot-starter because of
our legacy test environment.
I have beans defined:
@Bean
public CamelContext camelContext() {
return new SpringBootCamelContext(applicationContext, true);
}
@Bean
public PayRouteBuilder payRouteBuilder(CamelContext camelContext) {
return new PayRouteBuilder(camelContext);
}
But I'm facing an exception on advicing my route:
AdviceWith.adviceWith(camelContext,
ENDPOINT_ISSUE_CARD_REQUEST, in -> {
in.interceptSendToEndpoint(cardIssuingEndpointProvider.getIssueCardRequ
estEndpoint())
.setBody().body(ex ->
marshalToJson(aCardIssuedSuccessfullyResultDto(walletId, paymentId,
merchantId, cardId)))
.to(ENDPOINT_CARD_ISSUED_NOTIFICATION);
});
___
Cannot advice route as route with id: mock://issue-card-request-
endpoint does not exists
___
I have debugged for a while and have mentioned that in method
org.apache.camel.main.RoutesConfigurer#configureRoutes
List<RoutesBuilder> routes
is populated successfully with routes from my RouteBuilder, but my
routes are not passed to the context.
Why?
_________________
Vyacheslav Boyko,
mailto:mail4bvn@gmail.com