Declaring queue properly, but now it would appear we're blocking...
This commit is contained in:
parent
ce29df17cb
commit
dda8e8cb85
@ -1,18 +1,18 @@
|
|||||||
import com.rabbitmq.client._
|
import com.rabbitmq.client._
|
||||||
|
|
||||||
object Producer extends App {
|
object HelloWorldProducer extends App {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
println("You must provide a message argument")
|
println("You must provide a message argument")
|
||||||
} else {
|
} else {
|
||||||
var messageBody = args(0)
|
var messageBody = args(0)
|
||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
factory.setUri("amqp://guest:guest@localhost:5672")
|
factory.setUri("amqp://guest:guest@localhost:5672")
|
||||||
var connection = factory.newConnection()
|
var connection = factory.newConnection()
|
||||||
var channel = connection.createChannel()
|
var channel = connection.createChannel()
|
||||||
|
|
||||||
channel.exchangeDeclare("hello-exchange", "direct", true)
|
channel.exchangeDeclare("hello-exchange", "direct", true)
|
||||||
channel.queueDeclare("hello-queue", true, false, false, null)
|
channel.queueDeclare("hello-queue", false, false, false, null)
|
||||||
|
|
||||||
println("Publishing ", messageBody)
|
println("Publishing ", messageBody)
|
||||||
channel.basicPublish("hello-exchange", "hola", null,
|
channel.basicPublish("hello-exchange", "hola", null,
|
||||||
|
Loading…
Reference in New Issue
Block a user