Generate a feed of social network status messages as Akka stream.
Add the dependency to your SBT build file:
libraryDependencies += "ch.becompany" %% "akka-social-stream" % "0.1.1"
Declare a Feed
for Twitter tweets, GitHub events and Facebook page events, including the latest 10 messages:
val updateInterval = 5 minutes
val feed = Feed(
"twitter" -> new TwitterFeed("my_screen_name", updateInterval),
"github" -> new GithubFeed("my_github_organization", updateInterval)
"facebook" -> new FacebookFeed("my_facebook_page_id", updateInterval)
)(10)
The parameters are the ID for the feed provider and the updateInterval as FiniteDuration
. The updateInterval parameter is optional and by default the maximum allowed rate per provider is configured. Values that result in a higher update rate than the allowed by the providers are silently ignored.
Subscribe to the stream of status messages (see Status
class for details):
feed.subscribe.runForeach { case (network, date, status) =>
println(s"Status update on $network by ${status.author.name}")
}