Spring integration documentation explains that a payload expression must be specified when declaring a gateway from an interface method with no arguments, so that the framework knows what payload should be set on the generated message. However, if I do the following:
<int:gateway id="myGateway"
service-interface="com.example.MyGateway"
default-request-channel="requestChannel"
default-reply-channel="replyChannel" />
for the following interface:
package com.example;
public interface MyGateway {
@Gateway(payloadExpression = "''")
String doSomething();
}
this leads to an error: "receive is not supported, because no pollable reply channel has been configured".
This works instead:
public interface MyGateway {
@Payload("''")
String doSomething();
}
Indeed, the same above documentation specifies that the payload should be specified with either @Payload
or with payload-expression
attribute on method
elements.
However, as a user, I find it quite surprising that setting a payload expression through the @Gateway
annotation does not work here, especially because the same annotation works in other contexts.
Is this on purpose or an oversight?
@Gateway
and this works perfectly fine. It seems like the problem occurs when such interface has just one method, in which case probably@Gateway
is simply ignored, or at least itspayloadExpression
value. Compare the behaviour with transformers: it's perfectly fine to declare a transformer in XML and use@Transformer
to specify which method. – Incursion