Announcement Announcement Module
Collapse
No announcement yet.
Dispatcher has no subscriber exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dispatcher has no subscriber exception

    Hello all,
    i am writing a small app to learn spring-integration.
    here's my config.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:si="http://www.springframework.org/schema/integration"
    	xmlns:file="http://www.springframework.org/schema/integration/file"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans.xsd
                http://www.springframework.org/schema/integration
                http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
                http://www.springframework.org/schema/integration/file
                http://www.springframework.org/schema/integration/file/spring-integration-file-1.0.xsd">
    
    
    	<si:channel id="input"/>
    
    	<si:channel id="output">
    	</si:channel>
    
    	<si:gateway id="gateway" 
    		service-interface="com.sample.services.SimpleGateway" 
    		default-request-channel="input"/>
    	
    	<si:outbound-channel-adapter channel="output" ref="outputChannelAdapter" method="log" />
        
    	<bean id="outputChannelAdapter" class="com.sample.services.OutputChannelAdapter"/>
    	
    </beans>
    here's my Bootstrapper code..
    Code:
    package com.sample.bootstrap;
    
    
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    import org.springframework.integration.channel.PollableChannel;
    import org.springframework.integration.core.Message;
    import org.springframework.integration.core.MessageChannel;
    import org.springframework.integration.message.StringMessage;
    
    import com.sample.services.Shouter;
    import com.sample.services.SimpleGateway;
    
    public class Bootstrap {
    
        public static void main(String[] args) {
        	System.out.println("Starting bootstrapper....");
        	ApplicationContext context = new ClassPathXmlApplicationContext("config.xml");
        	SimpleGateway gateway = (SimpleGateway) context.getBean("gateway");
        	
        	//PollableChannel output = (PollableChannel) context.getBean("output");
            
        	MessageChannel input = (MessageChannel) context.getBean("input");
        	
        	for(int i = 0; i < 6; i++)
            {
        		System.out.println("-- sending ...");
            	gateway.send("[" + i + "]Spring Integration rocks");
            	
            }
        }
    
    }
    what i am trying ot achieve is to post a message on a channel and have some bean listening to it....

    I am currently using spring-intergration-1.0.3, and when i run my Bootstrap i am getting following exception

    Code:
    Exception in thread "main" org.springframework.integration.message.MessageDeliveryException: Dispatcher has no subscribers.
    	at org.springframework.integration.dispatcher.AbstractUnicastDispatcher.dispatch(AbstractUnicastDispatcher.java:49)
    	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:223)
    	at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:180)

    Additionally, i am having problems with file:outbound-channel-adapter (it cannot find the directory where i want to store files)

    are those problems known issues for spring-integ 1.0.3?

    regards
    marco

  • #2
    Well it is all in your configuration.

    Your gateway is posting to the input channel, but nothing is listening on that. Your outbound-channel-adapter is listening in the output channel, which receives nothing. Endpoints are connected through their channels in your case there is no connection.

    Comment


    • #3
      Thankx martin

      Comment


      • #4
        To fix it add <bridge input-channel="input" output-channel="output"/>, or hook your outbound-channel-adapter directly to the "input" channel.

        Comment

        Working...
        X