Reformatted and cleaned up

This commit is contained in:
Keith Elder 2013-08-24 22:09:15 -05:00
parent 870b674a05
commit e72593af4f

View File

@ -1,17 +1,20 @@
using System;
using RabbitMQ.Client;
using System.Text;
class EmitLog {
public static void Main(string[] args) {
ConnectionFactory factory = new ConnectionFactory();
factory.HostName = "localhost";
using (IConnection connection = factory.CreateConnection())
using (IModel channel = connection.CreateModel()) {
class EmitLog
{
public static void Main(string[] args)
{
var factory = new ConnectionFactory() { HostName = "localhost" };
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare("logs", "fanout");
string message = (args.Length > 0) ? string.Join(" ", args)
: "info: Hello World!";
byte[] body = System.Text.Encoding.UTF8.GetBytes(message);
var message = (args.Length > 0) ? string.Join(" ", args)
: "info: Hello World!";
var body = Encoding.UTF8.GetBytes(message);
channel.BasicPublish("logs", "", null, body);
Console.WriteLine(" [x] Sent {0}", message);
}