circuit-breaker

Should Polly Policies be singletons?

筅森魡賤 提交于 2020-01-02 04:37:19
问题 I have a query, IGetHamburgers , that calls an external API. I've registered the implementation of IGetHamburgers in my DI container as a Singleton. Im using Polly as a Circuitbreaker, if two requests fails the circuit will open. My goal is that all calls to the Hamburger api should go through the same circuitbreaker, if GetHamburgers fails, then all other calls should fail as well. How should I use my Policy? Should I register my Policy as a field like this: private Policy _policy; private

Wrap spring integration outbound gateway calls with hystrix command

荒凉一梦 提交于 2019-12-24 08:47:35
问题 I want to wrap the call to outbound gateway in my integration application using hystrix command similar to how it is available in Spring boot application. <int-http:outbound-gateway id="outbound.gateway" request-channel="get.request.channel" url="http://localhost:9090/profileapplication" http-method="GET" charset='UTF-8' reply-channel="reply.channel" > </int-http:outbound-gateway> I have my outbound gateway as above. I need this for a scenario where the target application is frequently down

Stop Spring Cloud Stream @StreamListener from listening when target system is down

拥有回忆 提交于 2019-12-23 17:27:40
问题 I have an application that gets messages from Kafka and calls a target system to update a legacy Oracle DB. I want to enable a scenario where if the target system is down, to leave the messages on Kafka bus and not process them for a given period of time. I was thinking of some Circuit-breaker Hystrix-based solution, but I can't find any mechanism to tell Spring Cloud Stream to "stop" the event listening. The only other alternative I can think of is if the circuit breaker is open, to transfer

Polly framework CircuitBreakerAsync does not retry if exception occur

空扰寡人 提交于 2019-12-23 10:48:25
问题 I am using Polly framework for transient fault handling. For synchronous operations Polly circuit breaker policy works fine but when I created its async version it does not retries the execution. Kindly suggest : Asynchronous method : private async static Task HelloWorld() { if (DateTime.Now < programStartTime.AddSeconds(10)) { Console.WriteLine("Task Failed."); throw new TimeoutException(); } await Task.Delay(TimeSpan.FromSeconds(1)); Console.WriteLine("Task Completed."); } Polly circuit

Test drive Hystrix Circuit Breaker configuration

允我心安 提交于 2019-12-19 11:39:09
问题 Our application is written in anit-fragile manner by implementing circuit breaker pattern using Hystrix. The whole of the application is created using test driven practice but is stuck at the point where we need to implement the circuit breaker strategy by configuring the same on the methods. Below is the sample configuration used by us - @HystrixCommand(commandProperties = { @HystrixProperty(name = "circuitBreaker.enabled", value = "true"), @HystrixProperty(name = "circuitBreaker

Concatenate many Future[Seq] into one Future[Seq]

拥有回忆 提交于 2019-12-12 15:19:15
问题 Without Future, that's how I combine all smaller Seq into one big Seq with a flatmap category.getCategoryUrlKey(id: Int):Seq[Meta] // main method val appDomains: Seq[Int] val categories:Seq[Meta] = appDomains.flatMap(category.getCategoryUrlKey(_)) Now the method getCategoryUrlKey could fail. I put a circuit breaker in front to avoid to call it for the next elements after an amount of maxFailures . Now the circuit breaker doesn't return a Seq but a Future[Seq] lazy val breaker = new akka

how to implement custom method when Polly circuit is close

故事扮演 提交于 2019-12-11 17:40:02
问题 I have method which returns IAsyncPolicy<HttpResponseMessage> and it has 2 or more policies along with CircuitBreaker and part of my DI. Now in my implementation class I added one extra fallbackPolicy to handle BrokenCircuitException and wrap it with IAsyncPolicy<HttpResponseMessage> (AsyncPolicy) Now I did my custom method implementation within DoWork() method, Great!!! Thanks to FallbackAsync policy where I'm catching BrokenCircuitException exception, means when circuit is open. var

Significant terms causes a CircuitBreakingException

寵の児 提交于 2019-12-10 13:23:27
问题 I've got a mid-size elasticsearch index (1.46T or ~1e8 docs). It's running on 4 servers which each have 64GB Ram split evenly between elastic and the OS (for caching). I want to try out the new "Significant terms" aggregation so I fired off the following query... { "query": { "ids": { "type": "document", "values": [ "xCN4T1ABZRSj6lsB3p2IMTffv9-4ztzn1R11P_NwTTc" ] } }, "aggregations": { "Keywords": { "significant_terms": { "field": "Body" } } }, "size": 0 } Which should compare the body of the

How do I use a circuit breaker?

ぃ、小莉子 提交于 2019-12-05 12:36:52
问题 I'm looking for ways to make remote calls to services out of my control until a connect is successful. I also don't want to simply set a timer where an action gets executed every n seconds/minutes until successful. After a bunch of research it appears that the circuit breaker pattern is a great fit. I found an implementation that uses an Castle Windsor interceptor, which looks awesome. The only problem is I don't know how to use it. From the few articles I found regarding the topic the only

Should Polly Policies be singletons?

烈酒焚心 提交于 2019-12-05 08:36:24
I have a query, IGetHamburgers , that calls an external API. I've registered the implementation of IGetHamburgers in my DI container as a Singleton. Im using Polly as a Circuitbreaker, if two requests fails the circuit will open. My goal is that all calls to the Hamburger api should go through the same circuitbreaker, if GetHamburgers fails, then all other calls should fail as well. How should I use my Policy? Should I register my Policy as a field like this: private Policy _policy; private Policy Policy { get { if(this_policy != null) { return this_policy; } this._policy = Policy .Handle