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

  • 'Dispatcher has no subscribers'

    At work I am getting this error intermittently. I have designed a simple test case the same as the one I am using at work. For some reason it was working and then for no reason I can fathom it started failing with 'Dispatcher has no subscribers' . The only thing I can think is that something is being brought up in the wrong order. Here is the test

    JaxB annotated object with getters setters etc omitted

    @XmlRootElement(name = "object")
    public class MyObject implements Serializable{
    	private static final long serialVersionUID = -5373141442895674583L;
    	private String value1;
    	private String value2;
    Annotated Service taking the object as a parameter

    public class MyService {
    	public void myMethod (MyObject val){
    The test case which should output hello world

    @ContextConfiguration(locations = {"classpath:/jms-test-int.xml"})
    public class MyServiceTest {
    	private MessageChannel toJMS;
    	public void test() {
    		MessagingTemplate template = new MessagingTemplate();
    		template.convertAndSend(toJMS, new MyObject("hello", "world"));
    Lastly the configuration

    <beans xmlns=""
    	<int:channel id="toJMS"/>
    	<int-jms:outbound-channel-adapter channel="toJMS" destination-name="com.sample.jms" message-converter="marshallingMessageConverter"/>
    	<int-jms:message-driven-channel-adapter channel="fromJMS" destination-name="com.sample.jms" message-converter="marshallingMessageConverter"/>
    	<int:channel id="fromJMS" />
    	<int:service-activator input-channel="fromJMS" ref="myService"/>
    	<bean id="myService" class="com.sample.jms.MyService"/>
    	<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    		<property name="brokerURL" value="vm://localhost"/>
    	<bean id="marshallingMessageConverter" class="">
    		<property name="unmarshaller" ref="jaxbMarshaller" />
    		<property name="marshaller" ref="jaxbMarshaller" />
    	<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller" >
    		<property name="packagesToScan">
    Now I have not been able to reproduce this error here on my home pc (powerful linux box) but on my slower Windows XP machine at work it is failing intermittently. When I left today it was failing consistently until I removed the message-converters and just changed the service activator to take a string argument. Has anyone run into this before?


  • #2
    Ok. So I am back at work there is one difference I also have a

    <int:annotation-config />
    but I can't see why that would make a difference. I just ran this test case 5 times. 2 times it worked, 1 time it was green bar with no output and 2 times it failed with a 'Dispatcher has no subscribers' error. This is just strange to me, does the context need to be refreshed somehow after fully initializing the JMS stuff before the test case uses it? Am I missing something?


    • #3
      Dug around the forums here and found some info on how to get some better debugging going

      It looks like the framework is stopping everything and it removes the service-activator as a subscriber and then immediately after there is a preSend to the channel that the service-activator was subscribed to and this is what is causing the error


      • #4
        Ok, this is resolved. I was being stupid and forgot about the asynchronous aspect. The test case was ending before my message arrived. Basically I took the advice in the new Spring Integration in Action book and used a countdown latch to make sure I am waiting long enough before making my assertions.