4

I am carrying out a PoC on Ocelot Gateway to use for our microservices architecture. I have successfully used the Gateway to perform all the routing tasks uptil now.

It provides a QoS Service that helds configuration in ocelot.json for circuit breaker and breaks the circuit for a duration.

The configurations set in my ocelot.json file are as follows for a specific route:

{
      "DownstreamPathTemplate": "/api/classes/exception/{id}",
      "DownstreamScheme": "http",
      "UpstreamPathTemplate": "/classes/exception/{id}",
      "ServiceName": "class-service",
      "UpstreamHttpMethod": [ "Get" ],
      "LoadBalancerOptions": {
        "Type": "LeastConnection"
      },
      "QoSOptions": {
        "ExceptionsAllowedBeforeBreaking": 2,
        "DurationOfBreak": 10000,
        "TimeoutValue": 3000
      }
    }

Now, this works fine for the timeout issue, it breaks the circuit for 10s when the route does not respond in 3s.

But for the exception case, it does not break the circuit when there is an exception arising for 2 times when the route is being called.

Are there any more configurations required?

I have added Nuget Package for Ocelot and Ocelot.Provider.Polly and also added the following in my Startup.cs file:

 s.AddOcelot().AddPolly();

Please help me through this. I have followed the [Ocelot Documentation] https://ocelot.readthedocs.io/en/latest/features/qualityofservice.html to implement this

0 Answers0