Announcement Announcement Module
Collapse
No announcement yet.
no pollable reply channel has been configured Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • no pollable reply channel has been configured

    Hi,

    I'm trying to invoke web-service through spring integration

    public Name getNames();

    But the problem is java.lang.IllegalStateException: receive is not supported, because no pollable reply channel has been configured

    In the xml,

    <gateway id="wsgateway" service-interface="com.company.project.integration.WSGatew ay"
    default-request-channel="input_channel"
    default-reply-channel="output_channel" />

    <channel id="output_channel" />
    <channel id="input_channel" />

    <ws:outbound-gateway id="externalws"
    request-channel="input_channel" reply-channel="output_channel"
    uri="${wsurl}" marshaller="marshaller" unmarshaller="marshaller"
    message-factory="messageFactory" />

    <beans:bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory">
    <beans: property name="messageFactory">
    <beans:bean class="com.sun.xml.internal.messaging.saaj.soap.ve r1_1.SOAPMessageFactory1_1Impl">
    </beans:bean>
    </beans: property>
    </beans:bean>

    <beans:bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <beans: property name="contextPaths">
    <beans:array>
    <beans:value>com.company.ws.integration.clientob j</beans:value>
    </beans:array>
    </beans: property>
    </beans:bean>


    My question if there is no input, what should be proper channel tag required?

    can someone from integration team address this, out there for quiet a long?
    - Thanks
    Last edited by techie; Mar 23rd, 2011, 11:44 AM.

  • #2
    Has anyone come up with the solution for this?

    Comment


    • #3
      Not sure i understand the question, but you may want to start with sample which does invoke WS via SI http://git.springsource.org/spring-i...tbound-gateway

      Comment


      • #4
        I have two subsystems that I am trying to integrate using spring integration. The idea is that these subsystems may or may not be in the same VM or even on the same machine. By using spring integration, I should be able to change out the communication mechanism (in memory, jms, etc.) without changing the core functionality. Part of the inter-subsystem communication requires one to ask the other for information. The request method often times a no-arg method. I've tried to simulate that behavior in the example below. Basically, it's a gateway on one end and a service-activator on the other end with a client that calls the get() method through the gateway.

        Here is my example:

        <integration:channel id="request"/>
        <integration:channel id="reply"/>

        <integration:gateway id="artifactProvider" service-interface="ArtifactProvider">
        <integration:method name="getArtifact" request-channel="request" reply-channel="reply"/>
        </integration:gateway>

        <integration:service-activator input-channel="request" output-channel="reply" ref="artifactManager" method="getArtifact"/>
        <bean id="artifactManager" class="ArtifactManager"/>


        public interface ArtifactProvider
        {
        Object getArtifact();
        }

        public class ArtifactManager implements ArtifactProvider
        {

        public Object getArtifact()
        {
        return "this is the artifact";
        }
        }

        public class TestApp
        {
        public static void main(String[] args)
        {
        String[] files = new String[] {"artifact-provider-config.xml"};
        ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(files);
        ArtifactProvider artifactMgr = (ArtifactProvider)appContext.getBean("artifactProv ider");
        System.out.println("Artifact:" + artifactMgr.getArtifact());
        }
        }

        Results:
        Exception in thread "main" java.lang.IllegalStateException: receive is not supported, because no pollable reply channel has been configured
        at org.springframework.util.Assert.state(Assert.java: 384)
        at org.springframework.integration.gateway.MessagingG atewaySupport.receive(MessagingGatewaySupport.java :197)
        at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invokeGatewayMethod(GatewayProxyFact oryBean.java:294)
        at org.springframework.integration.gateway.GatewayPro xyFactoryBean.doInvoke(GatewayProxyFactoryBean.jav a:269)
        at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invoke(GatewayProxyFactoryBean.java: 260)
        at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
        at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy0.getArtifact(Unknown Source)
        at TestApp.main(TestApp.java:12)

        Comment


        • #5
          You have a method on the Gateway that takes no arguments. This means that you are attempting to poll a Message from the channel (not send message to the channel - think reverse). This means that the request-channel must be Pollable Channel (QueueChannel)
          Code:
          <integration:channel id="request">
               <integration:queue/>
          </integration:channe>

          Comment


          • #6
            Made the changes and get the same error. I guess I don't understand why I need to poll in this situation. I want my gateway to trigger a service-activator. If I add an argument to the method, everything works fine. I don't understand why the presence or omission of a message's payload would cause me to have to change the communication structure between the two sides.

            Here is my modified configuration:

            <integrationoller id="poller" fixed-rate="1000" default="true"/>

            <integration:channel id="request">
            <integration:queue/>
            </integration:channel>
            <integration:channel id="reply">
            </integration:channel>

            <integration:gateway id="artifactProvider"
            service-interface="com.pb.spectrum.test.spring_integration _test.sample.ArtifactProvider">
            <integration:method name="getArtifact"
            request-channel="request"
            reply-channel="reply"/>
            </integration:gateway>

            <integration:service-activator input-channel="request" output-channel="reply" ref="artifactManager" method="getArtifact"/>
            <bean id="artifactManager" class="com.pb.spectrum.test.spring_integration_tes t.sample.ArtifactManager"/>

            Comment


            • #7
              Any solution to this type of problem?

              Comment


              • #8
                I have not gotten an answer as to how to handle this situation.

                Comment


                • #9
                  Sorry, but some times its hard to keep track, but we do want to help.
                  Could you possibly create a standalone sample that you can zip up and attach to this forum? I know you have provided a lot of details, but the reproducible sample would give some starting point.

                  Comment


                  • #10
                    Test Application

                    I've included a sample test app that demonstrates what I am trying to do. I've included in the sample, a call to a method with a param (this works) and a call to one with no params (this doesn't work).

                    I'm really looking for a couple of things. First, I'd just like to understand why the communication mechanism needs to change between caller/callee when a method has a parameter vs when it doesn't. And second, based on the answer to the first, how do I get a no-param method to work. In my scenario, the caller needs to initiate the communication vs. being able to poll and react.

                    I am more than happy to provide any other information you may need. Thank you for the support you have provided.

                    Comment


                    • #11
                      Any word on a strategy for this?

                      Comment


                      • #12
                        We probably have to update documentation explaining this rare case but here is the scoop.


                        When gateway method has no parameters, it simply means that you will be receiving messages instead of sending or sending and receiving.
                        Look at it this way; Messaging Gateway by definition is an entry point to the Messaging system. Interaction with the Messaging system could exist at 3 levels and SI gateway simply supports all 3.
                        1. Send only:
                        public void foo(Object whatever);

                        2. Send and Receive:
                        public Object foo(Object whatever);

                        3. Receive only:
                        public Object foo();

                        So all you need to do is to change configuration a bit
                        Code:
                        <integration:gateway id="artifactProvider" 
                                               service-interface="test.ArtifactProvider">
                            <integration:method name="getArtifact" reply-channel="request.noparam"/>
                        . . .
                        Note that I only have a reply channel. Request channel is meaningless in this case since there is no request. The reply channel is also a pollable channel.

                        In your code send a message to this channel before executing getArtifact() method

                        Code:
                        MessageChannel channel = appContext.getBean("request.noparam", MessageChannel.class);
                            channel.send(new GenericMessage<String>("hello"));
                            System.out.println("Received: " + provider.getArtifact());
                        Hope that explains
                        Last edited by oleg.zhurakousky; Aug 30th, 2011, 06:12 AM.

                        Comment


                        • #13
                          I have a question. If I use the "Receive only", how can I guarantee that I receive the correct message?

                          For example, if I have a method called "public String getSession();" and it returns a session string thats bound to the current connecting client, how can I make sure that I dont receive a message intended for someone elses client, for example if 20 people make a function call to getSession at the same time?

                          Comment


                          • #14
                            I am not sure I understand the comment about current client etc.... All you are doing is receiving the next Message from the Queue. It seems to me you are implying some state awareness which contradicts one of the core concept of Messaging architecture - stateless architecture. The only component that contains any state is Message itself (not endpoints)

                            Comment


                            • #15
                              To explain my predicament and what I was initially trying to do is the following.

                              Have a Bean that creates a session token based on some knowledge of the connecting client. This bean is the SessionManager.

                              On the LoginManager I make a function call createNewSession() through an interface ISessionManager (which the gateway is mimic'ing). I am expecting a reply with my session token, but no arguments are required to be sent
                              as the client stuff is handled somewhat invisibly.

                              I don't see why I am not allowed to do this, because by breaking the function call out and seperating it into a message transaction, I can then perform aspect oriented programming procedures on the message itself.

                              Comment

                              Working...
                              X