Skip to content

Commit

Permalink
Prepare RTM (#1351)
Browse files Browse the repository at this point in the history
* Prepare RTM

* Fix analyzer error

* Simplify

* Use json

* Tweaks

* Increase capacity of LRU caches

---------

Co-authored-by: Brandon Ording <[email protected]>
  • Loading branch information
andreasohlund and bording authored Mar 1, 2024
1 parent 2bc7d08 commit 3bd9d5c
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 145 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Sign NuGet packages
Expand All @@ -27,7 +26,7 @@ jobs:
client-id: ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }}
client-secret: ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }}
certificate-name: ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }}
certificate-name: ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }}
- name: Publish artifacts
uses: actions/[email protected]
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0-alpha.9" GeneratePathProperty="true" />
<PackageReference Include="RabbitMQ.Client" Version="6.7.0" />
<PackageReference Include="BitFaster.Caching" Version="2.4.1" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0" GeneratePathProperty="true" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Starter(IMessageDispatcher dispatchMessages, IReadOnlySettings settings)
protected override Task OnStart(IMessageSession session, CancellationToken cancellationToken = default)
{
//Use feature to send message that has no message id
var messageBody = "<MyRequest></MyRequest>";
var messageBody = "{}";

var message = new OutgoingMessage(
string.Empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0-alpha.9" />
<PackageReference Include="RabbitMQ.Client" Version="6.7.0" />
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0-alpha.9" />
<PackageReference Include="BitFaster.Caching" Version="2.4.1" />
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="Particular.Approvals" Version="1.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.7.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected IncomingMessage ReceiveMessage()
bool TryReceiveMessage(out IncomingMessage message, TimeSpan timeout) =>
receivedMessages.TryTake(out message, timeout);

protected IList<string> AdditionalReceiverQueues = new List<string>();
protected IList<string> AdditionalReceiverQueues = [];

protected Func<MessageContext, CancellationToken, Task> OnMessage;
protected Func<ErrorContext, CancellationToken, Task<ErrorHandleResult>> OnError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ public async Task<TransportInfrastructure> Configure(TransportDefinition transpo
"mainReceiver",
inputQueue,
true,
true, errorQueueName);
false,
errorQueueName);

var transport = await transportDefinition.Initialize(hostSettings, new[] { mainReceiverSettings }, new[] { errorQueueName }, cancellationToken);
var transport = await transportDefinition.Initialize(hostSettings, [mainReceiverSettings], [errorQueueName], cancellationToken);

queuesToCleanUp = new[] { transport.ToTransportAddress(inputQueue), errorQueueName };
queuesToCleanUp = [transport.ToTransportAddress(inputQueue), errorQueueName];
return transport;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.TransportTests.Sources" Version="9.0.0-alpha.9" />
<PackageReference Include="RabbitMQ.Client" Version="6.7.0" />
<PackageReference Include="BitFaster.Caching" Version="2.4.1" />
<PackageReference Include="NServiceBus.TransportTests.Sources" Version="9.0.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/NServiceBus.Transport.RabbitMQ.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Transport.Rabbi
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CAE42966-8BAA-4BFB-849E-8EE715646607}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
Custom.Build.props = Custom.Build.props
..\.github\workflows\release.yml = ..\.github\workflows\release.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Targets", "targets\Targets.csproj", "{F164238E-085A-451A-A852-B06496AE98EB}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class RabbitMQTransportSettingsExtensions
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> UseTransport<T>(this EndpointConfiguration config) where T : RabbitMQTransport
{
Guard.AgainstNull(nameof(config), config);
ArgumentNullException.ThrowIfNull(config);

var transport = new RabbitMQTransport();

Expand All @@ -41,7 +41,7 @@ public static TransportExtensions<RabbitMQTransport> UseTransport<T>(this Endpoi
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> AddClusterNode(this TransportExtensions<RabbitMQTransport> transportExtensions, string hostName, bool useTls)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.AddClusterNode(hostName, useTls);
return transportExtensions;
Expand All @@ -60,7 +60,7 @@ public static TransportExtensions<RabbitMQTransport> AddClusterNode(this Transpo
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> AddClusterNode(this TransportExtensions<RabbitMQTransport> transportExtensions, string hostName, int port, bool useTls)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.AddClusterNode(hostName, port, useTls);
return transportExtensions;
Expand All @@ -74,8 +74,8 @@ public static TransportExtensions<RabbitMQTransport> AddClusterNode(this Transpo
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> ConnectionString(this TransportExtensions<RabbitMQTransport> transportExtensions, string connectionString)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNullAndEmpty(nameof(connectionString), connectionString);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentException.ThrowIfNullOrWhiteSpace(connectionString);

transportExtensions.Transport.LegacyApiConnectionString = connectionString;
return transportExtensions;
Expand All @@ -89,8 +89,8 @@ public static TransportExtensions<RabbitMQTransport> ConnectionString(this Trans
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> ConnectionString(this TransportExtensions<RabbitMQTransport> transportExtensions, Func<string> getConnectionString)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNull(nameof(getConnectionString), getConnectionString);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentNullException.ThrowIfNull(getConnectionString);

transportExtensions.Transport.LegacyApiConnectionString = getConnectionString();
return transportExtensions;
Expand All @@ -107,8 +107,8 @@ public static TransportExtensions<RabbitMQTransport> ConnectionString(this Trans
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> CustomMessageIdStrategy(this TransportExtensions<RabbitMQTransport> transportExtensions, Func<RabbitMQ.Client.Events.BasicDeliverEventArgs, string> customIdStrategy)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNull(nameof(customIdStrategy), customIdStrategy);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentNullException.ThrowIfNull(customIdStrategy);

transportExtensions.Transport.MessageIdStrategy = customIdStrategy;
return transportExtensions;
Expand All @@ -123,7 +123,7 @@ public static TransportExtensions<RabbitMQTransport> CustomMessageIdStrategy(thi
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> DisableDurableExchangesAndQueues(this TransportExtensions<RabbitMQTransport> transportExtensions)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.UseDurableExchangesAndQueues = false;
return transportExtensions;
Expand All @@ -138,7 +138,7 @@ public static TransportExtensions<RabbitMQTransport> DisableDurableExchangesAndQ
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> DisableRemoteCertificateValidation(this TransportExtensions<RabbitMQTransport> transportExtensions)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.ValidateRemoteCertificate = false;
return transportExtensions;
Expand All @@ -155,7 +155,7 @@ public static TransportExtensions<RabbitMQTransport> DisableRemoteCertificateVal
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> PrefetchCount(this TransportExtensions<RabbitMQTransport> transportExtensions, ushort prefetchCount)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.PrefetchCountCalculation = _ => prefetchCount;
return transportExtensions;
Expand All @@ -172,8 +172,8 @@ public static TransportExtensions<RabbitMQTransport> PrefetchCount(this Transpor
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> PrefetchMultiplier(this TransportExtensions<RabbitMQTransport> transportExtensions, int prefetchMultiplier)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNegativeAndZero(nameof(prefetchMultiplier), prefetchMultiplier);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(prefetchMultiplier);

transportExtensions.Transport.PrefetchCountCalculation = concurrency => prefetchMultiplier * concurrency;
return transportExtensions;
Expand All @@ -190,8 +190,8 @@ public static TransportExtensions<RabbitMQTransport> PrefetchMultiplier(this Tra
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> SetClientCertificate(this TransportExtensions<RabbitMQTransport> transportExtensions, X509Certificate2 clientCertificate)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNull(nameof(clientCertificate), clientCertificate);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentNullException.ThrowIfNull(clientCertificate);

transportExtensions.Transport.ClientCertificate = clientCertificate;
return transportExtensions;
Expand All @@ -209,9 +209,9 @@ public static TransportExtensions<RabbitMQTransport> SetClientCertificate(this T
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> SetClientCertificate(this TransportExtensions<RabbitMQTransport> transportExtensions, string path, string password)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNullAndEmpty(nameof(path), path);
Guard.AgainstNullAndEmpty(nameof(password), password);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentException.ThrowIfNullOrWhiteSpace(path);
ArgumentException.ThrowIfNullOrWhiteSpace(password);

transportExtensions.Transport.ClientCertificate = new X509Certificate2(path, password);
return transportExtensions;
Expand All @@ -228,8 +228,8 @@ public static TransportExtensions<RabbitMQTransport> SetClientCertificate(this T
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> SetHeartbeatInterval(this TransportExtensions<RabbitMQTransport> transportExtensions, TimeSpan heartbeatInterval)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNegativeAndZero(nameof(heartbeatInterval), heartbeatInterval);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(heartbeatInterval, TimeSpan.Zero);

transportExtensions.Transport.HeartbeatInterval = heartbeatInterval;
return transportExtensions;
Expand All @@ -246,8 +246,8 @@ public static TransportExtensions<RabbitMQTransport> SetHeartbeatInterval(this T
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> SetNetworkRecoveryInterval(this TransportExtensions<RabbitMQTransport> transportExtensions, TimeSpan networkRecoveryInterval)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNegativeAndZero(nameof(networkRecoveryInterval), networkRecoveryInterval);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(networkRecoveryInterval, TimeSpan.Zero);

transportExtensions.Transport.NetworkRecoveryInterval = networkRecoveryInterval;
return transportExtensions;
Expand All @@ -264,8 +264,8 @@ public static TransportExtensions<RabbitMQTransport> SetNetworkRecoveryInterval(
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> TimeToWaitBeforeTriggeringCircuitBreaker(this TransportExtensions<RabbitMQTransport> transportExtensions, TimeSpan waitTime)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNegativeAndZero(nameof(waitTime), waitTime);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(waitTime, TimeSpan.Zero);

transportExtensions.Transport.TimeToWaitBeforeTriggeringCircuitBreaker = waitTime;
return transportExtensions;
Expand All @@ -281,7 +281,7 @@ public static TransportExtensions<RabbitMQTransport> TimeToWaitBeforeTriggeringC
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> UseConventionalRoutingTopology(this TransportExtensions<RabbitMQTransport> transportExtensions, QueueType queueType)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.TopologyFactory = durable => new ConventionalRoutingTopology(durable, queueType);
return transportExtensions;
Expand All @@ -298,8 +298,8 @@ public static TransportExtensions<RabbitMQTransport> UseConventionalRoutingTopol
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> UseCustomRoutingTopology(this TransportExtensions<RabbitMQTransport> transportExtensions, Func<bool, IRoutingTopology> topologyFactory)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
Guard.AgainstNull(nameof(topologyFactory), topologyFactory);
ArgumentNullException.ThrowIfNull(transportExtensions);
ArgumentNullException.ThrowIfNull(topologyFactory);

transportExtensions.Transport.TopologyFactory = topologyFactory;
return transportExtensions;
Expand All @@ -317,7 +317,7 @@ public static TransportExtensions<RabbitMQTransport> UseCustomRoutingTopology(th
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> UseDirectRoutingTopology(this TransportExtensions<RabbitMQTransport> transportExtensions, QueueType queueType, Func<Type, string> routingKeyConvention = null, Func<string> exchangeNameConvention = null)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.TopologyFactory = durable => new DirectRoutingTopology(durable, queueType, routingKeyConvention, exchangeNameConvention);
return transportExtensions;
Expand All @@ -333,7 +333,7 @@ public static TransportExtensions<RabbitMQTransport> UseDirectRoutingTopology(th
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions<RabbitMQTransport> UseExternalAuthMechanism(this TransportExtensions<RabbitMQTransport> transportExtensions)
{
Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
ArgumentNullException.ThrowIfNull(transportExtensions);

transportExtensions.Transport.UseExternalAuthMechanism = true;
return transportExtensions;
Expand Down
Loading

0 comments on commit 3bd9d5c

Please sign in to comment.