-
Rather than writing code using the messaging APIs directly, you'd be better off using a Messaging gateway instead
Code:
public interface myGateway {
MyResult sendAndReceive(MyEntity myEntity);
}
<int:gateway service-interface="foo.MyGateway" default-request-channel="toRabbit" />
-
Look at using a gateway instead. Is there a reason why you want to define your own reply channel explicitly? You can very well rely on the temporary channels created even when you use gateways.
-
-
I tried using the Message Gateway but I get this message when I run my Junit test.
12:50:22,970 DEBUG mework.integration.gateway.GatewayProxyFactoryBean : 134 - Unable to attempt conversion of Message payload types. Component 'myGateway' has no explicit ConversionService reference, and there is no 'integrationConversionService' bean within the context.
-
The types have to match; otherwise you need a conversion service or transformer, or do the conversion in the amqp gateway.
If you are expecting a JSON String, then the return type on the gateway must be String.
If you want the string converted to an object, json to object conversion needs a hint as to what object you want it converted to. You can do this with the JsonMessageConverter and a custom ClassMapper, or use a <json-to-object-transformer/> in the reply path.