diff --git a/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/ConfigureEndpointAzureServiceBusTransport.cs b/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/ConfigureEndpointAzureServiceBusTransport.cs
index 5bd0ff5..7f8a329 100644
--- a/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/ConfigureEndpointAzureServiceBusTransport.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/ConfigureEndpointAzureServiceBusTransport.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.Extensions.DependencyInjection;
-using NServiceBus;
+using Microsoft.Extensions.DependencyInjection;
using NServiceBus.AcceptanceTesting.Customization;
using NServiceBus.AcceptanceTesting.Support;
using NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests;
diff --git a/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests.csproj b/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests.csproj
index 169c858..9ac0f00 100644
--- a/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests.csproj
+++ b/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests.csproj
@@ -3,6 +3,7 @@
net10.0
enable
+ NServiceBus.AcceptanceTests
@@ -14,15 +15,27 @@
-
+
-
+
+
+
+
+ CloudEvents\When_amqp_binary_message_received.cs
+
+
+ CloudEvents\When_http_binary_message_received.cs
+
+
+ CloudEvents\When_json_structured_message_received.cs
+
+
diff --git a/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/TestIndependenceSkipBehavior.cs b/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/TestIndependenceSkipBehavior.cs
index 075b51f..73543a4 100644
--- a/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/TestIndependenceSkipBehavior.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests/TestIndependenceSkipBehavior.cs
@@ -1,8 +1,8 @@
namespace NServiceBus.Envelope.CloudEvents.ASB.AcceptanceTests;
-using NServiceBus.AcceptanceTesting;
-using NServiceBus.Pipeline;
+using AcceptanceTesting;
using NUnit.Framework;
+using Pipeline;
class TestIndependenceSkipBehavior : IBehavior
{
diff --git a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_amqp_binary_message_received.cs b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_amqp_binary_message_received.cs
index 0888c6f..ed9e3ac 100644
--- a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_amqp_binary_message_received.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_amqp_binary_message_received.cs
@@ -1,16 +1,12 @@
-namespace NServiceBus.Envelope.CloudEvents.AcceptanceTests.CloudEvents;
+namespace NServiceBus.AcceptanceTests.CloudEvents;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using AcceptanceTesting;
using Configuration.AdvancedExtensibility;
-using NServiceBus.AcceptanceTests;
-using NServiceBus.AcceptanceTests.EndpointTemplates;
-using Pipeline;
-using Transport;
+using EndpointTemplates;
+using Envelope.CloudEvents;
+using NServiceBus.Pipeline;
using NUnit.Framework;
+using Transport;
public class When_amqp_binary_message_received : NServiceBusAcceptanceTest
{
@@ -25,7 +21,7 @@ public async Task An_amqp_binary_cloud_event_is_received()
// Azure sends CloudEvents as JSON Structured. Below is the equivalent
// in the AMQP Binary format.
// The headers are set in the CustomSerializationBehavior.
- return b.SendLocal(new Message()
+ return b.SendLocal(new Message
{
Api = "PutBlockList",
ClientRequestId = "4c5dd7fb-2c48-4a27-bb30-5361b5de920a",
diff --git a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_http_binary_message_received.cs b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_http_binary_message_received.cs
index cdad636..53af526 100644
--- a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_http_binary_message_received.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_http_binary_message_received.cs
@@ -1,16 +1,12 @@
-namespace NServiceBus.Envelope.CloudEvents.AcceptanceTests.CloudEvents;
+namespace NServiceBus.AcceptanceTests.CloudEvents;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using AcceptanceTesting;
using Configuration.AdvancedExtensibility;
-using NServiceBus.AcceptanceTests;
-using NServiceBus.AcceptanceTests.EndpointTemplates;
-using Pipeline;
-using Transport;
+using EndpointTemplates;
+using Envelope.CloudEvents;
+using NServiceBus.Pipeline;
using NUnit.Framework;
+using Transport;
public class When_http_binary_message_received : NServiceBusAcceptanceTest
{
@@ -25,7 +21,7 @@ public async Task An_http_binary_cloud_event_is_received()
// Azure sends CloudEvents as JSON Structured. Below is the equivalent
// in the HTTP Binary format.
// The headers are set in the CustomSerializationBehavior.
- return b.SendLocal(new Message()
+ return b.SendLocal(new Message
{
Api = "PutBlockList",
ClientRequestId = "4c5dd7fb-2c48-4a27-bb30-5361b5de920a",
diff --git a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_json_structured_message_received.cs b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_json_structured_message_received.cs
index de8f6a0..b13a75c 100644
--- a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_json_structured_message_received.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/CloudEvents/When_json_structured_message_received.cs
@@ -1,16 +1,12 @@
-namespace NServiceBus.Envelope.CloudEvents.AcceptanceTests.CloudEvents;
+namespace NServiceBus.AcceptanceTests.CloudEvents;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using AcceptanceTesting;
using Configuration.AdvancedExtensibility;
-using NServiceBus.AcceptanceTests;
-using NServiceBus.AcceptanceTests.EndpointTemplates;
-using Pipeline;
-using Transport;
+using EndpointTemplates;
+using Envelope.CloudEvents;
+using NServiceBus.Pipeline;
using NUnit.Framework;
+using Transport;
public class When_json_structured_message_received : NServiceBusAcceptanceTest
{
@@ -23,7 +19,7 @@ public async Task A_json_structured_cloud_event_is_received()
// The following represents a CloudEvent that Azure Blob Storage generates
// to notify that a new blob item has been created.
// The headers are set in the CustomSerializationBehavior.
- return b.SendLocal(new Message()
+ return b.SendLocal(new Message
{
SpecVersion = "1.0",
Type = "Microsoft.Storage.BlobCreated",
@@ -32,7 +28,7 @@ public async Task A_json_structured_cloud_event_is_received()
Id = "9aeb0fdf-c01e-0131-0922-9eb54906e209",
Time = "2019-11-18T15:13:39.4589254Z",
Subject = "blobServices/default/containers/{storage-container}/blobs/{new-file}",
- Data = new NestedData()
+ Data = new NestedData
{
Api = "PutBlockList",
ClientRequestId = "4c5dd7fb-2c48-4a27-bb30-5361b5de920a",
diff --git a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/ConfigureEndpointAcceptanceTestingTransportWithCloudEvents.cs b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/ConfigureEndpointAcceptanceTestingTransportWithCloudEvents.cs
index aed0993..42da7e7 100644
--- a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/ConfigureEndpointAcceptanceTestingTransportWithCloudEvents.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/ConfigureEndpointAcceptanceTestingTransportWithCloudEvents.cs
@@ -1,11 +1,7 @@
namespace NServiceBus.AcceptanceTests;
-using System;
-using System.IO;
-using System.Threading.Tasks;
using AcceptanceTesting.Customization;
-using NServiceBus;
-using NServiceBus.AcceptanceTesting.Support;
+using AcceptanceTesting.Support;
using NUnit.Framework;
public class ConfigureEndpointAcceptanceTestingTransportWithCloudEvents(
diff --git a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/NServiceBus.Envelope.CloudEvents.AcceptanceTests.csproj b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/NServiceBus.Envelope.CloudEvents.AcceptanceTests.csproj
index 3162ed9..d9b174d 100644
--- a/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/NServiceBus.Envelope.CloudEvents.AcceptanceTests.csproj
+++ b/src/NServiceBus.Envelope.CloudEvents.AcceptanceTests/NServiceBus.Envelope.CloudEvents.AcceptanceTests.csproj
@@ -3,6 +3,7 @@
net10.0
enable
+ NServiceBus.AcceptanceTests
@@ -13,7 +14,7 @@
-
+
diff --git a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/Cleanup.cs b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/Cleanup.cs
index 5c561a4..595f5d0 100644
--- a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/Cleanup.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/Cleanup.cs
@@ -1,9 +1,5 @@
namespace NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using Amazon.S3;
using Amazon.S3.Model;
using Amazon.S3.Util;
diff --git a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ClientFactories.cs b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ClientFactories.cs
index 5c4d476..0d5cc16 100644
--- a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ClientFactories.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ClientFactories.cs
@@ -2,7 +2,6 @@
namespace NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests;
-using System;
using Amazon.Runtime;
using Amazon.S3;
using Amazon.SimpleNotificationService;
diff --git a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ConfigureEndpointSqsTransport.cs b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ConfigureEndpointSqsTransport.cs
index c34aaf9..df9bedc 100644
--- a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ConfigureEndpointSqsTransport.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/ConfigureEndpointSqsTransport.cs
@@ -1,6 +1,5 @@
namespace NServiceBus.AcceptanceTests;
-using System.Threading.Tasks;
using AcceptanceTesting.Customization;
using AcceptanceTesting.Support;
using Envelope.CloudEvents.SQS.AcceptanceTests;
diff --git a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests.csproj b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests.csproj
index fbc8bf5..8238141 100644
--- a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests.csproj
+++ b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests.csproj
@@ -9,17 +9,29 @@
-
+
-
+
+
+
+
+ CloudEvents\When_amqp_binary_message_received.cs
+
+
+ CloudEvents\When_http_binary_message_received.cs
+
+
+ CloudEvents\When_json_structured_message_received.cs
+
+
diff --git a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/SetupFixture.cs b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/SetupFixture.cs
index 1eb2243..f244e85 100644
--- a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/SetupFixture.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/SetupFixture.cs
@@ -1,8 +1,6 @@
namespace NServiceBus.AcceptanceTests;
-using System;
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
using Envelope.CloudEvents.SQS.AcceptanceTests;
using NUnit.Framework;
diff --git a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/TestNameHelper.cs b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/TestNameHelper.cs
index 62329a2..3a9825b 100644
--- a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/TestNameHelper.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/TestNameHelper.cs
@@ -1,7 +1,5 @@
namespace NServiceBus.AcceptanceTests;
-using System;
-using System.Linq;
using System.Text;
static class TestNameHelper
diff --git a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/When_receiving_http_binary.cs b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/When_receiving_http_binary.cs
index b460c5d..74a1f91 100644
--- a/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/When_receiving_http_binary.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.SQS.AcceptanceTests/When_receiving_http_binary.cs
@@ -1,10 +1,9 @@
namespace NServiceBus.AcceptanceTests;
using System.Text.Json;
-using System.Threading.Tasks;
-using Amazon.SQS.Model;
using AcceptanceTesting;
using AcceptanceTesting.Customization;
+using Amazon.SQS.Model;
using Configuration.AdvancedExtensibility;
using EndpointTemplates;
using Envelope.CloudEvents;
diff --git a/src/NServiceBus.Envelope.CloudEvents.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt b/src/NServiceBus.Envelope.CloudEvents.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt
index 1ce48e3..caf4256 100644
--- a/src/NServiceBus.Envelope.CloudEvents.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt
+++ b/src/NServiceBus.Envelope.CloudEvents.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt
@@ -308,8 +308,11 @@ namespace NServiceBus
public static class ErrorQueueSettings
{
public const string SettingsKey = "errorQueue";
- public static string ErrorQueueAddress(this NServiceBus.Settings.IReadOnlySettings settings) { }
- public static bool TryGetExplicitlyConfiguredErrorQueueAddress(this NServiceBus.Settings.IReadOnlySettings settings, out string errorQueue) { }
+ extension(NServiceBus.Settings.IReadOnlySettings settings)
+ {
+ public string ErrorQueueAddress() { }
+ public bool TryGetExplicitlyConfiguredErrorQueueAddress([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out string? errorQueue) { }
+ }
}
public class FailedConfig
{
@@ -463,10 +466,7 @@ namespace NServiceBus
}
public interface IEnvelopeHandler
{
- [return: System.Runtime.CompilerServices.TupleElementNames(new string[] {
- "headers",
- "body"})]
- System.ValueTuple, System.ReadOnlyMemory>? UnwrapEnvelope(string nativeMessageId, System.Collections.Generic.IDictionary incomingHeaders, NServiceBus.Extensibility.ContextBag extensions, System.ReadOnlyMemory incomingBody);
+ System.Collections.Generic.Dictionary? UnwrapEnvelope(string nativeMessageId, System.Collections.Generic.IDictionary incomingHeaders, System.ReadOnlySpan incomingBody, NServiceBus.Extensibility.ContextBag extensions, System.Buffers.IBufferWriter bodyWriter);
}
public interface IHandleMessages { }
public interface IHandleMessages : NServiceBus.IHandleMessages
@@ -671,19 +671,6 @@ namespace NServiceBus
public void LimitMessageProcessingConcurrencyTo(int maxConcurrency) { }
}
}
- public abstract class MessagePropertyAccessor
- {
- protected MessagePropertyAccessor() { }
- public abstract System.Type MessageType { get; }
- public abstract object? AccessFrom(object message);
- }
- public abstract class MessagePropertyAccessor : NServiceBus.MessagePropertyAccessor
- {
- protected MessagePropertyAccessor() { }
- public override sealed System.Type MessageType { get; }
- protected abstract object? AccessFrom(TMessage message);
- public override sealed object? AccessFrom(object message) { }
- }
public static class MessageSessionExtensions
{
public static System.Threading.Tasks.Task Publish(this NServiceBus.IMessageSession session, object message, System.Threading.CancellationToken cancellationToken = default) { }
@@ -718,6 +705,8 @@ namespace NServiceBus
public delegate System.Threading.Tasks.Task OnSatelliteMessage(System.IServiceProvider serviceProvider, NServiceBus.Transport.MessageContext messageContext, System.Threading.CancellationToken cancellationToken = default);
public static class OpenTelemetryConfigurationExtensions
{
+ [System.Obsolete("OpenTelemetry is now enabled by default. This method is no longer required. Will " +
+ "be removed in version 11.0.0.", true)]
public static void EnableOpenTelemetry(this NServiceBus.EndpointConfiguration endpointConfiguration) { }
}
public static class OpenTelemetryExtensions
@@ -784,7 +773,7 @@ namespace NServiceBus
}
public class RateLimitSettings
{
- public RateLimitSettings(System.TimeSpan? timeToWaitBetweenThrottledAttempts = default, System.Func onRateLimitStarted = null, System.Func onRateLimitEnded = null) { }
+ public RateLimitSettings(System.TimeSpan? timeToWaitBetweenThrottledAttempts = default, System.Func? onRateLimitStarted = null, System.Func? onRateLimitEnded = null) { }
public System.Func OnRateLimitEnded { get; }
public System.Func OnRateLimitStarted { get; }
public System.TimeSpan TimeToWaitBetweenThrottledAttempts { get; }
@@ -1148,6 +1137,7 @@ namespace NServiceBus
public static NServiceBus.Serialization.SerializationExtensions Namespace(this NServiceBus.Serialization.SerializationExtensions config, string namespaceToUse) { }
public static NServiceBus.Serialization.SerializationExtensions SanitizeInput(this NServiceBus.Serialization.SerializationExtensions config) { }
}
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("XmlSerializer is not supported in trimming scenarios.")]
public class XmlSerializer : NServiceBus.Serialization.SerializationDefinition
{
public XmlSerializer() { }
@@ -1445,13 +1435,9 @@ namespace NServiceBus.Features
{
public static void EnableFeature(this NServiceBus.Settings.SettingsHolder settings)
where TFeature : NServiceBus.Features.Feature, new () { }
- [System.Obsolete("It is no longer possible to enable features by default on the settings. Features " +
- "can enable other features by calling EnableByDefault in the constructor. Will" +
- " be removed in version 11.0.0.", true)]
+ [System.Obsolete(@"It is no longer possible to enable features by default on the settings. Features can enable other features by calling Enable in the constructor. Enabling a feature outside the context of another feature can be done by calling EnableFeature on the endpoint configuration or settings. Will be removed in version 11.0.0.", true)]
public static NServiceBus.Settings.SettingsHolder EnableFeatureByDefault(this NServiceBus.Settings.SettingsHolder settings, System.Type featureType) { }
- [System.Obsolete("It is no longer possible to enable features by default on the settings. Features " +
- "can enable other features by calling EnableByDefault in the constructor. Will" +
- " be removed in version 11.0.0.", true)]
+ [System.Obsolete(@"It is no longer possible to enable features by default on the settings. Features can enable other features by calling Enable in the constructor. Enabling a feature outside the context of another feature can be done by calling EnableFeature on the endpoint configuration or settings. Will be removed in version 11.0.0.", true)]
public static NServiceBus.Settings.SettingsHolder EnableFeatureByDefault(this NServiceBus.Settings.SettingsHolder settings)
where T : NServiceBus.Features.Feature { }
[System.Obsolete("Use \'IsFeatureActive(this IReadOnlySettings settings)\' instead. Will be remove" +
@@ -2109,6 +2095,12 @@ namespace NServiceBus.Sagas
public string SagaId { get; }
public void AttachNewEntity(NServiceBus.IContainSagaData sagaEntity) { }
}
+ public abstract class CorrelationPropertyAccessor
+ {
+ protected CorrelationPropertyAccessor() { }
+ public abstract object? AccessFrom(NServiceBus.IContainSagaData sagaData);
+ public abstract void WriteTo(NServiceBus.IContainSagaData sagaData, object value);
+ }
public interface IFinder { }
[System.Obsolete(@"Saga not found handlers are no longer automatically registered during assembly scanning. Handlers are no longer global and should be registered for each saga using mapper.ConfigureNotFoundHandler(). Use 'ISagaNotFoundHandler' instead. Will be removed in version 11.0.0.", true)]
public interface IHandleSagaNotFound
@@ -2134,6 +2126,19 @@ namespace NServiceBus.Sagas
System.Threading.Tasks.Task Save(NServiceBus.IContainSagaData sagaData, NServiceBus.Sagas.SagaCorrelationProperty correlationProperty, NServiceBus.Persistence.ISynchronizedStorageSession session, NServiceBus.Extensibility.ContextBag context, System.Threading.CancellationToken cancellationToken = default);
System.Threading.Tasks.Task Update(NServiceBus.IContainSagaData sagaData, NServiceBus.Persistence.ISynchronizedStorageSession session, NServiceBus.Extensibility.ContextBag context, System.Threading.CancellationToken cancellationToken = default);
}
+ public abstract class MessagePropertyAccessor
+ {
+ protected MessagePropertyAccessor() { }
+ public abstract System.Type MessageType { get; }
+ public abstract object? AccessFrom(object message);
+ }
+ public abstract class MessagePropertyAccessor : NServiceBus.Sagas.MessagePropertyAccessor
+ {
+ protected MessagePropertyAccessor() { }
+ public override sealed System.Type MessageType { get; }
+ protected abstract object? AccessFrom(TMessage message);
+ public override sealed object? AccessFrom(object message) { }
+ }
public class SagaCorrelationProperty
{
public SagaCorrelationProperty(string name, object value) { }
@@ -2186,13 +2191,14 @@ namespace NServiceBus.Sagas
public static NServiceBus.Sagas.SagaMetadata Create(System.Type sagaType, System.Collections.Generic.IEnumerable availableTypes, NServiceBus.Conventions conventions) { }
public static NServiceBus.Sagas.SagaMetadata Create()
where TSaga : NServiceBus.Saga { }
- public static NServiceBus.Sagas.SagaMetadata Create(System.Collections.Generic.IReadOnlyCollection associatedMessages, System.Collections.Generic.IReadOnlyCollection? propertyAccessors = null)
+ public static NServiceBus.Sagas.SagaMetadata Create(System.Collections.Generic.IReadOnlyCollection associatedMessages, NServiceBus.Sagas.CorrelationPropertyAccessor? correlationPropertyAccessor = null, System.Collections.Generic.IReadOnlyCollection? propertyAccessors = null)
where TSaga : NServiceBus.Saga
where TSagaData : class, NServiceBus.IContainSagaData, new () { }
public static System.Collections.Generic.IEnumerable CreateMany(System.Collections.Generic.IEnumerable sagaTypes) { }
public class CorrelationPropertyMetadata
{
- public CorrelationPropertyMetadata(string name, System.Type type) { }
+ public CorrelationPropertyMetadata(string name, System.Type type, NServiceBus.Sagas.CorrelationPropertyAccessor propertyAccessor) { }
+ public NServiceBus.Sagas.CorrelationPropertyAccessor Accessor { get; }
public string Name { get; }
public System.Type Type { get; }
}
@@ -2320,9 +2326,16 @@ namespace NServiceBus.Transport
public NServiceBus.Settings.IReadOnlySettings? CoreSettings { get; }
public System.Action CriticalErrorAction { get; }
public string HostDisplayName { get; }
+ [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "CoreSettings")]
+ [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "CoreSettings")]
+ public bool IsRawMode { get; }
public string Name { get; }
+ public System.IServiceProvider? ServiceProvider { get; set; }
public bool SetupInfrastructure { get; }
public NServiceBus.StartupDiagnosticEntries StartupDiagnostic { get; }
+ [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ServiceProvider")]
+ [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ServiceProvider")]
+ public bool SupportsDependencyInjection { get; }
}
public interface IMessageDispatcher
{
@@ -2432,6 +2445,8 @@ namespace NServiceBus.Transport
public bool SupportsPublishSubscribe { get; }
public bool SupportsTTBR { get; }
public virtual NServiceBus.TransportTransactionMode TransportTransactionMode { get; set; }
+ public void ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection services) { }
+ protected virtual void ConfigureServicesCore(Microsoft.Extensions.DependencyInjection.IServiceCollection services) { }
protected void EnableEndpointFeature()
where T : NServiceBus.Features.Feature, new () { }
public abstract System.Collections.Generic.IReadOnlyCollection GetSupportedTransactionModes();
@@ -2515,10 +2530,16 @@ namespace NServiceBus.Unicast.Messages
}
public class MessageMetadataRegistry
{
+ public MessageMetadataRegistry() { }
+ [System.Obsolete("Use \'MessageMetadataRegistry.Initialize\' instead. Will be removed in version 11.0" +
+ ".0.", true)]
public MessageMetadataRegistry(System.Func isMessageType, bool allowDynamicTypeLoading) { }
public NServiceBus.Unicast.Messages.MessageMetadata[] GetAllMessages() { }
public NServiceBus.Unicast.Messages.MessageMetadata GetMessageMetadata(System.Type messageType) { }
public NServiceBus.Unicast.Messages.MessageMetadata GetMessageMetadata(string messageTypeIdentifier) { }
+ public void Initialize(System.Func isMessageType, bool allowDynamicTypeLoading) { }
+ public void RegisterMessageTypeWithHierarchy(System.Type messageType, System.Collections.Generic.IEnumerable parentMessages) { }
+ public void RegisterMessageTypes(System.Collections.Generic.IEnumerable messageTypes) { }
}
}
namespace NServiceBus.Unicast.Queuing
diff --git a/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventAmqpBinaryEnvelopeHandlerTests.cs b/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventAmqpBinaryEnvelopeHandlerTests.cs
index 79a3f7f..425c3e8 100644
--- a/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventAmqpBinaryEnvelopeHandlerTests.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventAmqpBinaryEnvelopeHandlerTests.cs
@@ -1,13 +1,11 @@
namespace NServiceBus.Envelope.CloudEvents.Tests;
-using System;
-using System.Collections.Generic;
-using Microsoft.Extensions.Diagnostics.Metrics.Testing;
+using System.Buffers;
using System.Text;
using System.Text.Json;
using Extensibility;
using Fakes;
-using NServiceBus;
+using Microsoft.Extensions.Diagnostics.Metrics.Testing;
using NUnit.Framework;
[TestFixture]
@@ -224,8 +222,10 @@ public void Should_not_record_metric_when_property_is_missing(string property)
(Dictionary headers, ReadOnlyMemory body)? RunEnvelopHandlerTest()
{
+ var bodyWriter = new ArrayBufferWriter();
var upperCaseHeaders = NativeHeaders.ToDictionary(k => k.Key.ToUpper(), k => k.Value);
- return EnvelopeHandler.UnwrapEnvelope(NativeMessageId, upperCaseHeaders!, new ContextBag(), Body);
+ var headers = EnvelopeHandler.UnwrapEnvelope(NativeMessageId, upperCaseHeaders!, Body.Span, new ContextBag(), bodyWriter);
+ return headers == null ? null : (headers, bodyWriter.WrittenMemory);
}
void AssertTypicalFields((Dictionary Headers, ReadOnlyMemory Body) actual, bool shouldHaveTime = true)
diff --git a/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventHttpBinaryEnvelopeHandlerTests.cs b/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventHttpBinaryEnvelopeHandlerTests.cs
index a18f602..033a506 100644
--- a/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventHttpBinaryEnvelopeHandlerTests.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.Tests/CloudEventHttpBinaryEnvelopeHandlerTests.cs
@@ -1,13 +1,11 @@
namespace NServiceBus.Envelope.CloudEvents.Tests;
-using System;
-using System.Collections.Generic;
+using System.Buffers;
using System.Text;
using System.Text.Json;
using Extensibility;
using Fakes;
using Microsoft.Extensions.Diagnostics.Metrics.Testing;
-using NServiceBus;
using NUnit.Framework;
[TestFixture]
@@ -224,8 +222,10 @@ public void Should_not_record_metric_when_property_is_missing(string property)
(Dictionary headers, ReadOnlyMemory body)? RunEnvelopHandlerTest()
{
+ var bodyWriter = new ArrayBufferWriter();
var upperCaseHeaders = NativeHeaders.ToDictionary(k => k.Key.ToUpper(), k => k.Value);
- return EnvelopeHandler.UnwrapEnvelope(NativeMessageId, upperCaseHeaders!, new ContextBag(), Body);
+ var headers = EnvelopeHandler.UnwrapEnvelope(NativeMessageId, upperCaseHeaders!, Body.Span, new ContextBag(), bodyWriter);
+ return headers == null ? null : (headers, bodyWriter.WrittenMemory);
}
void AssertTypicalFields((Dictionary Headers, ReadOnlyMemory Body) actual, bool shouldHaveTime = true)
diff --git a/src/NServiceBus.Envelope.CloudEvents.Tests/Fakes/TestMeterFactory.cs b/src/NServiceBus.Envelope.CloudEvents.Tests/Fakes/TestMeterFactory.cs
index 949bf39..02cc0d1 100644
--- a/src/NServiceBus.Envelope.CloudEvents.Tests/Fakes/TestMeterFactory.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.Tests/Fakes/TestMeterFactory.cs
@@ -1,6 +1,5 @@
namespace NServiceBus.Envelope.CloudEvents.Tests.Fakes;
-using System.Collections.Generic;
using System.Diagnostics.Metrics;
class TestMeterFactory : IMeterFactory
diff --git a/src/NServiceBus.Envelope.CloudEvents.Tests/PermissiveCloudEventJsonStructuredEnvelopeHandlerTests.cs b/src/NServiceBus.Envelope.CloudEvents.Tests/PermissiveCloudEventJsonStructuredEnvelopeHandlerTests.cs
index bb97636..f59739b 100644
--- a/src/NServiceBus.Envelope.CloudEvents.Tests/PermissiveCloudEventJsonStructuredEnvelopeHandlerTests.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.Tests/PermissiveCloudEventJsonStructuredEnvelopeHandlerTests.cs
@@ -1,13 +1,11 @@
namespace NServiceBus.Envelope.CloudEvents.Tests;
-using System;
-using System.Collections.Generic;
+using System.Buffers;
using System.Text;
using System.Text.Json;
using Extensibility;
using Fakes;
using Microsoft.Extensions.Diagnostics.Metrics.Testing;
-using NServiceBus;
using NUnit.Framework;
[TestFixture]
@@ -285,7 +283,8 @@ public void Should_record_metric_when_type_is_missing()
[Test]
public void Should_return_null_for_invalid_body()
{
- (Dictionary Headers, ReadOnlyMemory Body)? actual = EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, new ContextBag(), new ReadOnlyMemory());
+ var bodyWriter = new ArrayBufferWriter();
+ Dictionary? actual = EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, ReadOnlySpan.Empty, new ContextBag(), bodyWriter);
Assert.That(actual, Is.Null);
}
@@ -293,7 +292,8 @@ public void Should_return_null_for_invalid_body()
[Test]
public void Should_emit_metric_for_invalid_body()
{
- EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, new ContextBag(), new ReadOnlyMemory());
+ var bodyWriter = new ArrayBufferWriter();
+ EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, ReadOnlySpan.Empty, new ContextBag(), bodyWriter);
var attemptCounterSnapshot = AttemptCounter.GetMeasurementSnapshot();
var invalidMessageCounterSnapshot = InvalidMessageCounter.GetMeasurementSnapshot();
@@ -448,7 +448,9 @@ public void Should_record_metric_when_data_base64_property_is_present()
var payloadWithUpperCaseKeys = Payload.ToDictionary(p => p.Key.ToUpper(), p => p.Value);
string serializedBody = JsonSerializer.Serialize(payloadWithUpperCaseKeys);
var fullBody = new ReadOnlyMemory(Encoding.UTF8.GetBytes(serializedBody));
- return EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, new ContextBag(), fullBody);
+ var bodyWriter = new ArrayBufferWriter();
+ var headers = EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, fullBody.Span, new ContextBag(), bodyWriter);
+ return headers == null ? null : (headers, new ReadOnlyMemory(bodyWriter.WrittenSpan.ToArray()));
}
void AssertTypicalFields((Dictionary Headers, ReadOnlyMemory body) actual, bool shouldHaveTime = true)
diff --git a/src/NServiceBus.Envelope.CloudEvents.Tests/StrictCloudEventJsonStructuredEnvelopeHandlerTests.cs b/src/NServiceBus.Envelope.CloudEvents.Tests/StrictCloudEventJsonStructuredEnvelopeHandlerTests.cs
index c081ef5..2d414b8 100644
--- a/src/NServiceBus.Envelope.CloudEvents.Tests/StrictCloudEventJsonStructuredEnvelopeHandlerTests.cs
+++ b/src/NServiceBus.Envelope.CloudEvents.Tests/StrictCloudEventJsonStructuredEnvelopeHandlerTests.cs
@@ -1,13 +1,11 @@
namespace NServiceBus.Envelope.CloudEvents.Tests;
-using System;
-using System.Collections.Generic;
+using System.Buffers;
using System.Text;
using System.Text.Json;
using Extensibility;
using Fakes;
using Microsoft.Extensions.Diagnostics.Metrics.Testing;
-using NServiceBus;
using NUnit.Framework;
[TestFixture]
@@ -421,9 +419,10 @@ public void Should_emit_metric_for_wrong_content_type()
[Test]
public void Should_throw_for_invalid_body()
{
- Assert.Throws(() =>
+ Assert.Throws(Is.InstanceOf(), () =>
{
- EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, new ContextBag(), new ReadOnlyMemory());
+ var bodyWriter = new ArrayBufferWriter();
+ EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, ReadOnlySpan.Empty, new ContextBag(), bodyWriter);
});
}
@@ -432,8 +431,8 @@ public void Should_emit_metric_for_invalid_body()
{
try
{
- EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, new ContextBag(),
- new ReadOnlyMemory());
+ var bodyWriter = new ArrayBufferWriter();
+ EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, ReadOnlySpan.Empty, new ContextBag(), bodyWriter);
}
catch (Exception)
{
@@ -464,7 +463,9 @@ public void Should_emit_metric_for_invalid_body()
var payloadWithUpperCaseKeys = Payload.ToDictionary(p => p.Key.ToUpper(), p => p.Value);
string serializedBody = JsonSerializer.Serialize(payloadWithUpperCaseKeys);
var fullBody = new ReadOnlyMemory(Encoding.UTF8.GetBytes(serializedBody));
- return EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, new ContextBag(), fullBody);
+ var bodyWriter = new ArrayBufferWriter();
+ var headers = EnvelopeHandler.UnwrapEnvelope(NativeMessageId, NativeHeaders, fullBody.Span, new ContextBag(), bodyWriter);
+ return headers == null ? null : (headers, new ReadOnlyMemory(bodyWriter.WrittenSpan.ToArray()));
}
void AssertTypicalFields((Dictionary Headers, ReadOnlyMemory body) actual, bool shouldHaveTime = true)
diff --git a/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeHandler.cs b/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeHandler.cs
index 026c31e..69aec70 100644
--- a/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeHandler.cs
+++ b/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeHandler.cs
@@ -1,8 +1,6 @@
namespace NServiceBus.Envelope.CloudEvents;
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Buffers;
using Extensibility;
using Logging;
@@ -24,9 +22,8 @@ class CloudEventAmqpBinaryEnvelopeHandler(CloudEventsMetrics metrics, CloudEvent
{
static readonly ILog Log = LogManager.GetLogger();
- public (Dictionary headers, ReadOnlyMemory body)? UnwrapEnvelope(
- string nativeMessageId, IDictionary incomingHeaders,
- ContextBag extensions, ReadOnlyMemory incomingBody)
+ public Dictionary? UnwrapEnvelope(string nativeMessageId, IDictionary incomingHeaders,
+ ReadOnlySpan incomingBody, ContextBag extensions, IBufferWriter bodyWriter)
{
metrics.RecordAttemptingToUnwrap(CloudEventsMetrics.CloudEventTypes.AMQP_BINARY);
var caseInsensitiveHeaders = ToCaseInsensitiveDictionary(incomingHeaders);
@@ -34,8 +31,9 @@ class CloudEventAmqpBinaryEnvelopeHandler(CloudEventsMetrics metrics, CloudEvent
{
return null;
}
- var headers = ExtractHeaders(nativeMessageId, caseInsensitiveHeaders);
- return (headers, incomingBody);
+
+ bodyWriter.Write(incomingBody);
+ return ExtractHeaders(nativeMessageId, caseInsensitiveHeaders);
}
static Dictionary ToCaseInsensitiveDictionary(IDictionary incomingHeaders) =>
diff --git a/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeUnwrapper.cs b/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeUnwrapper.cs
index e94fa8c..a12e0dd 100644
--- a/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeUnwrapper.cs
+++ b/src/NServiceBus.Envelope.CloudEvents/CloudEventAmqpBinaryEnvelopeUnwrapper.cs
@@ -5,7 +5,7 @@ namespace NServiceBus.Envelope.CloudEvents;
///
/// Unwrapper for AMQP Binary cloud events envelopes.
///
-public class CloudEventAmqpBinaryEnvelopeUnwrapper() : EnvelopeUnwrapper
+public class CloudEventAmqpBinaryEnvelopeUnwrapper : EnvelopeUnwrapper
{
internal override void RegisterUnwrapper(FeatureConfigurationContext context, Action