Created
February 26, 2013 23:10
-
-
Save ianmcmahon/5043228 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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