Created
April 26, 2016 09:38
-
-
Save akirillov/0d697c0ceee34776b795a3103e4bdf17 to your computer and use it in GitHub Desktop.
This file contains 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
object RabbitToRabbitFlow extends App { | |
implicit val actorSystem = ActorSystem("rabbit-akka") | |
implicit val materializer = ActorMaterializer() | |
val config = ConfigFactory.load("application.conf") | |
val sourceConnection = Connection(config.getConfig("source")) | |
val targetConnection = Connection(config.getConfig("target")) | |
val rabbitConsumer = Source.fromPublisher(sourceConnection.consume(config.getString("source.queue_name"))) | |
val rabbitPublisher = Sink.fromSubscriber(toLoggedSubscriber(targetConnection.publish(config.getString("target.exchange")))) | |
rabbitConsumer via deliveryToMessageMapping(config.getString("target.routing_key")) to rabbitPublisher run() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment