Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: MessageDeliveryException: Dispatcher has no subscribers

  1. #1
    Join Date
    Aug 2007
    Posts
    22

    Default 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. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

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

  3. #3
    Join Date
    Aug 2007
    Posts
    22

    Default

    Quote 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

  4. #4
    Join Date
    Aug 2007
    Posts
    22

    Default

    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.

  5. #5
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    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

  6. #6
    Join Date
    Aug 2007
    Posts
    22

    Default

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

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

  7. #7
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    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).

  8. #8
    Join Date
    Aug 2007
    Posts
    22

    Default

    Hi again, and thanks for the follow up!

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

  9. #9
    Join Date
    Dec 2008
    Posts
    5

    Default Solution for imap-idle-channel-adapter / ImapIdleChannelAdapter -> 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.

  10. #10
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    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

Tags for this Thread

Posting Permissions

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