Reputation: 717
I"m having a hard time realizing something from the documentation.
What i'd like to do is to to enrich the current payload with a simple int.
Could i do that staticly from the enricher syntax or would i have to create an outbound request-reaponse endpoint just for that silly thing?
For example, i am looking for the somethinga lone the lines of:
<enricher target="#[variable:age]" source="SomeStringIwant"/>
That obviously would not work, is there some way to get it to work easily?
Thanks
Upvotes: 3
Views: 4652
Reputation: 33413
I would use a script transformer for this:
<script:transformer>
<script:script engine="groovy">
<script:text>
payload.age = message.getInboundProperty('ageProperty')
return payload
</script:text>
</script:script>
</script:transformer>
This script assumes the 'ageProperty' is in the inbound scope. If not, use the method for the right scope.
This script also relies on two of the implicit variables bound in the context of a script transformer:
Upvotes: 2