7

On my gateway, I have a method

@Gateway
String commsTest();

The idea is that I can call commsTest from the bean and use spring integration to wire it up to the service activator that will check comms.

When I do that I get a receive is not supported, because no pollable reply channel has been configured error. I realise that this is because a method with no params means "I am trying to poll a message from the channel"

This is a two part question.

  1. What does it mean to poll a message from the channel.
  2. How can I get the functionality I want.
John Oxley
  • 14,698
  • 18
  • 53
  • 78

1 Answers1

11

Spring Integration currently has no concept of a message without a payload. By default, a gateway method with no arguments implies you want to receive data (rather than sending data or sending and receiving data).

You can change that default behavior, as described in the reference documentation.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • I think the updated documentation is now at https://docs.spring.io/spring-integration/reference/html/gateway.html#gateway-calling-no-argument-methods – Philippe Feb 10 '20 at 22:42
  • Thanks; fixed the link. – Gary Russell Feb 10 '20 at 23:05
  • Hi @GaryRussell, I'm a bit confused. I hit this problem, but I didn't expect to, because I had marked my no-arg gateway interface method with `@Gateway(payloadExpression="''")`. However I still got the error "receive is not supported, because no pollable reply channel has been configured". Replacing `@Gateway(payloadExpression="''")` with `@Payload("''")` fixed the problem. But why the former does not work?? I already use `@Gateway(payloadExpression="")` in other contexts (with methods with 1+ args) and it works well, why do I need to use `@Payload` here instead? Is it on purpose? – Mauro Molinari Sep 24 '21 at 10:58
  • Don't ask new questions in comments to an answer that is nearly 10 years old!!! Ask a new question showing code, configuration. – Gary Russell Sep 24 '21 at 13:42
  • @GaryRussell although I believe the topic is exactly this and could be helpful to other people landing here, I've created a [new question](https://stackoverflow.com/questions/69632638/gatewaypayloadexpression-vs-payload). – Mauro Molinari Oct 19 '21 at 14:25
  • Well, it's clearly not the same - this question is using annotation-based configuration whereas you are using XML (which your comment made no mention of - hence a new question is always better). – Gary Russell Oct 19 '21 at 14:54