From 64502737ea6246f2a035dc4b4f1893833a0ae771 Mon Sep 17 00:00:00 2001 From: Jesse Squire Date: Wed, 22 Feb 2023 12:51:51 -0500 Subject: [PATCH 1/3] [Messaging Extensions] Release Prep (Feb 2023) The purpose of these changes is to prepare the Event Hubs and Service Bus extensions packages for release. --- .../CHANGELOG.md | 8 ++++---- .../Microsoft.Azure.WebJobs.Extensions.EventHubs.csproj | 2 +- .../CHANGELOG.md | 8 ++------ .../Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md index f4db6903ace9e..5fc8ee6768580 100644 --- a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md +++ b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md @@ -1,19 +1,19 @@ # Release History -## 5.2.0-beta.1 (Unreleased) +## 5.2.0 (2023-02-23) ### Features Added - Added the an overload for `IAsyncCollector` allowing a partition key to be specified. Because `IAsyncCollector` is owned by the Functions runtime, this method could not be directly added. Instead, this has been implemented as an extension method within the Event Hubs extension package. Unfortunately, this knowingly makes the overload unable to be mocked. -### Breaking Changes +- Target-based scaling support has been added, allowing instances for Event Hubs-triggered Functions to more accurately calculate their scale needs, adjust more quickly as the number of events waiting to be processed changes. This will also reduce duplicate event processing as the instance count changes. + +- A new setting, `UnprocessedEventThreshold` has been added to help tune target-based scaling. More details can be found in the [host.json documentation](https://learn.microsoft.com/azure/azure-functions/functions-bindings-event-hubs?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#hostjson-settings). ### Bugs Fixed - Fixed a bug with creation of the event processor used by the trigger, where configuring an `eventHubName` that does not match the one that appears as `EntityPath` in the connection string would throw. The behavior now follows that of other clients and gives precedence to the entity path in the connection string. -### Other Changes - ## 5.1.2 (2022-08-10) ### Bugs Fixed diff --git a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Microsoft.Azure.WebJobs.Extensions.EventHubs.csproj b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Microsoft.Azure.WebJobs.Extensions.EventHubs.csproj index 820802cbd7d4a..8843e551b41f3 100644 --- a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Microsoft.Azure.WebJobs.Extensions.EventHubs.csproj +++ b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Microsoft.Azure.WebJobs.Extensions.EventHubs.csproj @@ -3,7 +3,7 @@ netstandard2.0 Microsoft Azure WebJobs SDK EventHubs Extension - 5.2.0-beta.1 + 5.2.0 5.1.2 $(NoWarn);AZC0001;CS1591;SA1636 diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/CHANGELOG.md b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/CHANGELOG.md index dd44a1a007004..edd91aecb39f6 100644 --- a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/CHANGELOG.md +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 5.9.0-beta.1 (Unreleased) +## 5.9.0 (2023-02-23) ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Target-based scaling support has been added, allowing instances for Service Bus-triggered Functions to more accurately calculate their scale needs and adjust more quickly as the number of messages waiting to be processed changes. ## 5.8.1 (2022-11-09) diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj index 25062096cf330..26942b9b71b00 100644 --- a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj @@ -3,7 +3,7 @@ netstandard2.0 Microsoft Azure WebJobs SDK ServiceBus Extension - 5.9.0-beta.1 + 5.9.0 5.8.1 $(NoWarn);AZC0001;CS1591;SA1636 From 3046cd42fe735f2f6343e59102778fe68e6112d4 Mon Sep 17 00:00:00 2001 From: Jesse Squire Date: Wed, 22 Feb 2023 15:44:27 -0500 Subject: [PATCH 2/3] Removing project dependency temporarily --- .../ServiceBusExtensionConfigProvider.cs | 6 +- ...Azure.WebJobs.Extensions.ServiceBus.csproj | 2 + .../tests/MessageInteropTests.cs | 100 +++++++++--------- 3 files changed, 58 insertions(+), 50 deletions(-) diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusExtensionConfigProvider.cs b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusExtensionConfigProvider.cs index 3ba4813dcda6a..f4fa89d6dbe9d 100644 --- a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusExtensionConfigProvider.cs +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusExtensionConfigProvider.cs @@ -112,7 +112,11 @@ public void Initialize(ExtensionConfigContext context) internal static ParameterBindingData ConvertReceivedMessageToBindingData(ServiceBusReceivedMessage message) { - ReadOnlyMemory messageBytes = message.GetRawAmqpMessage().ToBytes().ToMemory(); +// TEMP (target scale release): +//ReadOnlyMemory messageBytes = message.GetRawAmqpMessage().ToBytes().ToMemory(); +ReadOnlyMemory messageBytes = Array.Empty(); +// END TEMP + byte[] lockTokenBytes = Guid.Parse(message.LockToken).ToByteArray(); // The lock token is a 16 byte GUID diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj index 26942b9b71b00..6122e85a98a53 100644 --- a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Microsoft.Azure.WebJobs.Extensions.ServiceBus.csproj @@ -35,8 +35,10 @@ + diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/MessageInteropTests.cs b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/MessageInteropTests.cs index c5d921ff54844..d079036d9c3df 100644 --- a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/MessageInteropTests.cs +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/MessageInteropTests.cs @@ -36,55 +36,57 @@ public void RunSerializerTests(string testCaseName) Assert.AreEqual(book, returned); } - [Test] - public void ParameterBindingDataTest() - { - var lockToken = Guid.NewGuid(); - var message = ServiceBusModelFactory.ServiceBusReceivedMessage( - body: BinaryData.FromString("body"), - messageId: "messageId", - correlationId: "correlationId", - sessionId: "sessionId", - replyTo: "replyTo", - replyToSessionId: "replyToSessionId", - contentType: "contentType", - subject: "label", - to: "to", - partitionKey: "partitionKey", - viaPartitionKey: "viaPartitionKey", - deadLetterSource: "deadLetterSource", - enqueuedSequenceNumber: 1, - lockTokenGuid: lockToken); - - var bindingData = ServiceBusExtensionConfigProvider.ConvertReceivedMessageToBindingData(message); - Assert.AreEqual("application/octet-stream", bindingData.ContentType); - Assert.AreEqual("1.0", bindingData.Version); - Assert.AreEqual("AzureServiceBusReceivedMessage", bindingData.Source); - - var bytes = bindingData.Content.ToMemory(); - var lockTokenBytes = bytes.Slice(0, 16).ToArray(); - Assert.AreEqual(lockToken.ToByteArray(), lockTokenBytes); - - var deserialized = ServiceBusReceivedMessage.FromAmqpMessage( - AmqpAnnotatedMessage.FromBytes( - BinaryData.FromBytes(bytes.Slice(16, bytes.Length - 16))), - BinaryData.FromBytes(lockTokenBytes)); - - Assert.AreEqual(message.Body.ToArray(), deserialized.Body.ToArray()); - Assert.AreEqual(message.MessageId, deserialized.MessageId); - Assert.AreEqual(message.CorrelationId, deserialized.CorrelationId); - Assert.AreEqual(message.SessionId, deserialized.SessionId); - Assert.AreEqual(message.ReplyTo, deserialized.ReplyTo); - Assert.AreEqual(message.ReplyToSessionId, deserialized.ReplyToSessionId); - Assert.AreEqual(message.ContentType, deserialized.ContentType); - Assert.AreEqual(message.Subject, deserialized.Subject); - Assert.AreEqual(message.To, deserialized.To); - Assert.AreEqual(message.PartitionKey, deserialized.PartitionKey); - Assert.AreEqual(message.TransactionPartitionKey, deserialized.TransactionPartitionKey); - Assert.AreEqual(message.DeadLetterSource, deserialized.DeadLetterSource); - Assert.AreEqual(message.EnqueuedSequenceNumber, deserialized.EnqueuedSequenceNumber); - Assert.AreEqual(message.LockToken, deserialized.LockToken); - } +// TEMP (target scale release): + //[Test] + //public void ParameterBindingDataTest() + //{ + // var lockToken = Guid.NewGuid(); + // var message = ServiceBusModelFactory.ServiceBusReceivedMessage( + // body: BinaryData.FromString("body"), + // messageId: "messageId", + // correlationId: "correlationId", + // sessionId: "sessionId", + // replyTo: "replyTo", + // replyToSessionId: "replyToSessionId", + // contentType: "contentType", + // subject: "label", + // to: "to", + // partitionKey: "partitionKey", + // viaPartitionKey: "viaPartitionKey", + // deadLetterSource: "deadLetterSource", + // enqueuedSequenceNumber: 1, + // lockTokenGuid: lockToken); + + // var bindingData = ServiceBusExtensionConfigProvider.ConvertReceivedMessageToBindingData(message); + // Assert.AreEqual("application/octet-stream", bindingData.ContentType); + // Assert.AreEqual("1.0", bindingData.Version); + // Assert.AreEqual("AzureServiceBusReceivedMessage", bindingData.Source); + + // var bytes = bindingData.Content.ToMemory(); + // var lockTokenBytes = bytes.Slice(0, 16).ToArray(); + // Assert.AreEqual(lockToken.ToByteArray(), lockTokenBytes); + + // var deserialized = ServiceBusReceivedMessage.FromAmqpMessage( + // AmqpAnnotatedMessage.FromBytes( + // BinaryData.FromBytes(bytes.Slice(16, bytes.Length - 16))), + // BinaryData.FromBytes(lockTokenBytes)); + + // Assert.AreEqual(message.Body.ToArray(), deserialized.Body.ToArray()); + // Assert.AreEqual(message.MessageId, deserialized.MessageId); + // Assert.AreEqual(message.CorrelationId, deserialized.CorrelationId); + // Assert.AreEqual(message.SessionId, deserialized.SessionId); + // Assert.AreEqual(message.ReplyTo, deserialized.ReplyTo); + // Assert.AreEqual(message.ReplyToSessionId, deserialized.ReplyToSessionId); + // Assert.AreEqual(message.ContentType, deserialized.ContentType); + // Assert.AreEqual(message.Subject, deserialized.Subject); + // Assert.AreEqual(message.To, deserialized.To); + // Assert.AreEqual(message.PartitionKey, deserialized.PartitionKey); + // Assert.AreEqual(message.TransactionPartitionKey, deserialized.TransactionPartitionKey); + // Assert.AreEqual(message.DeadLetterSource, deserialized.DeadLetterSource); + // Assert.AreEqual(message.EnqueuedSequenceNumber, deserialized.EnqueuedSequenceNumber); + // Assert.AreEqual(message.LockToken, deserialized.LockToken); + //} +// END TEMP private ServiceBusMessage GetBrokeredMessage(XmlObjectSerializer serializer, TestBook book) { From e9a45940e43c90982065ba6337ec8515f5415af6 Mon Sep 17 00:00:00 2001 From: Jesse Squire Date: Wed, 22 Feb 2023 18:08:13 -0500 Subject: [PATCH 3/3] Update sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md Co-authored-by: Christopher Scott --- .../Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md index 5fc8ee6768580..2070a634a003c 100644 --- a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md +++ b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md @@ -6,7 +6,7 @@ - Added the an overload for `IAsyncCollector` allowing a partition key to be specified. Because `IAsyncCollector` is owned by the Functions runtime, this method could not be directly added. Instead, this has been implemented as an extension method within the Event Hubs extension package. Unfortunately, this knowingly makes the overload unable to be mocked. -- Target-based scaling support has been added, allowing instances for Event Hubs-triggered Functions to more accurately calculate their scale needs, adjust more quickly as the number of events waiting to be processed changes. This will also reduce duplicate event processing as the instance count changes. +- Target-based scaling support has been added, allowing instances for Event Hubs-triggered Functions to more accurately calculate their scale needs and adjust more quickly as the number of events waiting to be processed changes. This will also reduce duplicate event processing as the instance count changes. - A new setting, `UnprocessedEventThreshold` has been added to help tune target-based scaling. More details can be found in the [host.json documentation](https://learn.microsoft.com/azure/azure-functions/functions-bindings-event-hubs?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#hostjson-settings).