Zaheer
Zaheer

Reputation: 47

How to capture error at compile level in Apache Camel

I have route like

.bean(OrderService.class, "doSomething")

Now my question is if for any reason any developer misspell method name in route, we would not be able to identify at compile level or we may realize after going to production.

How to handle these scenario?

Upvotes: 1

Views: 139

Answers (1)

Makoto
Makoto

Reputation: 106430

At a minimum I would recommend a test which ensures that your Camel components are registered with the Camel context, and if they're not, one would expect an exception to be thrown at application startup time.

In essence, you would want a Spring test suite (since Camel will leverage Spring's context for its own context) to ensure that your bean is wired in correctly here.

This cannot be a compile-time error or check since this is specific to how the application context is built, which is done dynamically at runtime.

Upvotes: 2

Related Questions