Last active
April 26, 2020 05:33
-
-
Save finesse-fingers/c49c35fdad7f342bfd49bebb4cbd8623 to your computer and use it in GitHub Desktop.
Azure function servicebus queue trigger with MessageReceiver binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0", | |
"logging": { | |
"applicationInsights": { | |
"samplingExcludedTypes": "Request", | |
"samplingSettings": { | |
"isEnabled": true | |
} | |
} | |
}, | |
"extensions": { | |
"serviceBus": { | |
"messageHandlerOptions": { | |
"maxConcurrentCalls": 8, | |
"maxAutoRenewDuration": "00:55:00", | |
"autoComplete": false | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("SbusQueueTriggerFunction")] | |
public async Task RunAsync( | |
[ServiceBusTrigger("%QueueName%", Connection = "SbusConnectionString")] | |
Message message, | |
MessageReceiver messageReceiver, | |
ILogger log) | |
{ | |
// ... | |
// dead-letter the msg | |
await messageReceiver.DeadLetterAsync(message.SystemProperties.LockToken, "reason: ..."); | |
// manually complete the message | |
await messageReceiver.CompleteAsync(message.SystemProperties.LockToken); | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment