Giacomo Pirinoli
Giacomo Pirinoli

Reputation: 558

Azure Function App - How to defer and re-receive an unprocessable message

I have the following Azure architecture:

IoTDevices ---> IoTHub ---> Function App

where:

now in the Function App I have something like this:

public static void Run([IoTHubTrigger("messages/events", Connection = "EventHubConnection")]EventData message, TraceWriter log)
{
  string messageString = Encoding.UTF8.GetString(message.GetBytes());
  //do some processing with messageString as input
}

for several reasons, there are cases in which the processing can not be performed; I'd like to save the message SequenceNumber and defer the message so that later, when the processing become available again, I can re-receive the message from the IoTHub. So summarizing, the questions are:

Upvotes: 0

Views: 530

Answers (1)

Neil
Neil

Reputation: 11889

https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-deferral

Deferred messages remain in the main queue along with all other active messages (unlike dead-letter messages that live in a subqueue), but they can no longer be received using the regular Receive/ReceiveAsync functions. Deferred messages can be discovered via message browsing if an application loses track of them.

Upvotes: 1

Related Questions