implydata / wikiticker   0.4

Apache License 2.0 GitHub

Scala wikimedia recent changes stream

Scala versions: 2.11 2.10

wikiticker

This is a Scala library that reads the recent change feeds from Wikimedia's IRC channels.

Usage:

import com.metamx.common.scala.concurrent.loggingThread
import io.imply.wikiticker.IrcTicker
import io.imply.wikiticker.Message
import io.imply.wikiticker.MessageListener

object Example
{
  def main(args: Array[String]) {
    val listener = new MessageListener {
      override def process(message: Message) = {
        println(s"User[${message.user}] edited page[${message.page}] at[${message.timestamp}].")
      }
    }
    val wikipedias = Seq("en", "sv", "de", "nl", "fr")
    val ticker = new IrcTicker(
      "irc.wikimedia.org",
      "ident",
      wikipedias map (x => s"#$x.wikipedia"),
      Seq(listener)
    )
    ticker.start()
    Runtime.getRuntime.addShutdownHook(
      loggingThread {
        ticker.stop()
      }
    )
    Thread.currentThread().join()
  }
}