WHAT'S NEW?
Loading...

Custom retry mechanism based on Polly

Index

  • The problem
  • One (of many) solution
  • Code snippet
  • References

The problem

Network connectivity issues, flaky dependencies (APIs, databases, cloud services...) might became a painfull when you work in a production environment. Let's make your life a bit easier with Polly.

One (of many) solution

Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. Polly targets .NET 4.0, .NET 4.5 and .NET Standard 1.1.

The following code snippet allow you to define how your retry will look like based on: number of retries (it works in an exponential way 2, 4, 16 seconds...), retry policy (expected result), action to be retried and exception type on which you want to retry.

Polly provides asynchronous methods so your retries will never block your threads.

Disclaimer: I went for an exponential retry but you can define simple elapsed time to retry on.

Code snippet


References

https://github.com/App-vNext/Polly
http://www.thepollyproject.org


Unit test to validate services registered in your DI engine

Intro


Sometimes, when adding new functionality to your programs you might end up having errors difficult to track. This is the case when using DI and you missed to register one of your dependencies.


Solution


To avoid errors like the one defined in the intro I have created a unit test that checks that all services registered with the container are resolvable. You might find this helpful if you want to verify in the other endpoints that you've got all components for all services properly registered.

This particular case is using Castle Windsor as DI engine.


Docker London - April

Please see here some interesting resources about Docker

Here are some links from Jorge (Sysdig) who gave a great talk on monitoring containers:
How to Monitor Docker Swarm:
Monitoring Kubernetes series:

Slides from the talk:

As promised, Liz (Aqua) also has shared the slides for the great talk on Secrets Management with Docker, Docker Swarm and Aqua. Slides are online at

You may also be interested in a recent blog post (http://blog.aquasec.com/managing-secrets-in-docker-containers) that covers "Managing Secrets in Docker Containers". It also includes a short demo.

The Birthday training materials from Docker are available at


Docker London wouldn't be possible without all of our great sponsors:
  • Docker and HPE (https://www.hpe.com/us/en/home.html) have partnered to help businesses transform and modernize their datacenters with HPE Docker ready servers - a hybrid infrastructure solution that is configured for Docker containers, fully supported by HPE and backed by Docker. Katacoda (https://www.katacoda.com/), Learn Docker, Kubernetes and Cloud Native applications using free interactive tutorials directly in your browser!
  • Hedvig (http://www.hedviginc.com/) provides software-defined storage for enterprises building private, hybrid, or multi-cloud environments. Hedvig is the only storage solution designed for both primary and secondary data which scales in a single cluster across multiple locations, making it ideal for legacy and modern workloads.
  • Rancher (http://rancher.com/) is a complete, open source platform for deploying and managing containers in production. It includes commercially-supported distributions of Kubernetes, Mesos, and Docker Swarm, making it easy to run containerized applications on any infrastructure.
  • AVI Networks (https://www.avinetworks.com/), 30 Seconds to Application Services in Any Data Center or Cloud.
  • Contino (http://www.contino.co.uk/), DevOps & Continuous Delivery Consultancy.
  • Docker (http://www.docker.com/), Build, Ship, and Run Any App, Anywhere.

Agile - Training from Just Eat

Intro
I've been attending an awesome Agile training for two days provided by some workmates from my workplace: Just Eat. It's being pretty good compared with other training I attended in the past. We've covered a lot of stuff, ie:

  • origins, 
  • why we need agile methodologies/framework, 
  • waterfall vs agile, 
  • Bernard chart
  • User stories (assumptions, acceptance criteria)
  • Cross functional requirements
  • Scrum, XP, Crystal Clear and Lean
  • Ceremonies
  • Story mapping / Spam planning (Goal, activities and stories)
  • Project: design and create a new animal who survives to the extinction of the rest of the animals

Here some pictures and shortly more posts with all the stuff from the training explained.



















Happy weekend to everyone!

Docker learning resource (free)

Intro

This week I attended NDC London workshops and one of the most interesting ones was: Running Docker and Containers in Development and Production by Ben Hall. He is the founder of Ocelot Uproar and creator of one of the best resources about Docker I've ever seen in my life: Katacoda.com. Please, take a look at his site if you are interested in this technology because you'll gain a great insight by following the bunch of lessons Ben has created.

Keep learning!


References

http://blog.benhall.me.uk/
https://www.katacoda.com/learn
http://ndc-london.com/workshop/running-docker-and-containers-in-development-and-production/