Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

Clarify usage #20

Description

@ErikAndreas

I struggled a bit to figure out how to actually get a hold of my queued message. Maybe clarify in docs (not sure if what I got is the best way...) what to do with a Memory<byte> object? Maybe my lack of c# knowledge but I think a clarification might be useful?!

so I 'd add a message as usual:

 await batchQueue.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(myDTO)));

and then consume it in my trigger

public static async Task RunAsync([QueueTrigger("batch-queue")]MyDTO myDTO, ILogger log)
{
        // use myDTO here ...
}

using BatchQueueTrigger

public static async System.Task RunAsync([QueueBatchTrigger("batch-queue")]IMessageBatch batch,  ILogger log)
{
        foreach (var msg in batch.Messages)
        {
                MyDTO dto = JsonConvert.DeserializeObject<MyDTO>(System.Text.Encoding.Default.GetString(msg.Payload.ToArray()))
        }
        batch.MarkAllAsProcessed();
}

is there a better way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions