hi gary :
i have the following service configuration for the server with spring-amqp.
the problem is the client receives the message but errors out with
[SimpleAsyncTaskExecutor-1] DEBUG org.springframework.amqp.rabbit.listener.BlockingQ ueueConsumer - Received message: (Body:'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Echo_PayloadResponse xmlns="http://bear.com/echo/schemas"><Payload>XXXXXXXXXXXXXXXXXXXXXXXXXXXXX</Payload></Echo_PayloadResponse>'; ID:null; Content:text/plain; Headers:{}; Exchange:; RoutingKey:replies; Reply:null; DeliveryMode:PERSISTENT; DeliveryTag:1)
[SimpleAsyncTaskExecutor-1] ERROR org.springframework.amqp.rabbit.core.RabbitTemplat e - No correlation header in reply
although on the server side i see message headers :
Received message: (Body:'<Echo_Payload xmlns="http://bear.com/echo/schemas"> <RequestPadding>1234567890</RequestPadding> <SleepMilliseconds>0</SleepMilliseconds> <PayloadSize>400</PayloadSize> </Echo_Payload>'; ID:null; Content:text/plain; Headers:{spring_reply_correlation=93863d64-52d0-4be0-a88c-c321222bf574, spring_reply_to=null}; Exchange:s2-amqp.direct; RoutingKey:submitEchoPayload; Reply:replies; DeliveryMode:PERSISTENT; DeliveryTag:1)
but these are not preserved on the server side cause i don't have mapping headers for spring_reply_correlation.
and of course the submitMethod doesn't take a spring-amqp Message object, it only takes a JAXBReq and JAXBResponse object.
public JAXBElement<EchoPayloadResponseT> submitEchoPayload(EchoPayloadT echoPayload) {
the createMessage() method in XMLMessageConverter does the following:
message = super.createMessage(xml, messageProperties);
besides using spring-integration, what's the best way to preserve message headers given the constraints where the ultimate service doesn't "know" about "Spring's" Message (header,body)?
thanks and regards,
-cogitate
spring-context client side
================================================== =================
<rabbit:queue name="replies" auto-delete="true" durable="false" exclusive="true"></rabbit:queue>
<rabbit:template reply-queue="replies" id="amqpTemplate" connection-factory="rabbitConnection"
exchange="s2-amqp.direct" routing-key="submitEchoPayload" queue="amqp_echoPayload">
<rabbit:reply-listener/>
</rabbit:template>
================================================== =================
spring-context on server side
================================================== ======
<bean id="echoPayloadServer" class="com.bear.EchoPayloadService"></bean>
<listener-container xmlns="http://www.springframework.org/schema/rabbit" acknowledge="auto" concurrency="2"
connection-factory="rabbitConnection" message-converter="xmlConverter" prefetch="1">
<listener ref="echoPayloadServer" method="submitEchoPayload" queue-names="amqp_echoPayload" />
</listener-container>
<bean id="xmlConverter" class="com.bear.XMLMessageConverter">
....
</bean>
<!-- rabbit configuration -->
<rabbit:connection-factory id="rabbitConnection" />
<rabbit:admin connection-factory="rabbitConnection" auto-startup="true"/>
<rabbit:queue name="amqp_echoPayload" auto-delete="true" durable="false" exclusive="false"></rabbit:queue>
<rabbit:direct-exchange name="s2-amqp.direct">
<rabbit:bindings>
<rabbit:binding queue="amqp_echoPayload" key="submitEchoPayload"/>
</rabbit:bindings>
</rabbit:direct-exchange>
================================================== ======


Reply With Quote