Skip to content

Instantly share code, notes, and snippets.

@ianmcmahon
Created February 26, 2013 23:10
Show Gist options
  • Save ianmcmahon/5043228 to your computer and use it in GitHub Desktop.
Save ianmcmahon/5043228 to your computer and use it in GitHub Desktop.
class DestinationSelector extends Actor with ActorLogging with ActorConfig {
def getPublishers(alias:String):List[String] = scala.collection.JavaConversions.asScalaBuffer(config.getStringList(s"rms.destinations.$alias")).toList
def receive = {
case message@RMSMessage(filename, _, alias, _) => {
val publishers = getPublishers(alias.toLowerCase)
publishers map (p => config.getString(s"rms.publishers.$p.type") match {
case "lsd" => {
val host = config.getString(s"rms.publishers.$p.host")
val domain = config.getString(s"rms.publishers.$p.domain")
sender ! LSDDistributable(message, s"http://$host/$domain/$filename")
}
case x => log.warning(s"Destination `$alias`, publisher `$p`, has unsupported type `$x`. Ignoring.")
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment