Skip to content

Commit 6de8f33

Browse files
committed
Merge bug19230 into default
2 parents 8d09341 + 7ff82d4 commit 6de8f33

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/examples/DeclareQueue.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
//
5050
//---------------------------------------------------------------------------
5151
using System;
52+
using System.Collections;
5253
using System.IO;
5354
using System.Text;
5455

@@ -64,9 +65,17 @@ public static int Main(string[] args) {
6465
int optionIndex = 0;
6566
bool durable = false;
6667
bool delete = false;
68+
IDictionary arguments = null;
6769
while (optionIndex < args.Length) {
6870
if (args[optionIndex] == "/durable") { durable = true; }
6971
else if (args[optionIndex] == "/delete") { delete = true; }
72+
else if (args[optionIndex].StartsWith("/arg:")) {
73+
if (arguments == null) { arguments = new Hashtable(); }
74+
string[] pieces = args[optionIndex].Split(new Char[] { ':' });
75+
if (pieces.Length >= 3) {
76+
arguments[pieces[1]] = pieces[2];
77+
}
78+
}
7079
else { break; }
7180
optionIndex++;
7281
}
@@ -79,6 +88,7 @@ public static int Main(string[] args) {
7988
Console.Error.WriteLine("Available options:");
8089
Console.Error.WriteLine(" /durable declare a durable queue");
8190
Console.Error.WriteLine(" /delete delete after declaring");
91+
Console.Error.WriteLine(" /arg:KEY:VAL add longstr entry to arguments table");
8292
return 1;
8393
}
8494

@@ -90,7 +100,9 @@ public static int Main(string[] args) {
90100
using (IModel ch = conn.CreateModel()) {
91101
ushort ticket = ch.AccessRequest("/data");
92102

93-
string finalName = ch.QueueDeclare(ticket, inputQueueName, durable);
103+
string finalName = ch.QueueDeclare(ticket, inputQueueName,
104+
false, durable, false, false,
105+
false, arguments);
94106
Console.WriteLine("{0}\t{1}", finalName, durable);
95107

96108
while ((optionIndex + 1) < args.Length) {

0 commit comments

Comments
 (0)