question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] QueueMessage sample for complex types

See original GitHub issue

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 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:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
svrooijcommented, Jul 5, 2022

@RakeshMohanMSFT something like:

// Im not sure what it should return probably the same as SendMessageAsync
public static Task<?> SendMessageAsync<T>(this QueueClient client, T complexObject, TimeSpan? visibilityTimeout = null, TimeSpan? timeToLive = null, CancellationToken cancellationToken = default) {
  BinaryData data = .... // Serialize complexObject to BinaryData in the way the library does
  return client.SendMessageAsync(data, visibilityTimeout, timeToLive, cancellationToken);
}
0reactions
msftbot[bot]commented, Jul 6, 2022

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 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

Author: svrooij
Assignees: RakeshMohanMSFT
Labels:

Storage, Service Attention, Client, customer-reported, feature-request, needs-team-attention

Milestone: -
Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Storage Queue - CloudQueueMessage different types
I have a queue in Azure storage and I want to be able to add different message types to the queue and parse...
Read more >
Get Messages (REST API) - Azure Storage
The Get Messages operation retrieves one or more messages from the front of the queue.
Read more >
Azure Queue Storage Tutorial - YouTube
In this episodes live demo of - Creating queue storage - Managing queues and their data - Implementing fan-out scenario using Logic Apps...
Read more >
Message metadata - Amazon Simple Queue Service
Message attribute data types instruct Amazon SQS how to handle the corresponding message attribute values. For example, if the type is Number ,...
Read more >
Get JMS Queue Message
Get JMS Queue Message is an asynchronous activity that retrieves a message from the specified queue. You can use this activity to perform...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found