Skip to content

implydata/wikiticker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()
  }
}