Announcement Announcement Module
Collapse
No announcement yet.
using int:gateway with an interface having methods with multiple parameters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • using int:gateway with an interface having methods with multiple parameters

    Hi

    I have an interface like this
    Code:
    package com.me.mystuff;
    interface Appender
    {
    
      public String append(String s1,String s2,String s3)
    
    
    }
    I want to invoke this interface's impl using int:gateway

    My int:gateway config is some thing like this :
    Code:
    <int:gateway  id="appenderService" service-interface="com.me.mystuff.Appender"    default-request-channel="someChannel" >
    		<int:method name="append"  > 
    			<int:header name="header1" value="somthing"/>
    			<int:header name="header2" value="someOtherThing"/>
    		</int:method>		
    	</int:gateway>
    When i invoke this gateway i get the following exception

    Code:
    Caused by: org.springframework.integration.support.converter.MessageConversionException: failed to convert object to Message
            at org.springframework.integration.support.converter.SimpleMessageConverter.toMessage(SimpleMessageConverter.java:69)
            at org.springframework.integration.core.MessagingTemplate.convertSendAndReceive(MessagingTemplate.java:272)
            at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:224)
            at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:203)
            at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:305)
            at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:268)
            at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:259)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
            at $Proxy19.getWidgets(Unknown Source)
    ....
    
    Caused by: org.springframework.integration.MessagingException: At most one parameter (or expression via method-level @Payload) may be mapped to the payload or Message. Found more than one on method [public abstract java.lang.String com.me.mystuff.Appender.append(java.lang.String,java.lang.String,java.lang.String) 
       at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.throwExceptionForMultipleMessageOrPayloadParameters(GatewayMethodInboundMessageMapper.java:254)
            at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.mapArgumentsToMessage(GatewayMethodInboundMessageMapper.java:184)
            at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:122)
            at org.springframework.integration.gateway.GatewayMethodInboundMessageMapper.toMessage(GatewayMethodInboundMessageMapper.java:71)
            at org.springframework.integration.support.converter.SimpleMessageConverter.toMessage(SimpleMessageConverter.java:66)
    How can i deal with it?
    I dont want the calling code to still stick to the com.me.mystuff.Appender interface and not create messages on their own.



    Regads,
    Madhu

  • #2
    May be is there a good payload-expression which i can use in the method tag?

    Comment


    • #3
      Please see the reference manual...

      Code:
      package com.me.mystuff;
      interface Appender
      {
      
        public String append(String s1, @Header("header1") String s2, @Header("header2") String s3)
      
      
      }

      Comment

      Working...
      X