【问题标题】:Spring Integration outbound gateway response validationSpring Integration 出站网关响应验证
【发布时间】:2017-04-05 15:04:51
【问题描述】:

我有一个从 MVC 层获取输入的网关。输入被发送到出站网关(REST 调用)。然后通过过滤器发送响应以验证响应。如何将丢弃通道(丢弃的消息)发送回网关。 我需要将无效响应发送回网关或向网关抛出异常。

【问题讨论】:

    标签: spring-integration


    【解决方案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) {
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-14
      • 1970-01-01
      相关资源
      最近更新 更多