[QUERY] QueueMessage sample for complex types
See original GitHub issueLibrary name and version
Microsoft.Azure.WebJobs.Extensions.Storage.Queues 5.0.1
Query/Question
We are currently using the IAsyncCollector<SomeType>
to push message the a regular storage queue. This works great, but we want to control the VisibilityTimeout
. So we want to migrate to the QueueClient
binding, which provides us with the queueClient.SendAsync(BinaryData data, TimeSpan? visibilityTimeout)
method.
How do we serialize SomeType (complex object) to BinaryData
, in such a way we don’t need to change the processing function, which uses [QueueTrigger("queue-name", Connection = "AzureWebJobsStorage")] SomeType queueItem,
.
Is it JSON? Newtonsoft vs System.Text.JSON Or something else (MessagePack, XML)? Default serializer settings?
I’ve checked the examples but the only show how to relay messages from one queue to the next and not how to push messages with the visibility timeout or even how to create the binary data for the queues
Providing this as an extension would also be great, that way people can use all the goodies with the QueueClient, without the complexity of serializing, since that would be done by the same version of the library. Something like:
queueClient.SendMessage<T>(T complexObject, TimeSpan? visibilityTimeout = null, TimeSpan? timeToLive = null, CancellationToken cancellationToken = default);
Environment
Hosting in Azure Functions (4.6.1.18388), .NET 6
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
@RakeshMohanMSFT something like:
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.
Issue Details
Library name and version
Microsoft.Azure.WebJobs.Extensions.Storage.Queues 5.0.1
Query/Question
We are currently using the
IAsyncCollector<SomeType>
to push message the a regular storage queue. This works great, but we want to control theVisibilityTimeout
. So we want to migrate to theQueueClient
binding, which provides us with thequeueClient.SendAsync(BinaryData data, TimeSpan? visibilityTimeout)
method.How do we serialize SomeType (complex object) to
BinaryData
, in such a way we don’t need to change the processing function, which uses[QueueTrigger("queue-name", Connection = "AzureWebJobsStorage")] SomeType queueItem,
.Is it JSON? Newtonsoft vs System.Text.JSON Or something else (MessagePack, XML)? Default serializer settings?
I’ve checked the examples but the only show how to relay messages from one queue to the next and not how to push messages with the visibility timeout or even how to create the binary data for the queues
Providing this as an extension would also be great, that way people can use all the goodies with the QueueClient, without the complexity of serializing, since that would be done by the same version of the library. Something like:
Environment
Hosting in Azure Functions (4.6.1.18388), .NET 6
Storage
,Service Attention
,Client
,customer-reported
,feature-request
,needs-team-attention