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

  • MessageDeliveryException: Dispatcher has no subscribers

    Hi,

    I am getting an error message when using the imap-idle-channel-adapter.

    I am getting this error message:

    Code:
    DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - received 15 mail messages
    DEBUG: org.springframework.integration.channel.DirectChannel - preSend on channel 'mailInputChannel', message: [Payload=javax.mail.internet.MimeMessage@922804][Headers={springintegration_id=74a7e293-7255-4ceb-adff-0f87be7f1753, springintegration_timestamp=1257936337453}]
    Exception in thread "SimpleAsyncTaskExecutor-1" org.springframework.integration.message.MessageDeliveryException: Dispatcher has no subscribers.
                    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:97)
                    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:90)
                    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:43)
                    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)
                    at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:51)
                    at org.springframework.integration.mail.ImapIdleChannelAdapter.access$2(ImapIdleChannelAdapter.java:1)
                    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:125)
                    at java.lang.Thread.run(Thread.java:595)
    As far as I know the error message says that nothing listens on the mailInputChannel, but I canīt find the error.

    My configuration:

    Code:
    <si-mail:imap-idle-channel-adapter id="mailin"
                                   store-uri="imap://*** imap uri here ***" channel="mailInputChannel" should-delete-messages="false"
                                   java-mail-properties="mailProperties"/>
     
                    <util:properties id="mailProperties">
                                   <beans:prop key="mail.debug">true</beans:prop>
                    </util:properties>
     
                    <si:channel id="mailInputChannel" />
     
                    <si:service-activator input-channel="mailInputChannel" method="handleMessage">
                                   <beans:bean class="org.test.activator.mail.MailServiceActivator" />
                    </si:service-activator>
    Service Activator:

    Code:
    public class MailServiceActivator {
     
        public void handleMessage(MimeMessage message) {
            logger.debug("Activator called with message: " + message);
        }
    }
    Test:

    Code:
    public class MailIntegration {
       
        public static void main(String[] args) {
            AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[]{"/integration-mail-beans.xml"}, MailIntegration.class);
            applicationContext.stop();
        }
    }
    When I run the code without the imap-adapter all works fine. The service activator reads messages from the mailInputChannel.

    I have tried with annotations and without annotations, but without luck.

    I am using Spring Integration 1.0.3-RELEASE.

    Any pointers?

  • #2
    Are you sure you have nothing else configured?
    I just ran your config and it works just fine.
    Oleg

    Comment


    • #3
      Originally posted by oleg.zhurakousky View Post
      Are you sure you have nothing else configured?
      I just ran your config and it works just fine.
      Oleg
      Ok, thanks!
      I don`t think that I have anything else configured. I`ll check.

      Kurt

      Comment


      • #4
        I have tested with a clean project now and I still experience the same error message. I have also checked that I am using the required dependencies for spring integration 1.0.3.RELEASE. It's a puzzle

        I will try the 2.0 Milestone release.

        Comment


        • #5
          It might be related to this issue that was resolved in 2.0 M1:
          http://jira.springframework.org/browse/INT-845

          If not, then we need to take a look at it, since that same issue could apply here (ordering of startup) even though the imap-idle adapter is itself event-driven.

          Please let us know if it works ok with 2.0 M1, and if not, can you please open a new issue?

          Thanks,
          Mark

          Comment


          • #6
            It does not work with 2.0 M1 either. I get the same error message.

            Issue opened: http://jira.springframework.org/browse/INT-884

            Comment


            • #7
              Thank you.

              By the way, as a workaround you should be able to set auto-startup="false" on the adapter, and then start() it manually in some code that is invoked later (e.g. a custom ApplicationListener reacting to a ContextRefreshedEvent should do the trick).

              Comment


              • #8
                Hi again, and thanks for the follow up!

                It works after I added the custom ApplicationListener and removed stop() from the test code.

                Comment


                • #9
                  Solution for imap-idle-channel-adapter / ImapIdleChannelAdapter -&gt; no subscribers

                  Code:
                  public class MailIntegration {
                     
                      public static void main(String[] args) {
                          AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[]{"/integration-mail-beans.xml"}, MailIntegration.class);
                          applicationContext.stop();
                      }
                  }
                  The only thing that needs to be done in order to run this example is:

                  REMOVE THE "applicationContext.stop()" because in that point you are loosing all references to the pre instantiated beans (handlers) therefore
                  Dispatcher has no subscribers.
                  . All handlers are already null when the message event happens.

                  Comment


                  • #10
                    Kurt,

                    Can you please try this with the *trunk* version? We're now relying on some enhancements to the lifecycle processing in Spring 3.0 which includes ordered shutdown. I would like to know if that may have resolved the issue.

                    Thanks,
                    Mark

                    Comment


                    • #11
                      Still a problem in 2.1

                      I am experiencing the same problem in 2.1. I have a jms-channel at the end of my intergration and In order to not get the above described error I need to set auto-startup="false" and start it from within code.

                      Comment


                      • #12
                        Cn you post your configuration? The problem is in your configuration. You have a DirectChannel that has no subscribers

                        Comment


                        • #13
                          Actually, since you stated this occurs with a JMS channel, and that you can avoid it by setting auto-startup to false, it's likely similar but not the same as the DirectChannel case Oleg mentions. The similarity lies in the fact that a JMS channel also has its own dispatcher.

                          My first question would be, based on your statement that the JMS channel is at the *end* of your flow, is it only intended to be the last component in the flow? If so, I think you'd be better off using a JMS outbound-channel-adapter.

                          Hope that helps,
                          Mark

                          Comment


                          • #14
                            Your right - The JMS channel (Publish/Subscribe) is at the end of the flow. I did add inn a subscriber, and then auto-start="true" worked. Before adding in a subscriber I had to start it up after the other channels had started.

                            By the way I am doing a project based on the ClusterController stuff that Oleg showed at the SpringOne in Chicago last fall.

                            Comment


                            • #15
                              ClusterController? That's cool but i think you meant Gary and Dave (the two guys who demonstrated that)

                              Comment

                              Working...
                              X