简体   繁体   English

Spring Integration Java DSL - Http Outbound Gateway uri 变量表达式

[英]Spring Integration Java DSL - Http Outbound Gateway uri variable Expression

I have a Http Outbound Gateway where I want to set a uri variable with a value from a Message header.我有一个 Http 出站网关,我想在其中设置一个带有消息标头值的 uri 变量。 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 .表达式的类型为org.springframework.expression.Expression How do I create such an Expression object for say a JmsHeaders.CORRELATION_ID value?如何为 JmsHeaders.CORRELATION_ID 值创建这样的Expression对象? 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?我知道字符串 SPEL 将是"headers['correlationId']"但我不知道如何将其转换为Expression对象?

I am using spring-integration-java-dsl:1.1.0.RELEASE .我正在使用spring-integration-java-dsl:1.1.0.RELEASE

See this answer to a similar question .请参阅此对类似问题的回答

Note that JmsHeaders.CORRELATION_ID is actually jms_correlationId .请注意, JmsHeaders.CORRELATION_ID实际上是jms_correlationId It's safer to use the constant...使用常量更安全......

PARSER.parseExpression("headers['" + JmsHeaders.CORRELATION_ID + "']");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring集成dsl:http出站网关 - Spring integration dsl: http outbound gateway Spring Integration Java DSL - 如何调用int-http:outbound-gateway? - Spring Integration Java DSL - How to invoke int-http:outbound-gateway? Http 出站网关正在工作但未拨打电话 - 使用 spring 集成 DSL java - Http outbound gateway is working but not making the call - using spring integration DSL java Spring Integration DSL - 可以访问标头的出站网关 - Spring Integration DSL - Outbound Gateway with access to Headers Spring Integration-网址变量在http:outbound-gateway中不起作用 - Spring Integration - url-variable not working in http:outbound-gateway 将文件/文件从远程目录移动到另一个 Spring 集成 SFTP 出站网关 Java 配置/Java DSL - Moving file/files from remote directory to another Spring Integration SFTP Outbound Gateway Java Config/Java DSL Spring Integration Http Outbound Gateway Header Mapper - Spring Integration Http Outbound Gateway Header Mapper 在 Spring Integration 中使用 Http Outbound Gateway 进行错误处理 - Error handling with Http Outbound Gateway in Spring Integration Spring Integration Java DSL中的JPA出站通道适配器配置 - JPA outbound channel adapter config in Spring Integration Java DSL 如何在Spring集成中使用JAVA配置创建http outbound-gateway? - How can I create http outbound-gateway with JAVA config in Spring integration?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM