Reputation: 354
I'd like to use a bean with a method annotated with @Transformer to transform a message accessing part of its headers with the @Header annotation. Is there a way to do this with the Java DSL (with Java 7, so no lambdas)? It does not seem like so.
Upvotes: 4
Views: 2171
Reputation: 121282
You can do it like this:
.handle("myTransformer", "myMethod")
if your transformer doesn't return Message
.
From other side, if you already use @Transformer
there you can add channel
attributes to make the real endpoint for that method and use those channels from the IntegrationFlow
, e.g. .gateway("transformChannel")
Since 1.1 we are going to add more EIP-methods to make it more flexible for similar cases.
Feel free to raise GH issue on the matter!
Upvotes: 1
Reputation: 174564
This...
.transform("@transformerBean.someMethod(payload, headers['foo'])")
...should work.
Upvotes: 0