James
James

Reputation: 1780

Static AND Dynamic Headers in Spring Integration Gateway

I'm able to add a dynamic header to a gateway by using:

public interface Gateway {
    @Gateway(requestChannel="myChannel")
    public void send(String message, @Header("dynamicHeaderValue") String dynamicHeader);
}

Alternatively I can add a static header in the xml config:

<si:gateway service-interface="app.MyGateway">
    <si:method name="myMethod" request-channel="myChannel">
        <si:header name="staticHeaderValue" value="FOO" />
    </si:method>
</si:gateway>

Currently my code is as above and the dynamic one is set but not the static. If I remove the dynamic annotations then the static one works but obviously not the dynamic one. How can I get both to work? Is it possible to set static header values with annotations? Correct me if I'm wrong but I don't think it's possible to set dynamic ones from arguments in the config file - see (jira INT-1860)

Upvotes: 2

Views: 2342

Answers (1)

omnomnom
omnomnom

Reputation: 9139

If you use XML configuration, remove @Gateway annotation from method - it should work then (both headers should be set).

Upvotes: 2

Related Questions