Skip to content

Commit 739a46a

Browse files
committed
Modify MassPublish to be more like async-operations branch
1 parent a0321c6 commit 739a46a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

projects/TestApplications/MassPublish/Program.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ namespace MassPublish
99
{
1010
public static class Program
1111
{
12-
private const int BatchesToSend = 100;
13-
private const int ItemsPerBatch = 500;
12+
private const int BatchesToSend = 64;
13+
private const int ItemsPerBatch = 8192;
1414

1515
private static int messagesSent;
1616
private static int messagesReceived;
1717
private static AutoResetEvent doneEvent;
1818

1919
public static void Main()
2020
{
21+
var r = new Random();
22+
byte[] payload = new byte[4096];
23+
r.NextBytes(payload);
24+
2125
ThreadPool.SetMinThreads(16 * Environment.ProcessorCount, 16 * Environment.ProcessorCount);
2226

2327
doneEvent = new AutoResetEvent(false);
@@ -36,7 +40,6 @@ public static void Main()
3640
subscriber.QueueBind("testqueue", "test", "myawesome.routing.key");
3741
subscriber.BasicConsume("testqueue", true, "testconsumer", asyncListener);
3842

39-
byte[] payload = new byte[512];
4043
var watch = Stopwatch.StartNew();
4144
_ = Task.Run(async () =>
4245
{
@@ -70,7 +73,6 @@ public static void Main()
7073
publisher.Dispose();
7174
subscriber.Dispose();
7275
connection.Dispose();
73-
Console.ReadLine();
7476
}
7577

7678
private static Task AsyncListener_Received(object sender, BasicDeliverEventArgs @event)

0 commit comments

Comments
 (0)