Try deadletter message on exception
This file contains 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("TopicProcessor")] | |
public static async Task Run( | |
[ServiceBusTrigger("%topic-name%", "%subscription-name%", AccessRights.Manage, Connection = "connection")] BrokeredMessage msg, | |
ILogger log) | |
{ | |
var thing = msg.GetBody<Thing>(); | |
var apiClient = new ApiClient(); | |
try { | |
await apiClient.PostAsync(thing); | |
} | |
catch (BadRequestException) { | |
await msg.DeadLetterAsync("a-reason-code", "An error description"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment