java - Spring. How to pass some variable to method in service-activator? -


i newbie in spring, trying understand it. try create rss reader, examples in google overkill , don't understand them. far have beans xml:

<beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"        xmlns:int="http://www.springframework.org/schema/integration"        xmlns:feed="http://www.springframework.org/schema/integration/feed"        xsi:schemalocation="http://www.springframework.org/schema/beans                            http://www.springframework.org/schema/beans/spring-beans.xsd                            http://www.springframework.org/schema/integration                            http://www.springframework.org/schema/integration/spring-integration.xsd                            http://www.springframework.org/schema/integration/feed                            http://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd">      <int:channel id="inputrssfeedchannel"/>      <feed:inbound-channel-adapter id="news"                                   channel="inputrssfeedchannel"                                   url="http://feeds.feedburner.com/techcrunch">         <int:poller fixed-rate="5000"/>     </feed:inbound-channel-adapter>      <int:service-activator input-channel="inputrssfeedchannel"                            ref="rssprintoutservice"                            method="printrss"/>      <bean id="rssprintoutservice" class="myapp.rsshandler"/>  </beans> 

and rsshandler class:

public class rsshandler {     private static final logger thelogger = loggerfactory.getlogger(rsshandler.class);      public void printrss() {         system.out.println("gfgfgfgfgffgfgfg");     }  } 

the code works correct "gfgfgfgfgffgfgfg" every 5 sec. cannot understand how pass variable (rss entry) rsshandler processing title, date , etc , print there?

spring integration passes message comes particular channel handler. can try like:

public class rsshandler {     private static final logger thelogger = loggerfactory.getlogger(rsshandler.class);      public void printrss(message m) { // message object in spring integration packages or in spring core packages depending on version         system.out.println(m);     }  } 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -