我有一个从MVC层获取输入的网关。输入发送到出站网关(REST调用)。然后通过过滤器发送响应以验证响应。如何将丢弃信道(丢弃的消息)发送回网关。 我需要将无效响应发送回网关或将异常发送回网关。
答案 0 :(得分:1)
您可能不需要担心discardChannel
。网关案例有这个属性:
/**
* Specify whether this filter should throw a
* {@link MessageRejectedException} when its selector does not accept a
* Message. The default value is <code>false</code> meaning that rejected
* Messages will be quietly dropped or sent to the discard channel if
* available. Typically this value would not be <code>true</code> when
* a discard channel is provided, but if so, it will still apply
* (in such a case, the Message will be sent to the discard channel,
* and <em>then</em> the exception will be thrown).
* @param throwExceptionOnRejection true if an exception should be thrown.
* @see #setDiscardChannel(MessageChannel)
*/
public void setThrowExceptionOnRejection(boolean throwExceptionOnRejection) {