我想这样做:
步骤1:从网络服务接收消息 - >结果确定
<ws:inbound-gateway id="ws-inbound-gateway"
request-channel="requestChannel" reply-channel="replyChannel" reply-timeout="300000"
error-channel="errorChannel" />
<int:chain input-channel="requestChannel" output-channel="inbound">
<int:service-activator ref="defaultLogger" method="logger"/>
</int:chain>
步骤2:在扇出交换兔子中写一个xml消息 - &gt;结果确定
<int-amqp:outbound-channel-adapter
channel="inbound" amqp-template="amqpTemplate" return-channel="outbound"
exchange-name="es.queue.test"
confirm-ack-channel="confirmAck" confirm-nack-channel="confirmNack" confirm-correlation-expression="#this" />
步骤3:将xml验证为xsd - &gt;结果ok XsdValidationException
<int:chain input-channel="confirmAck" output-channel="outbound">
<int:service-activator ref="defaultLogger" method="logger"/>
<int-xml:validating-filter schema-type="xml-schema"
schema-location="classpath:/schema/prueba.xsd"
throw-exception-on-rejection="true" discard-channel="errorChannel" />
</int:chain>
在此步骤中,消息将发送到errorChannel,但我有下一个错误:
63863 [AMQP Connection 10.0.9.155:5672] ERROR o.s.a.r.s.PublisherCallbackChannelImpl - Exception delivering confirm
org.springframework.integration.MessageRejectedException: Message was rejected due to XML Validation errors; nested exception is org.springframework.integration.xml.AggregatedXmlMessageValidationException: Multiple causes:
cvc-elt.1: No se ha encontrado la declaración del elemento 'ns2:***'.
at org.springframework.integration.xml.selector.XmlValidatingMessageSelector.accept(XmlValidatingMessageSelector.java:134)
at org.springframework.integration.filter.MessageFilter.doHandleRequestMessage(MessageFilter.java:161)
at org.springframework.integration.handler.AbstractReplyProducingPostProcessingMessageHandler.handleRequestMessage(AbstractReplyProducingPostProcessingMessageHandler.java:46)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
步骤4:Web服务客户端永远不会收到响应 我认为这是错误&#34;异常交付确认&#34;发生的原因是当尝试发送确认确认时,异常是在线程AMQP中抛出。
你能帮助我吗?
答案 0 :(得分:0)
除非您向我们解释为什么使用throw-exception-on-rejection="true"
并打破流量,否则一切看起来都不错?
我甚至认为confirm-correlation-expression="#this"
确实将requestMessage
传递给confirm-ack-channel
,因此您可以从该子流向WS网关发送回复。
但是!由于您throw-exception-on-rejection="true"
无法将任何内容发送到outbound
频道。
return-channel
也不是回复。这是另一个错误状态,当Broker由于某些配置错误而无法将消息传递到队列时:http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/