Results 1 to 3 of 3

Thread: TestNG Test with SimpleMessagingGateway

  1. #1
    Join Date
    Aug 2007
    Posts
    138

    Default TestNG Test with SimpleMessagingGateway

    I am using Spring Integration along with JAXB and Spring-WS to make a pretty straightforward synchronous web service call, and I have written a TestNG test to see if my efforts have worked. My logging is showing that the messages have the expected payloads throughout the chain and that the right answers are being returned by the web service. However, at the end I am getting an exception: "MessageDeliveryException: Dispatcher has no subscribers."

    Here is the test code:

    Code:
          ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
          ChannelResolver channelResolver = new BeanFactoryChannelResolver(context);
          MessageChannel requestChannel = channelResolver.resolveChannelName("clientAuthenticationRequestChannel");
          MessageChannel replyChannel = channelResolver.resolveChannelName("clientAuthenticationResponseChannel");
          Credentials credentials = new Credentials("foo", "bar");
    
          SimpleMessagingGateway gateway = new SimpleMessagingGateway();
          gateway.setRequestChannel(requestChannel);
          gateway.setReplyChannel(replyChannel);
          Object obj = gateway.sendAndReceive(credentials);
    Here is the relevant portion of the configuration:

    Code:
       <chain id="authenticationChain" input-channel="clientAuthenticationRequestChannel" output-channel="clientAuthenticationResponseChannel">
            <transformer id="requestTransformer"
                         ref="authenticationRequestTransformerBean" method="transform"/>
            <ws:outbound-gateway id="authenticationWebServiceGateway"
                                 uri="http://myapp.com:9101/axis/services/WSv1"
                                 marshaller="marshaller"
                                 unmarshaller="marshaller"
                                 message-factory="messageFactory"/>
            <transformer id="responseTransformer"
                         ref="authenticationResponseTransformerBean" method="transform"/>
        </chain>
    Finally, here is the full exception:

    Code:
    org.springframework.integration.message.MessageDeliveryException: Dispatcher has no subscribers.
    	at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:39)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
    	at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:221)
    	at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:115)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:48)
    	at org.springframework.integration.dispatcher.AbstractDispatcher.sendMessageToHandler(AbstractDispatcher.java:75)
    	at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:45)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
    	at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:221)
    	at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:115)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:48)
    	at org.springframework.integration.dispatcher.AbstractDispatcher.sendMessageToHandler(AbstractDispatcher.java:75)
    	at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:45)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
    	at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:221)
    	at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:115)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:48)
    	at org.springframework.integration.handler.MessageHandlerChain.handleMessage(MessageHandlerChain.java:69)
    	at org.springframework.integration.dispatcher.AbstractDispatcher.sendMessageToHandler(AbstractDispatcher.java:75)
    	at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:45)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:94)
    	at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:222)
    	at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179)
    	at org.springframework.integration.gateway.AbstractMessagingGateway.send(AbstractMessagingGateway.java:114)
    	at com.myapp.integration.authentication.test.AuthenticationTest.testSuccessfulAuthentication(AuthenticationTest.java:53)
    I should point out also that for kicks I tried adding an outbound-channel-adapter that takes the clientAuthenticationResponseChannel as an input channel. When I do that, I get no exception, but the test just hangs.

    I would love some insight into why my test is failing and what I need to change so that the SimpleMessagingGateway can receive the output from the web service.

    Thanks, and Happy Holidays.

  2. #2
    Join Date
    Oct 2007
    Location
    London, England
    Posts
    108

    Default

    If you are using 1.0.0 then this may be related to INT-507. The solution for which would be to call afterPropertiesSet() on your gateway or move to 1.0.1
    Jonas Partner
    OpenCredo

  3. #3
    Join Date
    Aug 2007
    Posts
    138

    Default

    That was it exactly. Both solutions work, and I am now a satisfied user of SI 1.0.1.

    Thanks very much, Jonas.

Posting Permissions

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