Hi @GuidoL Greetings! Thank you for posting the question here. There seems to be some changes in processing events between Microsoft.Azure.ServiceBus
and Azure.Messaging.ServiceBus
The deprecated package Microsoft.Azure.ServiceBus
uses Encoding.UTF8.GetString(message.Body)
to receive the message from the queue.
To achieve the same in the Azure.Messaging.ServiceBus
you can do the following.
// get the message body as a string
string body = receivedMessage.Body.ToString();
Please also note that the nee package uses the message of type ServiceBusReceivedMessage
and not Message
. Here is a sample Azure function implementation of the new package.
[Function(nameof(ServiceBusReceivedMessageFunction))]
[ServiceBusOutput("outputQueue", Connection = "ServiceBusConnection")]
public string ServiceBusReceivedMessageFunction(
[ServiceBusTrigger("queue", Connection = "ServiceBusConnection")] ServiceBusReceivedMessage message)
{
_logger.LogInformation("Message ID: {id}", message.MessageId);
_logger.LogInformation("Message Body: {body}", message.Body.ToString());
_logger.LogInformation("Message Content-Type: {contentType}", message.ContentType);
var outputMessage = $"Output message created at {DateTime.Now}";
return outputMessage;
}
There are no changes in the package that pushes the data to ADT. Once you get the data you can use the same rest of the code to push data. You can find more details on the changes between the packages from the Migration Guide.
Hope this helps! Please let us know if you have any additional questions or need further assistance on this.
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.