8000 Merge pull request #70 from rabbitmq/rabbitmq-tutorials-69 · mail2deenesh/rabbitmq-tutorials@8c07f54 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c07f54

Browse files
Merge pull request rabbitmq#70 from rabbitmq/rabbitmq-tutorials-69
remove useless whitespaces in argument list
2 parents 31bfdd3 + 71e79d4 commit 8c07f54

File tree

13 files changed

+127
-127
lines changed

13 files changed

+127
-127
lines changed

dotnet-visual-studio/1_Send/Program.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ class Program
77
public static void Main()
88
{
99
var factory = new ConnectionFactory() { HostName = "localhost" };
10-
using( var connection = factory.CreateConnection() )
11-
using( var channel = connection.CreateModel() )
10+
using(var connection = factory.CreateConnection())
11+
using(var channel = connection.CreateModel())
1212
{
13-
channel.QueueDeclare( queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null );
13+
channel.QueueDeclare(queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null);
1414

1515
string message = "Hello World!";
16-
var body = Encoding.UTF8.GetBytes( message );
16+
var body = Encoding.UTF8.GetBytes(message);
1717

18-
channel.BasicPublish( exchange: "", routingKey: "hello", basicProperties: null, body: body );
19-
Console.WriteLine( " [x] Sent {0}", message );
18+
channel.BasicPublish(exchange: "", routingKey: "hello", basicProperties: null, body: body);
19+
Console.WriteLine(" [x] Sent {0}", message);
2020
}
2121

22-
Console.WriteLine( " Press [enter] to exit." );
22+
Console.WriteLine(" Press [enter] to exit.");
2323
Console.ReadLine();
2424
}
2525
}

dotnet-visual-studio/2_NewTask/Program.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44

55
class Program
66
{
7-
public static void Main( string[] args )
7+
public static void Main(string[] args)
88
{
99
var factory = new ConnectionFactory() { HostName = "localhost" };
10-
using( var connection = factory.CreateConnection() )
11-
using( var channel = connection.CreateModel() )
10+
using(var connection = factory.CreateConnection())
11+
using(var channel = connection.CreateModel())
1212
{
13-
channel.QueueDeclare( queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null );
13+
channel.QueueDeclare(queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null);
1414

15-
var message = GetMessage( args );
16-
var body = Encoding.UTF8.GetBytes( message );
15+
var message = GetMessage(args);
16+
var body = Encoding.UTF8.GetBytes(message);
1717

1818
var properties = channel.CreateBasicProperties();
19-
properties.SetPersistent( true );
19+
properties.SetPersistent(true);
2020

21-
channel.BasicPublish( exchange: "", routingKey: "task_queue", basicProperties: properties, body: body );
22-
Console.WriteLine 106D2 ( " [x] Sent {0}", message );
21+
channel.BasicPublish(exchange: "", routingKey: "task_queue", basicProperties: properties, body: body);
22+
Console.WriteLine(" [x] Sent {0}", message);
2323
}
2424

25-
Console.WriteLine( " Press [enter] to exit." );
25+
Console.WriteLine(" Press [enter] to exit.");
2626
Console.ReadLine();
2727
}
2828

29-
private static string GetMessage( string[] args )
29+
private static string GetMessage(string[] args)
3030
{
31-
return ( ( args.Length > 0 ) ? string.Join( " ", args ) : "Hello World!" );
31+
return ((args.Length > 0) ? string.Join(" ", args) : "Hello World!");
3232
}
3333
}

dotnet-visual-studio/3_EmitLog/Program.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44

55
class Program
66
{
7-
public static void Main( string[] args )
7+
public static void Main(string[] args)
88
{
99
var factory = new ConnectionFactory() { HostName = "localhost" };
10-
using( var connection = factory.CreateConnection() )
11-
using( var channel = connection.CreateModel() )
10+
using(var connection = factory.CreateConnection())
11+
using(var channel = connection.CreateModel())
1212
{
13-
channel.ExchangeDeclare( exchange: "logs", type: "fanout" );
13+
channel.ExchangeDeclare(exchange: "logs", type: "fanout");
1414

15-
var message = GetMessage( args );
16-
var body = Encoding.UTF8.GetBytes( message );
17-
channel.BasicPublish( exchange: "logs", routingKey: "", basicProperties: null, body: body );
18-
Console.WriteLine( " [x] Sent {0}", message );
15+
var message = GetMessage(args);
16+
var body = Encoding.UTF8.GetBytes(message);
17+
channel.BasicPublish(exchange: "logs", routingKey: "", basicProperties: null, body: body);
18+
Console.WriteLine(" [x] Sent {0}", message);
1919
}
2020

21-
Console.WriteLine( " Press [enter] to exit." );
21+
Console.WriteLine(" Press [enter] to exit.");
2222
Console.ReadLine();
2323
}
2424

25-
private static string GetMessage( string[] args )
25+
private static string GetMessage(string[] args)
2626
{
27-
return ( ( args.Length > 0 ) ? string.Join( " ", args ) : "info: Hello World!" );
27+
return (( args.Length > 0) ? string.Join(" ", args) : "info: Hello World!");
2828
}
2929
}

dotnet-visual-studio/4_EmitLogDirect/Program.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55

66
class Program
77
{
8-
public static void Main( string[] args )
8+
public static void Main(string[] args)
99
{
1010
var factory = new ConnectionFactory() { HostName = "localhost" };
11-
using( var connection = factory.CreateConnection() )
12-
using( var channel = connection.CreateModel() )
11+
using(var connection = factory.CreateConnection())
12+
using(var channel = connection.CreateModel())
1313
{
14-
channel.ExchangeDeclare( exchange: "direct_logs", type: "direct" );
14+
channel.ExchangeDeclare(exchange: "direct_logs", type: "direct");
1515

16-
var severity = ( args.Length > 0 ) ? args[0] : "info";
17-
var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!";
18-
var body = Encoding.UTF8.Ge 10000 tBytes( message );
19-
channel.BasicPublish( exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body );
20-
Console.WriteLine( " [x] Sent '{0}':'{1}'", severity, message );
16+
var severity = (args.Length > 0) ? args[0] : "info";
17+
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
18+
var body = Encoding.UTF8.GetBytes(message);
19+
channel.BasicPublish(exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body);
20+
Console.WriteLine(" [x] Sent '{0}':'{1}'", severity, message);
2121
}
2222

23-
Console.WriteLine( " Press [enter] to exit." );
23+
Console.WriteLine(" Press [enter] to exit.");
2424
Console.ReadLine();
2525
}
2626
}

dotnet-visual-studio/5_EmitLogTopic/Program.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66
class Program
77
{
8-
public static void Main( string[] args )
8+
public static void Main(string[] args)
99
{
1010
var factory = new ConnectionFactory() { HostName = "localhost" };
11-
using( var connection = factory.CreateConnection() )
12-
using( var channel = connection.CreateModel() )
11+
using(var connection = factory.CreateConnection())
12+
using(var channel = connection.CreateModel())
1313
{
14-
channel.ExchangeDeclare( exchange: "topic_logs", type: "topic" );
14+
channel.ExchangeDeclare(exchange: "topic_logs", type: "topic");
1515

16-
var routingKey = ( args.Length > 0 ) ? args[0] : "anonymous.info";
17-
var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!";
18-
var body = Encoding.UTF8.GetBytes( message );
19-
channel.BasicPublish( exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body );
20-
Console.WriteLine( " [x] Sent '{0}':'{1}'", routingKey, message );
16+
var routingKey = (args.Length > 0) ? args[0] : "anonymous.info";
17+
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
18+
var body = Encoding.UTF8.GetBytes(message);
19+
channel.BasicPublish(exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body);
20+
Console.WriteLine(" [x] Sent '{0}':'{1}'", routingKey, message);
2121
}
2222
}
2323
}

dotnet-visual-studio/6_RPCClient/RPCClient.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ public RPCClient()
1919
connection = factory.CreateConnection();
2020
channel = connection.CreateModel();
2121
replyQueueName = channel.QueueDeclare().QueueName;
22-
consumer = new QueueingBasicConsumer( channel );
23-
channel.BasicConsume( queue: replyQueueName, noAck: true, consumer: consumer );
22+
consumer = new QueueingBasicConsumer(channel);
23+
channel.BasicConsume(queue: replyQueueName, noAck: true, consumer: consumer);
2424
}
2525

26-
public string Call( string message )
26+
public string Call(string message)
2727
{
2828
var corrId = Guid.NewGuid().ToString();
2929
var props = channel.CreateBasicProperties();
3030
props.ReplyTo = replyQueueName;
3131
props.CorrelationId = corrId;
3232

33-
var messageBytes = Encoding.UTF8.GetBytes( message );
34-
channel.BasicPublish( exchange: "", routingKey: "rpc_queue", basicProperties: props, body: messageBytes );
33+
var messageBytes = Encoding.UTF8.GetBytes(message);
34+
channel.BasicPublish(exchange: "", routingKey: "rpc_queue", basicProperties: props, body: messageBytes);
3535

36-
while( true )
36+
while(true)
3737
{
3838
var ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
39-
if( ea.BasicProperties.CorrelationId == corrId )
39+
if(ea.BasicProperties.CorrelationId == corrId)
4040
{
41-
return Encoding.UTF8.GetString( ea.Body );
41+
return Encoding.UTF8.GetString(ea.Body);
4242
}
4343
}
4444
}

dotnet-visual-studio/6_RPCServer/Program.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ class Program
88
public static void Main()
99
{
1010
var factory = new ConnectionFactory() { HostName = "localhost" };
11-
using( var connection = factory.CreateConnection() )
12-
using( var channel = connection.CreateModel() )
11+
using(var connection = factory.CreateConnection())
12+
using(var channel = connection.CreateModel())
1313
{
14-
channel.QueueDeclare( queue: "rpc_queue", durable: false, exclusive: false, autoDelete: false, arguments: null );
15-
channel.BasicQos( 0, 1, false );
16-
var consumer = new QueueingBasicConsumer( channel );
17-
channel.BasicConsume( queue: "rpc_queue", noAck: false, consumer: consumer );
18-
Console.WriteLine( " [x] Awaiting RPC requests" );
14+
channel.QueueDeclare(queue: "rpc_queue", durable: false, exclusive: false, autoDelete: false, arguments: null);
15+
channel.BasicQos(0, 1, false);
16+
var consumer = new QueueingBasicConsumer(channel);
17+
channel.BasicConsume(queue: "rpc_queue", noAck: false, consumer: consumer);
18+
Console.WriteLine(" [x] Awaiting RPC requests");
1919

20-
while( true )
20+
while(true)
2121
{
2222
string response = null;
2323
var ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
@@ -29,21 +29,21 @@ public static void Main()
2929

3030
try
3131
{
32-
var message = Encoding.UTF8.GetString( body );
33-
int n = int.Parse( message );
34-
Console.WriteLine( " [.] fib({0})", message );
35-
response = fib( n ).ToString();
32+
var message = Encoding.UTF8.GetString(body);
33+
int n = int.Parse(message);
34+
Console.WriteLine(" [.] fib({0})", message);
35+
response = fib(n).ToString();
3636
}
37-
catch( Exception e )
37+
catch(Exception e)
3838
{
39-
Console.WriteLine( " [.] " + e.Message );
39+
Console.WriteLine(" [.] " + e.Message);
4040
response = "";
4141
}
4242
finally
4343
{
44-
var responseBytes = Encoding.UTF8.GetBytes( response );
45-
channel.BasicPublish( exchange: "", routingKey: props.ReplyTo, basicProperties: replyProps, body: responseBytes );
46-
channel.BasicAck( deliveryTag: ea.DeliveryTag, multiple: false );
44+
var responseBytes = Encoding.UTF8.GetBytes(response);
45+
channel.BasicPublish(exchange: "", routingKey: props.ReplyTo, basicProperties: replyProps, body: responseBytes);
46+
channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);
4747
}
4848
}
4949
}
@@ -53,13 +53,13 @@ public static void Main()
5353
/// Assumes only valid positive integer input.
5454
/// Don't expect this one to work for big numbers, and it's probably the slowest recursive implementation possible.
5555
/// </summary>
56-
private static int fib( int n )
56+
private static int fib(int n)
5757
{
58-
if( n == 0 || n == 1 )
58+
if(n == 0 || n == 1)
5959
{
6060
return n;
6161
}
6262

63-
return fib( n - 1 ) + fib( n - 2 );
63+
return fib(n - 1) + fib(n - 2);
6464
}
6565
}

dotnet/EmitLog.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44

55
class EmitLog
66
{
7-
public static void Main( string[] args )
7+
public static void Main(string[] args)
88
{
99
var factory = new ConnectionFactory() { HostName = "localhost" };
10-
using( var connection = factory.CreateConnection() )
11-
using( var channel = connection.CreateModel() )
10+
using(var connection = factory.CreateConnection())
11+
using(var channel = connection.CreateModel())
1212
{
13-
channel.ExchangeDeclare( exchange: "logs", type: "fanout" );
13+
channel.ExchangeDeclare(exchange: "logs", type: "fanout");
1414

15-
var message = GetMessage( args );
16-
var body = Encoding.UTF8.GetBytes( message );
17-
channel.BasicPublish( exchange: "logs", routingKey: "", basicProperties: null, body: body );
18-
Console.WriteLine( " [x] Sent {0}", message );
15+
var message = GetMessage(args);
16+
var body = Encoding.UTF8.GetBytes(message);
17+
channel.BasicPublish(exchange: "logs", routingKey: "", basicProperties: null, body: body);
18+
Console.WriteLine(" [x] Sent {0}", message);
1919
}
2020

21-
Console.WriteLine( " Press [enter] to exit." );
21+
Console.WriteLine(" Press [enter] to exit.");
2222
Console.ReadLine();
2323
}
2424

25-
private static string GetMessage( string[] args )
25+
private static string GetMessage(string[] args)
2626
{
27-
return ( ( args.Length > 0 ) ? string.Join( " ", args ) : "info: Hello World!" );
27+
return ((args.Length > 0) ? string.Join(" ", args) : "info: Hello World!");
2828
}
2929
}

dotnet/EmitLogDirect.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55

66
class EmitLogDirect
77
{
8-
public static void Main( string[] args )
8+
public static void Main(string[] args)
99
{
1010
var factory = new ConnectionFactory() { HostName = "localhost" };
11-
using( var connection = factory.CreateConnection() )
12-
using( var channel = connection.CreateModel() )
11+
using(var connection = factory.CreateConnection())
12+
using(var channel = connection.CreateModel())
1313
{
14-
channel.ExchangeDeclare( exchange: "direct_logs", type: "direct" );
14+
channel.ExchangeDeclare(exchange: "direct_logs", type: "direct");
1515

16-
var severity = ( args.Length > 0 ) ? args[0] : "info";
17-
var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!";
18-
var body = Encoding.UTF8.GetBytes( message );
19-
channel.BasicPublish( exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body );
20-
Console.WriteLine( " [x] Sent '{0}':'{1}'", severity, message );
16+
var severity = (args.Length > 0) ? args[0] : "info";
17+
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
18+
var body = Encoding.UTF8.GetBytes(message);
19+
channel.BasicPublish(exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body);
20+
Console.WriteLine(" [x] Sent '{0}':'{1}'", severity, message);
2121
}
2222

23-
Console.WriteLine( " Press [enter] to exit." );
23+
Console.WriteLine(" Press [enter] to exit.");
2424
Console.ReadLine();
2525
}
2626
}
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66
class EmitLogTopic
77
{
8-
public static void Main( string[] args )
8+
public static void Main(string[] args)
99
{
1010
var factory = new ConnectionFactory() { HostName = "localhost" };
11-
using( var connection = factory.CreateConnection() )
12-
using( var channel = connection.CreateModel() )
11+
using(var connection = factory.CreateConnection())
12+
using(var channel = connection.CreateModel())
1313
{
14-
channel.ExchangeDeclare( exchange: "topic_logs", type: "topic" );
14+
channel.ExchangeDeclare(exchange: "topic_logs", type: "topic");
1515

16-
var routingKey = ( args.Length > 0 ) ? args[0] : "anonymous.info";
17-
var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!";
18-
var body = Encoding.UTF8.GetBytes( message );
19-
channel.BasicPublish( exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body );
20-
Console.WriteLine( " [x] Sent '{0}':'{1}'", routingKey, message );
16+
var routingKey = (args.Length > 0) ? args[0] : "anonymous.info";
17+
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
18+
var body = Encoding.UTF8.GetBytes(message);
19+
channel.BasicPublish(exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body);
20+
Console.WriteLine(" [x] Sent '{0}':'{1}'", routingKey, message);
2121
}
2222
}
2323
}
0