From 04c57cc71f494e4d33e0e999f4a165cf604af409 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 15 Nov 2012 23:06:06 -0500 Subject: [PATCH] Getting rid of a silly `else` block --- .../sylvilagus/ch02/HelloWorldProducer.scala | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldProducer.scala b/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldProducer.scala index a347271..f2e5e1d 100644 --- a/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldProducer.scala +++ b/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldProducer.scala @@ -5,20 +5,20 @@ import com.rabbitmq.client._ object HelloWorldProducer extends App { if (args.length < 1) { println("You must provide a message argument") - } else { - var messageBody = args(0) - - var factory = new ConnectionFactory() - factory.setUri("amqp://guest:guest@localhost:5672") - var connection = factory.newConnection() - var channel = connection.createChannel() - - channel.exchangeDeclare("hello-exchange", "direct", true) - channel.queueDeclare("hello-queue", false, false, false, null) - - printf("Publishing '%s'\n", messageBody) - channel.basicPublish("hello-exchange", "hola", null, messageBody.getBytes()) - - connection.close() + exit } + var messageBody = args(0) + + var factory = new ConnectionFactory() + factory.setUri("amqp://guest:guest@localhost:5672") + var connection = factory.newConnection() + var channel = connection.createChannel() + + channel.exchangeDeclare("hello-exchange", "direct", true) + channel.queueDeclare("hello-queue", false, false, false, null) + + printf("Publishing '%s'\n", messageBody) + channel.basicPublish("hello-exchange", "hola", null, messageBody.getBytes()) + + connection.close() }