Getting bytes of string more elegantly

cat-town
Dan Buch 12 years ago
parent 374c5e03fa
commit b8a0654107

@ -14,9 +14,8 @@ object HelloWorldProducer extends App {
channel.exchangeDeclare("hello-exchange", "direct", true)
channel.queueDeclare("hello-queue", false, false, false, null)
println("Publishing ", messageBody)
channel.basicPublish("hello-exchange", "hola", null,
messageBody.toCharArray().map(_.toByte))
printf("Publishing '%s'\n", messageBody)
channel.basicPublish("hello-exchange", "hola", null, messageBody.getBytes())
connection.close()
}

Loading…
Cancel
Save