Results 1 to 9 of 9

Thread: integration feed - startup

  1. #1
    Join Date
    Oct 2009
    Location
    Minneapolis, MN
    Posts
    137

    Question integration feed - startup

    Hello,

    This might have been asked before but didnt find any reference. I have a feed integration which needs to start polling after my application context finishes loading. Is there a way to start this polling after the application start up ? i know i could increase the poller time a bit but looking for other options

    Thanks
    srinivas

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Are you talking about feed as RSS/ATOM feed?

  3. #3
    Join Date
    Oct 2009
    Location
    Minneapolis, MN
    Posts
    137

    Default

    yes feed:inbound-channel-adapter

    This fires up before my application server is fully up. Probably this is the case for all inbound-channel-adapter's as well, but think it will be nice to delay the polling until the Application context is fully started/ loaded and your web application is up and running.

  4. #4
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Yeah, its simple. Set auto-startup to 'false'
    Code:
    <int-feed:inbound-channel-adapter id="feedAdapter" 
    			channel="feedChannel" 
    			auto-startup="false" 
    			url="http://rss.cnn.com/rss/cnn_topstories.rss">
    	<int:poller fixed-rate="10000" max-messages-per-poll="100" />
    </int-feed:inbound-channel-adapter>
    And then the code you can do this:
    Code:
    SourcePollingChannelAdapter spca = ac.getBean("feedAdapter", SourcePollingChannelAdapter.class);
    spca.start();

  5. #5
    Join Date
    Oct 2009
    Location
    Minneapolis, MN
    Posts
    137

    Default

    Have seen the auto-startup flag i can turn off i understand. The concern is somewhere i need to write the code to manually start this channel back maybe via custom context listener, so im wondering if springs application context can do it for me? instead after it finishes loading.

    trying to avoid to manually invoke and achieve the same via another parameter or configuration?

    Thanks

  6. #6
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    I guess I am not following. start method is executed right before AC is returned to you. It is the last step in the lifecycle, so I am not sure what you mean when you say it is started before AC is loaded. Can you elaborate?

  7. #7
    Join Date
    Oct 2009
    Location
    Minneapolis, MN
    Posts
    137

    Default

    Maybe peculiar case,

    I have a RSS feed being published in the same webapp where my integration is also running so the feed inbound channel adaptor is configured to this same url. Because i'm just starting my tomcat server the webapp URL is not accessible immediately during start up but the channel is started before my webapp is ready and throws Null pointers,


    Does this help ?

  8. #8
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Are they both in the same context or do you have a root context (via ContextLoaderListener) and a separate servlet-context (via DispatcherServlet)?

  9. #9
    Join Date
    Oct 2009
    Location
    Minneapolis, MN
    Posts
    137

    Default

    Both are loaded in the same application context (im assuming) , the publisher is simple @controller serving rss feed and i have the integration file imported in the same applicationcontext.
    There is only one context if im not missing something.

Posting Permissions

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