Getting bytes of string more elegantly
This commit is contained in:
parent
374c5e03fa
commit
b8a0654107
@ -14,9 +14,8 @@ object HelloWorldProducer extends App {
|
|||||||
channel.exchangeDeclare("hello-exchange", "direct", true)
|
channel.exchangeDeclare("hello-exchange", "direct", true)
|
||||||
channel.queueDeclare("hello-queue", false, false, false, null)
|
channel.queueDeclare("hello-queue", false, false, false, null)
|
||||||
|
|
||||||
println("Publishing ", messageBody)
|
printf("Publishing '%s'\n", messageBody)
|
||||||
channel.basicPublish("hello-exchange", "hola", null,
|
channel.basicPublish("hello-exchange", "hola", null, messageBody.getBytes())
|
||||||
messageBody.toCharArray().map(_.toByte))
|
|
||||||
|
|
||||||
connection.close()
|
connection.close()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user