【问题标题】:Sending Message Headers with Spring AMQP outbound gateway使用 Spring AMQP 出站网关发送消息头
【发布时间】:2016-01-09 23:39:11
【问题描述】:

我使用 Spring Amqp 出站网关集成向第三方 Web 服务发送请求。下图是我的网关界面。

public interface AccountManagerGateway {

    public RetrieveAccountResponse retrieveAccount(RetrieveAccountRequest request);
}

我需要知道如何通过网关调用发送自定义消息头。

Ex:- "AccountID" in the header

我做了一些谷歌搜索,但找不到解决方案。可能是我在错误的上下文或错误的方向进行搜索。我期待您的支持。

如果您需要更多信息,请告诉我。我没有在这里发布我的集成上下文 xml,因为那样帖子会变得很长。

谢谢。

【问题讨论】:

    标签: java spring web-services spring-integration


    【解决方案1】:

    the documentation about gateways

    例如:

    public RetrieveAccountResponse retrieveAccount(RetrieveAccountRequest request,
                   @Header("AccountId") String accountId);
    

    默认情况下,用户自定义的header不会通过AMQP发送,所以需要在出站网关上配置mapped-request-headers;像

    mapped-request-headers="STANDARD_REQUEST_HEADERS,AccountId"
    

    再次,请参阅the documentation

    【讨论】:

      猜你喜欢
      • 2017-01-19
      • 2016-10-16
      • 1970-01-01
      • 1970-01-01
      • 2018-04-10
      • 1970-01-01
      • 2019-08-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多