Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
Azure Function .Net 5 Using ServiceBusTrigger

I'm using .net 5 azure function with ServiceBusTrigger. In previous versin. I was using a parametr MessageReceiver to tell azure that I compleated task. For that I used

await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);

My problem is that i new version (.net5) unlike the previous version (.net core 3.1) is param in string (json) not in object (maybe it's the error but I don't know which object to use, object I tried was Microsoft.Azure.ServiceBus.Core.MessageReceiver).

But now i do not have the object so i can not call the method.

Does someone knows the answer? Thak you for your time.

Example of my code:

Function("TasksFunction")]
public async Task Run([ServiceBusTrigger("queue", Connection = "ConnectionString")] string message, string id, MessageReceiver messageReceiver, FunctionContext executionContext)
{
    try
    {
        await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);
        await DoWorkAsync(messageReceiver, message);
    }
    catch (Exception e)
    {
        log.LogCritical(e);
    }
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try to bind your message to Message type instead of string

public async Task Run([ServiceBusTrigger("queue", Connection = "ConnectionString")] Message  message, string id, MessageReceiver messageReceiver, FunctionContext executionContext)

Message has property SystemPropertiesCollection and use message.SystemProperties.LockToken

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!