0

I have a Gateway with a default-request-channel an multiple methods.

public interface IUserService {
 public void updateUserName(Long id, String username);
 public void updatePassword(Long id, String password);
 ...
}

and the following xml config

...
<gateway id="userService" service-interface="...IUserService"
         default-request-channel="dataRequestChannel" 
         default-reply-channel="dataResponseChannel" />
...

How can i get information about the method which is invoked ?

I know that it is possible to apply static header values but is that the only way ? Or am i totally wrong ?

Thanks

2 Answers 2

1

We have an open JIRA issue for this feature; please vote it up.

Right now, the #method variable is available in expressions within specific method declarations

<int:gateway id="gw"
    service-interface="foo.Gateway"
    default-request-channel="input">
    <int:method name="sendAndReceive">
        <int:header name="gwMethod" expression="#method"/>
    </int:method>
</int:gateway>

But you would still have to declare each method.

Perhaps another, relatively simple enhancement would be to support wildcards in method names; something like...

<int:gateway id="gw"
    service-interface="foo.Gateway"
    default-request-channel="input">
    <int:method name="*">
        <int:header name="gwMethod" expression="#method"/>
    </int:method>
</int:gateway>

Where headers for method * would be added for all methods.

Sign up to request clarification or add additional context in comments.

1 Comment

Ok, i will vote for it. I think the wildcard solution would be nice. Thanks
0

As of 3.0.1 you can do the following to set headers across all methods accessed via the gateway (you can also manage the specific methods as usual).

I am showing how to set two header properties, transportType and methodType, one dynamic and one static:

<int:gateway id="gw" 
    service-interface="foo.async.Gateway" 
    default-request-channel="gateway-request-channel"
    default-reply-channel="gateway-response-channel">
    <int:default-header name="transportType" value="async-msg"/>
    <int:default-header name="methodType" expression="#gatewayMethod.name"/>
</int:gateway>

http://docs.spring.io/spring-integration/reference/html/messaging-endpoints-chapter.html#gateway-configuration-annotations

A bit late but the correct solution for those following this thread later.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.