Hi Bernard,
One straightforward solution would be to implement a small CDI extension
deployed within your WAR that would do the white (or black) listing of the
RouteBuilder, depending on whatever condition (a properties file), e.g.:
public class CustomerRoutesExtension implements Extension {
<X extends RouteBuilder> void excludeRoutes(@Observes ProcessAnnotatedType<X>
pat) {
if (toExcludeForCustomer(pat.getAnnotatedType().getJavaClass()))
pat.veto();
}
}
Similarly, you can easily veto all the RouteBuilder classes from being
discovered and add them manually to implement a white listing strategy.
We may want to have an @Conditional annotation (like in Spring) but then the
condition will have to be based on a generic semantic.
Antonin
> On 16 Mar 2017, at 14:34, Bernard Ligny <[email protected]> wrote:
>
> Hi Camel folks
>
> I would like to have some advices/recommandations about the following
> requirement.
>
> We have a webapp with *many* Camel routes (started with Camel-CDI). This war
> is deployed on various application servers for various customers.
> Some of theses routes are common to all customers, while other routes are
> limited/dedicated to a single customer (and should therefore not be
> "deployed" for all customers)
>
> What would be the best solution to have a conditional (> depending on
> props/conf file) registration of my routes ?
> Please note I wish a conditional *registration* and not *starting* (> I do
> not want the unused routes to be part of my CamelContext, nor to be visible
> in hawt-io).
> So disabling autostart + manually starting needed routes is not an option...
>
> Any idea ? - of something different from this:
>
>
> I was thinking about a new annotation on the routebuilder, eg
>
>
>
> Another alternative (but which requires a lot more refactoring) would be to
> have a more "micro-services" oriented approach, to break my monolithic war
> into a set of jars (each jar embedding a SINGLE RouteBuilder), and than in
> the war assembly phase, build a customer-specific artifact (that is, exclude
> the jars containing unneeded routes).
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Conditional-registration-of-routes-or-route-builders-tp5795589.html
> Sent from the Camel - Users mailing list archive at Nabble.com.