简体   繁体   中英

Fetch tweets using Twitter4J in Spring

I'm interested in use Twitter4J to fetch tweets from Twitter streaming API. This library would be used from a Spring class annotated with @Service and would received updates in a StatusListener to store it in a DB later. My question is, would I stop other actions while receiving updates or users would be able to interact with the website?

Users should still be able to use the website. You could do the twitter4j parsing in a bean with scope marked as prototype so it wouldn't be a singleton and therefore wouldn't create any threading issues with other users logged into the system if it was marked as @Service.

Remember, Spring beans are singletons by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM