I have a Http Outbound Gateway where I want to set a uri variable with a value from a Message header. I can see that this can be done like so:
.handle(Http
.outboundGateway(serviceUri, restTemplate)
.uriVariable("var", expression)
.httpMethod(HttpMethod.POST)
The expression is of type org.springframework.expression.Expression
. How do I create such an Expression
object for say a JmsHeaders.CORRELATION_ID value? I can't find any examples anywhere. I know that the String SPEL would be "headers['correlationId']"
but I don't know how to turn that into an Expression
object?
I am using spring-integration-java-dsl:1.1.0.RELEASE
.
See this answer to a similar question.
Note that JmsHeaders.CORRELATION_ID
is actually jms_correlationId
. It's safer to use the constant...
PARSER.parseExpression("headers['" + JmsHeaders.CORRELATION_ID + "']");