Polly Microsoft Teams

From Poly Studio X30 and X50 Microsoft Teams Rooms on Android for smaller meeting spaces to Poly G-Series Microsoft Teams Rooms on Windows that support up to large rooms and allow room AV integrations, Poly room solutions for Microsoft Teams deliver simple yet powerful collaboration experiences that will get the best out of your meetings. The Polly App offers a native integration in Microsoft Teams to foster collaboration and productivity. By creating instant polls with live results, your team can easily participate while Polly makes it easy and fun for users to engage and increase participation. With the updated version of Polly, you can now create a poll from the Polly Tab. Microsoft Teams for Education has some slight additions to standard Microsoft Teams, making quizzes and tests slightly easier. For this post, we are concentrating on how to use standard Microsoft Teams and Forms to create a quiz in a tab on a Teams channel; this approach could also be used to create a Team survey. Agile Polly Empower your team with an automated, contextual standup experience right in Microsoft Teams. Polly is an engagement app that captures instant, contextual feedback from your team in seconds directly in Microsoft Teams. Just about anyone can get started with Polly to quickly reach their colleagues and make data-driven decisions instantly.

-->

The recommended approach for retries with exponential backoff is to take advantage of more advanced .NET libraries like the open-source Polly library.

Polly is a .NET library that provides resilience and transient-fault handling capabilities. You can implement those capabilities by applying Polly policies such as Retry, Circuit Breaker, Bulkhead Isolation, Timeout, and Fallback. Polly targets .NET Framework 4.x and .NET Standard 1.0, 1.1, and 2.0 (which supports .NET Core and later).

The following steps show how you can use Http retries with Polly integrated into IHttpClientFactory, which is explained in the previous section.

Microsoft Teams User Guide

Reference the .NET 5 packages

IHttpClientFactory is available since .NET Core 2.1 however we recommend you to use the latest .NET 5 packages from NuGet in your project. You typically also need to reference the extension package Microsoft.Extensions.Http.Polly.

Polly Microsoft Teams

Configure a client with Polly's Retry policy, in Startup

As shown in previous sections, you need to define a named or typed client HttpClient configuration in your standard Startup.ConfigureServices(...) method, but now, you add incremental code specifying the policy for the Http retries with exponential backoff, as below:

The AddPolicyHandler() method is what adds policies to the HttpClient objects you'll use. In this case, it's adding a Polly's policy for Http Retries with exponential backoff.

To have a more modular approach, the Http Retry Policy can be defined in a separate method within the Startup.cs file, as shown in the following code:

With Polly, you can define a Retry policy with the number of retries, the exponential backoff configuration, and the actions to take when there's an HTTP exception, such as logging the error. In this case, the policy is configured to try six times with an exponential retry, starting at two seconds.

Microsoft

Microsoft Teams Polly Private Channel

Add a jitter strategy to the retry policy

A regular Retry policy can affect your system in cases of high concurrency and scalability and under high contention. To overcome peaks of similar retries coming from many clients in partial outages, a good workaround is to add a jitter strategy to the retry algorithm/policy. This strategy can improve the overall performance of the end-to-end system. As recommended in Polly: Retry with Jitter, a good jitter strategy can be implemented by smooth and evenly distributed retry intervals applied with a well-controlled median initial retry delay on an exponential backoff. This approach helps to spread out the spikes when the issue arises. The principle is illustrated by the following example:

Polly Microsoft Teams

Additional resources

Microsoft Teams Polly Edit Poll

  • Retry pattern
    https://docs.microsoft.com/azure/architecture/patterns/retry

  • Polly and IHttpClientFactory
    https://github.com/App-vNext/Polly/wiki/Polly-and-HttpClientFactory

  • Polly (.NET resilience and transient-fault-handling library)
    https://github.com/App-vNext/Polly

  • Polly: Retry with Jitter
    https://github.com/App-vNext/Polly/wiki/Retry-with-jitter

  • Marc Brooker. Jitter: Making Things Better With Randomness
    https://brooker.co.za/blog/2015/03/21/backoff.html