David Moreno García
David Moreno García

Reputation: 4523

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?

Upvotes: 0

Views: 579

Answers (1)

David
David

Reputation: 20063

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.

Upvotes: 1

Related Questions