简体   繁体   中英

Sending Message Headers with Spring AMQP outbound gateway

I have used Spring Amqp Outbound Gateway integration to send request to a third party web service. Below shown is my gateway interface.

public interface AccountManagerGateway {

    public RetrieveAccountResponse retrieveAccount(RetrieveAccountRequest request);
}

I need to know how to send custom Message Headers with the gateway call.

Ex:- "AccountID" in the header

I did some google searches but couldn't find a solution. May be I'm doing the search in a wrong context or a wrong direction. I'm expecting your kind support on this.

Please let me know if you need more info. I didn't post my integration-context xml in here because then the post will get lengthy.

Thanks.

See the documentation about gateways .

For example:

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

By default, user-defined headers are not sent over AMQP so you need to configure the mapped-request-headers on the outbound gateway; something like

mapped-request-headers="STANDARD_REQUEST_HEADERS,AccountId"

Again, refer to the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM