Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Junit test for Spring Integration - Payload related issues

  1. #11
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,036

    Default

    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" />
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  2. #12
    Join Date
    Oct 2011
    Location
    Mumbai, India
    Posts
    213

    Default

    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.

  3. #13
    Join Date
    Oct 2011
    Location
    Mumbai, India
    Posts
    213

    Default

    Whoops, too late

  4. #14
    Join Date
    May 2012
    Posts
    8

    Default

    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.

  5. #15
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,036

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •