Skip to content

Commit

Permalink
add preliminary native delivery count impl
Browse files Browse the repository at this point in the history
  • Loading branch information
mookid8000 committed Jan 2, 2024
1 parent c4afc55 commit 240baa5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@
* Fix bug that would accidentally use a /-prefixed virtual host when a virtual host was actually specified in the URI
* Update RabbitMq.Client to 6.6.0

## 9.1.0-alpha01
* Update to Rebus 8.2.0-alpha01 and implement support for providing the delivery count from `x-delivery-count` when available (which is is on quorum queues)


---

[bzuu]: https://github.com/bzuu
Expand Down
10 changes: 10 additions & 0 deletions Rebus.RabbitMq.Tests/RabbitMqNativeDeliveryCount.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using NUnit.Framework;
using Rebus.Tests.Contracts.Transports;

namespace Rebus.RabbitMq.Tests;

[TestFixture]
[Explicit("Does not quite work yet")]
public class RabbitMqNativeDeliveryCount : NativeDeliveryCount<RabbitMqTransportFactory>
{
}
4 changes: 2 additions & 2 deletions Rebus.RabbitMq.Tests/Rebus.RabbitMq.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="rabbitmq.client" Version="6.6.0" />
<PackageReference Include="rabbitmq.client" Version="6.8.1" />
<PackageReference Include="rebus.fleetmanager" Version="6.2.0" />
<PackageReference Include="rebus.serviceprovider" Version="10.0.0" />
<PackageReference Include="rebus.tests.contracts" Version="8.0.1" />
<PackageReference Include="rebus.tests.contracts" Version="8.2.0-alpha01" />
</ItemGroup>
<ItemGroup>
<Folder Include="Internals\" />
Expand Down
8 changes: 8 additions & 0 deletions Rebus.RabbitMq/RabbitMq/RabbitMqTransport.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -631,6 +632,13 @@ string GetStringValue(KeyValuePair<string, object> kvp)
headers[RabbitMqHeaders.CorrelationId] = basicProperties.CorrelationId;
}

if (basicProperties.Headers?.TryGetValue("x-delivery-count", out var deliveryCountObj) == true)
{
var deliveryCount = Convert.ToInt32(deliveryCountObj);

headers[Headers.DeliveryCount] = deliveryCount.ToString(CultureInfo.InvariantCulture);
}

return new TransportMessage(headers, body);
}

Expand Down
4 changes: 2 additions & 2 deletions Rebus.RabbitMq/Rebus.RabbitMq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="rebus" Version="8.0.1" />
<PackageReference Include="RabbitMq.Client" Version="6.6.0" />
<PackageReference Include="rebus" Version="8.2.0-alpha01" />
<PackageReference Include="RabbitMq.Client" Version="6.8.1" />
</ItemGroup>
<ItemGroup>
<None Include="..\artwork\little_rebusbus2_copy-500x500.png">
Expand Down

0 comments on commit 240baa5

Please sign in to comment.