Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Unknown
Description
Now that we have route templates and kamelets, we should explore the option to have route local beans in addition to route local properties. This would be very useful when dealing with EIPs or endpoints that require specific beans.
As example, assuming I have the following template:
routeTemplate() .from("direct:start") .to("aws2-s3:...?amazonS3Client=#myClient")
Then myClient need to be created at global scope and there's no way to create one that is specific for the template.
We should provide something like:
routeTemplate() .templateParameter("region") .templateParameter("bucket") .configure((RouteTemplateContext context) -> { // the lambda mechanism here is used as illustration // purpose to stress the fact that the materialization // of beans should be delayed till the route is reified context.bind( "myClient", S3Client.builder() .region(context.getProperty("region")) .build() ); }) .from("direct:start") .to("aws2-s3:{{bucket}}?amazonS3Client=#myClient")
So when the route is materialized, the configure method is invoked, the myClient bean is registered to the current template context and retrieved by the reifier to materialize the route.
Attachments
Issue Links
- relates to
-
CAMEL-16575 camel-core - Lookup bean if value is Supplier then lazy eval
-
- Resolved
-