Reformatted and cleaned up
This commit is contained in:
parent
870b674a05
commit
e72593af4f
@ -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)
|
||||
var message = (args.Length > 0) ? string.Join(" ", args)
|
||||
: "info: Hello World!";
|
||||
byte[] body = System.Text.Encoding.UTF8.GetBytes(message);
|
||||
var body = Encoding.UTF8.GetBytes(message);
|
||||
channel.BasicPublish("logs", "", null, body);
|
||||
Console.WriteLine(" [x] Sent {0}", message);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user