Skip to content

Commit 45f69fe

Browse files
committed
* Move applications to projects/Applications and out of projects/Test.
* Tweak `PublisherConfirms` test application so that batches are 1/2 the number of outstanding confirms.
1 parent 4d0330b commit 45f69fe

File tree

10 files changed

+20
-17
lines changed

10 files changed

+20
-17
lines changed

Build.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
<ProjectReference Include="projects/RabbitMQ.Client.OpenTelemetry/RabbitMQ.Client.OpenTelemetry.csproj" />
1313
<ProjectReference Include="projects/toxiproxy-netcore/src/ToxiproxyNetCore/ToxiproxyNetCore.csproj" />
1414
<ProjectReference Include="projects/Test/Common/Common.csproj" />
15-
<ProjectReference Include="projects/Test/Applications/CreateChannel/CreateChannel.csproj" />
16-
<ProjectReference Include="projects/Test/Applications/MassPublish/MassPublish.csproj" />
17-
<ProjectReference Include="projects/Test/Applications/PublisherConfirms/PublisherConfirms.csproj" />
15+
<ProjectReference Include="projects/Applications/CreateChannel/CreateChannel.csproj" />
16+
<ProjectReference Include="projects/Applications/MassPublish/MassPublish.csproj" />
17+
<ProjectReference Include="projects/Applications/PublisherConfirms/PublisherConfirms.csproj" />
1818
<ProjectReference Include="projects/Test/Integration/Integration.csproj" />
1919
<ProjectReference Include="projects/Test/SequentialIntegration/SequentialIntegration.csproj" />
2020
<ProjectReference Include="projects/Test/Unit/Unit.csproj" />

RabbitMQDotNetClient.sln

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Unit", "projects\Test\Unit\
1414
EndProject
1515
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "projects\Benchmarks\Benchmarks.csproj", "{38D72C9A-68E9-4653-B0CE-C7BA9FFD91D0}"
1616
EndProject
17-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MassPublish", "projects\Test\Applications\MassPublish\MassPublish.csproj", "{0E3C4FBE-9976-40A3-9F57-DC0D9B7A39A6}"
17+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MassPublish", "projects\Applications\MassPublish\MassPublish.csproj", "{0E3C4FBE-9976-40A3-9F57-DC0D9B7A39A6}"
1818
EndProject
1919
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{D21B282C-49E6-4A30-887B-9626D94B8D69}"
2020
EndProject
21-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CreateChannel", "projects\Test\Applications\CreateChannel\CreateChannel.csproj", "{4A589408-F3A3-40E1-A6DF-F5E620F7CA31}"
21+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CreateChannel", "projects\Applications\CreateChannel\CreateChannel.csproj", "{4A589408-F3A3-40E1-A6DF-F5E620F7CA31}"
2222
EndProject
2323
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RabbitMQ.Client.OAuth2", "projects\RabbitMQ.Client.OAuth2\RabbitMQ.Client.OAuth2.csproj", "{794C7B31-0E9A-44A4-B285-0F3CAF6209F1}"
2424
EndProject
@@ -42,9 +42,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ToxiproxyNetCore", "project
4242
EndProject
4343
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RabbitMQ.Client.OpenTelemetry", "projects\RabbitMQ.Client.OpenTelemetry\RabbitMQ.Client.OpenTelemetry.csproj", "{16BF2086-AC7D-4EC3-8660-CC16E663ACB1}"
4444
EndProject
45-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GH-1647", "projects\Test\Applications\GH-1647\GH-1647.csproj", "{64ED07BF-4D77-47CD-AF4F-5B4525686FA1}"
45+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GH-1647", "projects\Applications\GH-1647\GH-1647.csproj", "{64ED07BF-4D77-47CD-AF4F-5B4525686FA1}"
4646
EndProject
47-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublisherConfirms", "projects\Test\Applications\PublisherConfirms\PublisherConfirms.csproj", "{13149F73-2CDB-4ECF-BF2C-403860045751}"
47+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublisherConfirms", "projects\Applications\PublisherConfirms\PublisherConfirms.csproj", "{13149F73-2CDB-4ECF-BF2C-403860045751}"
4848
EndProject
4949
Global
5050
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -115,7 +115,6 @@ Global
115115
GlobalSection(NestedProjects) = preSolution
116116
{B8FAC024-CC03-4067-9FFC-02846FB8AE48} = {EFD4BED5-13A5-4D9C-AADF-CAB7E1573704}
117117
{0E3C4FBE-9976-40A3-9F57-DC0D9B7A39A6} = {D21B282C-49E6-4A30-887B-9626D94B8D69}
118-
{D21B282C-49E6-4A30-887B-9626D94B8D69} = {EFD4BED5-13A5-4D9C-AADF-CAB7E1573704}
119118
{4A589408-F3A3-40E1-A6DF-F5E620F7CA31} = {D21B282C-49E6-4A30-887B-9626D94B8D69}
120119
{897D13F0-AF06-444A-9072-CF7E809A4A2C} = {EFD4BED5-13A5-4D9C-AADF-CAB7E1573704}
121120
{B01347D8-C327-471B-A1FE-7B86F7684A27} = {EFD4BED5-13A5-4D9C-AADF-CAB7E1573704}

projects/Test/Applications/CreateChannel/CreateChannel.csproj renamed to projects/Applications/CreateChannel/CreateChannel.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<ProjectReference Include="../../../RabbitMQ.Client/RabbitMQ.Client.csproj" />
21+
<ProjectReference Include="../../RabbitMQ.Client/RabbitMQ.Client.csproj" />
2222
</ItemGroup>
2323

2424
</Project>

projects/Test/Applications/GH-1647/GH-1647.csproj renamed to projects/Applications/GH-1647/GH-1647.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<ProjectReference Include="../../../RabbitMQ.Client\RabbitMQ.Client.csproj" />
12+
<ProjectReference Include="../../RabbitMQ.Client\RabbitMQ.Client.csproj" />
1313
</ItemGroup>
1414

1515
</Project>

projects/Test/Applications/MassPublish/MassPublish.csproj renamed to projects/Applications/MassPublish/MassPublish.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<ProjectReference Include="../../../RabbitMQ.Client/RabbitMQ.Client.csproj" />
21+
<ProjectReference Include="../../RabbitMQ.Client/RabbitMQ.Client.csproj" />
2222
</ItemGroup>
2323

2424
</Project>

projects/Test/Applications/PublisherConfirms/PublisherConfirms.cs renamed to projects/Applications/PublisherConfirms/PublisherConfirms.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
using System.Threading;
3838
using System.Threading.Tasks;
3939
using RabbitMQ.Client;
40-
using RabbitMQ.Client.Impl;
4140

4241
const ushort MAX_OUTSTANDING_CONFIRMS = 256;
4342

@@ -51,6 +50,11 @@
5150
OutstandingPublisherConfirmationsRateLimiter = new ThrottlingRateLimiter(MAX_OUTSTANDING_CONFIRMS)
5251
};
5352

53+
var props = new BasicProperties
54+
{
55+
Persistent = true
56+
};
57+
5458
#pragma warning disable CS8321 // Local function is declared but never used
5559

5660
await PublishMessagesIndividuallyAsync();
@@ -82,7 +86,7 @@ async Task PublishMessagesIndividuallyAsync()
8286
byte[] body = Encoding.UTF8.GetBytes(i.ToString());
8387
try
8488
{
85-
await channel.BasicPublishAsync(exchange: string.Empty, routingKey: queueName, body: body);
89+
await channel.BasicPublishAsync(exchange: string.Empty, routingKey: queueName, body: body, basicProperties: props, mandatory: true);
8690
}
8791
catch (Exception ex)
8892
{
@@ -106,7 +110,7 @@ async Task PublishMessagesInBatchAsync()
106110
QueueDeclareOk queueDeclareResult = await channel.QueueDeclareAsync();
107111
string queueName = queueDeclareResult.QueueName;
108112

109-
int batchSize = MAX_OUTSTANDING_CONFIRMS;
113+
int batchSize = MAX_OUTSTANDING_CONFIRMS / 2;
110114
int outstandingMessageCount = 0;
111115

112116
var sw = new Stopwatch();
@@ -116,7 +120,7 @@ async Task PublishMessagesInBatchAsync()
116120
for (int i = 0; i < MESSAGE_COUNT; i++)
117121
{
118122
byte[] body = Encoding.UTF8.GetBytes(i.ToString());
119-
publishTasks.Add(channel.BasicPublishAsync(exchange: string.Empty, routingKey: queueName, body: body));
123+
publishTasks.Add(channel.BasicPublishAsync(exchange: string.Empty, routingKey: queueName, body: body, mandatory: true, basicProperties: props));
120124
outstandingMessageCount++;
121125

122126
if (outstandingMessageCount == batchSize)
@@ -279,7 +283,7 @@ async Task CleanOutstandingConfirms(ulong deliveryTag, bool multiple)
279283
rk = Guid.NewGuid().ToString();
280284
}
281285
(ulong, ValueTask) data =
282-
(nextPublishSeqNo, channel.BasicPublishAsync(exchange: string.Empty, routingKey: rk, body: body, mandatory: true));
286+
(nextPublishSeqNo, channel.BasicPublishAsync(exchange: string.Empty, routingKey: rk, body: body, mandatory: true, basicProperties: props));
283287
publishTasks.Add(data);
284288
}
285289

projects/Test/Applications/PublisherConfirms/PublisherConfirms.csproj renamed to projects/Applications/PublisherConfirms/PublisherConfirms.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<ProjectReference Include="../../../RabbitMQ.Client/RabbitMQ.Client.csproj" />
16+
<ProjectReference Include="../../RabbitMQ.Client/RabbitMQ.Client.csproj" />
1717
</ItemGroup>
1818

1919
</Project>

0 commit comments

Comments
 (0)