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.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…
Reference in New Issue
Block a user