File tree Expand file tree Collapse file tree 14 files changed +22
-14
lines changed
RabbitMQ.Client/src/client/api
DeclareQueue/src/examples
ExceptionTest/src/examples
LowlevelLogTail/src/examples
ShutdownableClient/src/examples
ShutdownableServer/src/examples Expand file tree Collapse file tree 14 files changed +22
-14
lines changed Original file line number Diff line number Diff line change 41
41
using System ;
42
42
using System . IO ;
43
43
using System . Net ;
44
+ using System . Net . Security ;
44
45
using System . Net . Sockets ;
45
46
using System . Collections ;
46
47
@@ -181,14 +182,21 @@ public String Uri
181
182
182
183
Uri uri = new Uri ( value , UriKind . Absolute ) ;
183
184
184
- if ( "amqp" . CompareTo ( uri . Scheme ) != 0 ) {
185
+ if ( "amqp" . CompareTo ( uri . Scheme . ToLower ( ) ) == 0 ) {
186
+ // nothing special to do
187
+ } else if ( "amqps" . CompareTo ( uri . Scheme . ToLower ( ) ) == 0 ) {
188
+ Ssl . Enabled = true ;
189
+ Ssl . AcceptablePolicyErrors = SslPolicyErrors . RemoteCertificateNameMismatch ;
190
+ Port = AmqpTcpEndpoint . DefaultAmqpSslPort ;
191
+ } else {
185
192
throw new ArgumentException ( "Wrong scheme in AMQP URI: " +
186
193
value ) ;
187
194
}
188
195
string host = uri . Host ;
189
196
if ( ! String . IsNullOrEmpty ( host ) ) {
190
197
HostName = host ;
191
198
}
199
+ Ssl . ServerName = HostName ;
192
200
193
201
int port = uri . Port ;
194
202
if ( port != - 1 ) {
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ private void ParseFail(string uri)
144
144
ConnectionFactory cf = new ConnectionFactory ( ) ;
145
145
cf . Uri = uri ;
146
146
Assert . Fail ( "URI parse didn't fail: '" + uri + "'" ) ;
147
- } catch ( Exception e ) {
147
+ } catch ( Exception ) {
148
148
// whoosh!
149
149
}
150
150
}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ namespace RabbitMQ.Client.Examples {
50
50
public class AddClient {
51
51
public static int Main ( string [ ] args ) {
52
52
if ( args . Length < 1 ) {
53
- Console . Error . WriteLine ( "Usage: AddClient <hostname>[:<portnumber>] [<number> ...]" ) ;
53
+ Console . Error . WriteLine ( "Usage: AddClient <uri> [<number> ...]" ) ;
54
54
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
55
55
return 2 ;
56
56
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ namespace RabbitMQ.Client.Examples {
51
51
public class AddServer : SimpleRpcServer {
52
52
public static int Main ( string [ ] args ) {
53
53
if ( args . Length < 1 ) {
54
- Console . Error . WriteLine ( "Usage: AddServer <hostname>[:<portnumber>] " ) ;
54
+ Console . Error . WriteLine ( "Usage: AddServer <uri> " ) ;
55
55
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
56
56
return 2 ;
57
57
}
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public static int Main(string[] args) {
72
72
if ( ( ( args . Length - optionIndex ) < 2 ) ||
73
73
( ( ( args . Length - optionIndex ) % 2 ) != 0 ) )
74
74
{
75
- Console . Error . WriteLine ( "Usage: DeclareQueue [<option> ...] <hostname>[:<portnumber>] <queue> [<exchange> <routingkey>] ..." ) ;
75
+ Console . Error . WriteLine ( "Usage: DeclareQueue [<option> ...] <uri> <queue> [<exchange> <routingkey>] ..." ) ;
76
76
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
77
77
Console . Error . WriteLine ( "Available options:" ) ;
78
78
Console . Error . WriteLine ( " /durable declare a durable queue" ) ;
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public class ExceptionTest {
52
52
public static int Main ( string [ ] args ) {
53
53
try {
54
54
if ( args . Length < 1 ) {
55
- Console . Error . WriteLine ( "Usage: ExceptionTest <hostname>[:<portnumber>] " ) ;
55
+ Console . Error . WriteLine ( "Usage: ExceptionTest <uri> " ) ;
56
56
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
57
57
return 2 ;
58
58
}
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ namespace RabbitMQ.Client.Examples {
52
52
public class LogTail {
53
53
public static int Main ( string [ ] args ) {
54
54
if ( args . Length < 4 ) {
55
- Console . Error . WriteLine ( "Usage: LogTail <hostname>[:<portnumber>] <exchange> <exchangetype> <routingkey>" ) ;
55
+ Console . Error . WriteLine ( "Usage: LogTail <uri> <exchange> <exchangetype> <routingkey>" ) ;
56
56
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
57
57
Console . Error . WriteLine ( "If the exchange name is the empty string, will instead declare a queue named" ) ;
58
58
Console . Error . WriteLine ( "by the routingkey, and consume from that queue." ) ;
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ namespace RabbitMQ.Client.Examples {
52
52
public class LowlevelLogTail {
53
53
public static int Main ( string [ ] args ) {
54
54
if ( args . Length < 4 ) {
55
- Console . Error . WriteLine ( "Usage: LowlevelLogTail <hostname>[:<portnumber>] <exchange> <exchangetype> <routingkey>" ) ;
55
+ Console . Error . WriteLine ( "Usage: LowlevelLogTail <uri> <exchange> <exchangetype> <routingkey>" ) ;
56
56
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
57
57
Console . Error . WriteLine ( "If the exchange name is the empty string, will instead declare a queue named" ) ;
58
58
Console . Error . WriteLine ( "by the routingkey, and consume from that queue." ) ;
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public class PerfTest {
51
51
52
52
public static int Main ( string [ ] args ) {
53
53
if ( args . Length < 2 ) {
54
- Console . Error . WriteLine ( "Usage: PerfTest <hostname>[:<portnumber>] <number of messages>" ) ;
54
+ Console . Error . WriteLine ( "Usage: PerfTest <uri> <number of messages>" ) ;
55
55
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
56
56
return 2 ;
57
57
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ namespace RabbitMQ.Client.Examples {
47
47
public class SendString {
48
48
public static int Main ( string [ ] args ) {
49
49
if ( args . Length < 5 ) {
50
- Console . Error . WriteLine ( "Usage: SendString <hostname>[:<portnumber>] <exchange> <exchangetype> <routingkey> <message>" ) ;
50
+ Console . Error . WriteLine ( "Usage: SendString <uri> <exchange> <exchangetype> <routingkey> <message>" ) ;
51
51
Console . Error . WriteLine ( "RabbitMQ .NET client version " + typeof ( IModel ) . Assembly . GetName ( ) . Version . ToString ( ) ) ;
52
52
return 2 ;
53
53
}
You can’t perform that action at this time.
0 commit comments