Announcement Announcement Module
Collapse
No announcement yet.
Channel / user / feed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Channel / user / feed

    Hi,

    I'm trying to make an example of spring MVC+security+integration app to evaluate if it could fulfill the needs of a real project. I had never use spring integration, I tried to read everything around but I'm still a bit lost
    This app will integrate many external services such as web services, feeds, files, email...etc. Some of these resources are user-dependent (i.e. a webservice method that has the userid as parameter) some others are not (i.e. a rss feed).
    For this example I'm trying to use a webservice as an user-dependent service and feeds as a not user-dependent services so when a user sin-in, subscribe to some feeds and configure 'the calls' to the webservice he will browse the info returned by his webservice and every feed he subscribed.
    To do so, I think I will need a channel for every feed on my database (every feed a user has subscribed to) and a channel for user to poll his own webservice. To accomplish the web service part I think I could do something like the dynamic-ftp sample so I had child context for every user that polls his webservice (http://forum.springsource.org/showth...ers-at-runtime) but I don't know how to 'connect' the user to his feeds. Maybe I need a channel for every user where his webservice channel and his feeds channels write but I don't know how could I do this...second child?
    could someone point me to the right direction plz

    PS: Sry for my english, not my mother tongue

  • #2
    No, you can use something similar to the channel resolver in the dynamic FTP sample; Spring Security will bind the user's Principal and you can access it and use it to determine where to send the message(s).

    Comment


    • #3
      Thanks I got it working but in order to check the feed for new entries when user click the feed I have to close and recreate the context for that particular feed and I think thats very 'expensive'. I'm doing that because I wasnt able to find any better way... I thought about a custom trigger but no luck according to documentation 7.1.5 Change Polling Rate at Runtime: 'It is not possible to force a trigger to fire before it's currently configured next execution time.'
      so, Is there any other way to trigger the poll?

      PS: Sorry for the late reply, busy days

      Comment


      • #4
        Hi!
        Is there any other way to trigger the poll?
        If you want to trigger manually, there is no reason to configure polling endpoint.
        It's just enough configure MessageSource as generic bean and invoke its receive() when it is necessary.

        HTH,
        Artem

        Comment


        • #5
          Hi,

          I want to do both, manually and automatic, more in depth I would like to configure a default long poll for a feed in order to send notifications and try to fetch new elements every time a user navigate to that feed and that feed was not refreshed by the long poll or other user on some configured minimum time.
          Now I'm doing a context refresh after check my metadata store to re-instantiate its beans and it's working ok but I was looking for a more efficient way...
          Anyway, your solution could be the right choice but, how would you pull out FeedEntryMessageSource from the SourcePollingChannelAdapter?

          Thanks!

          Comment


          • #6
            You can stop and start the adapter; this will effectively cancel the current poller (trigger) and start another one.

            Or, for Artem's solution, just programmatically create the MessageSource, call receive() when you want to and send() the result (if any) to a MessageChannel.

            Comment


            • #7
              you pull out FeedEntryMessageSource from the SourcePollingChannelAdapter?
              I said it: invoke its MessageSource.receive().
              I want to do both,
              We have a recent JIRA regarding it: https://jira.springsource.org/browse/INT-3044.
              So, you would be able just configure <inbound-channel-adapter> with some <poller> and when you need to poll manually you'll just need to call MessageSource directly:
              HTML Code:
              <feed:inbound-channel-adapter id="feedAdapter" channel="processFeedChannel">
                  <poller fixed-delay="10000"/>
              </feed:inbound-channel-adapter>
              
              <service-activator input-channel="pullFeedChannel" output-channel="processFeedChannel"
                 expression="@'feedAdapter.source'.receive()"/>
              So, you can vote that JIRA and we'll take care of it soon.

              But for now you should configure FeedEntryMessageSource as a bean separately, maybe with the same properties as feed adapter and call similar:
              HTML Code:
              <service-activator input-channel="pullFeedChannel" output-channel="processFeedChannel"
                 expression="@feedMessageSource.receive()"/>

              Comment


              • #8
                Originally posted by Gary Russell View Post
                You can stop and start the adapter; this will effectively cancel the current poller (trigger) and start another one.
                already tried that but start will not trigger the poll, maybe just reset the poller?

                Originally posted by Cleric View Post
                I said it: invoke its MessageSource.receive().
                I did not get it before, I thought you was talking about the inner FeedEntryMessageSource that is already instantiate, sry...

                Originally posted by Cleric View Post
                you can vote that JIRA and we'll take care of it soon.
                Nice, voted

                Ok, so I will stick with context.refresh for now on development and wait for that new functionality to get ready

                Thank you both!!

                Comment


                • #9
                  ...tried that but start will not trigger the poll,...
                  Stopping and restarting the trigger (after reconfiguring with the new requirements) should work.

                  There's an example here.

                  Comment

                  Working...
                  X