camel git commit: CAMEL-11895: camel-hystrix - Expose state of circuit breaker on JMX mbean / java api on processor.
Repository: camel Updated Branches: refs/heads/camel-2.19.x 798ed7296 -> 7c66b9fd8 CAMEL-11895: camel-hystrix - Expose state of circuit breaker on JMX mbean / java api on processor. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7c66b9fd Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7c66b9fd Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7c66b9fd Branch: refs/heads/camel-2.19.x Commit: 7c66b9fd83eb8ede97406a0ab7c3a87d3e151197 Parents: 798ed72 Author: Claus Ibsen Authored: Wed Oct 11 15:25:41 2017 +0200 Committer: Claus Ibsen Committed: Thu Oct 12 09:07:18 2017 +0200 -- .../component/hystrix/processor/HystrixProcessor.java | 10 ++ .../hystrix/processor/HystrixManagementTest.java | 3 +++ 2 files changed, 13 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/7c66b9fd/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java -- diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java index 3993a264..2ad 100644 --- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java +++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java @@ -19,6 +19,7 @@ package org.apache.camel.component.hystrix.processor; import java.util.ArrayList; import java.util.List; +import com.netflix.hystrix.HystrixCircuitBreaker; import com.netflix.hystrix.HystrixCommand; import com.netflix.hystrix.HystrixCommandGroupKey; import com.netflix.hystrix.HystrixCommandKey; @@ -144,6 +145,15 @@ public class HystrixProcessor extends ServiceSupport implements AsyncProcessor, return 0; } +@ManagedAttribute +public boolean isCircuitBreakerOpen() { +HystrixCircuitBreaker cb = HystrixCircuitBreaker.Factory.getInstance(commandKey); +if (cb != null) { +return cb.isOpen(); +} +return false; +} + @Override public String getId() { return id; http://git-wip-us.apache.org/repos/asf/camel/blob/7c66b9fd/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java -- diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java index 4cb3db9..f281a05 100644 --- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java +++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java @@ -76,6 +76,9 @@ public class HystrixManagementTest extends CamelTestSupport { Long errorCount = (Long) mbeanServer.getAttribute(on, "HystrixErrorCount"); assertEquals(0, errorCount.longValue()); +Boolean open = (Boolean) mbeanServer.getAttribute(on, "CircuitBreakerOpen"); +assertEquals(false, open.booleanValue()); + // let it gather for a while Thread.sleep(1000);
[2/2] camel git commit: CAMEL-11895: camel-hystrix - Expose state of circuit breaker on JMX mbean / java api on processor.
CAMEL-11895: camel-hystrix - Expose state of circuit breaker on JMX mbean / java api on processor. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/82d77149 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/82d77149 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/82d77149 Branch: refs/heads/camel-2.20.x Commit: 82d77149a1de459add8e45a3e6854ed84eeb5e8d Parents: 6ac4066 Author: Claus Ibsen Authored: Wed Oct 11 15:25:41 2017 +0200 Committer: Claus Ibsen Committed: Thu Oct 12 09:06:17 2017 +0200 -- .../component/hystrix/processor/HystrixProcessor.java | 10 ++ .../hystrix/processor/HystrixManagementTest.java | 3 +++ 2 files changed, 13 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/82d77149/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java -- diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java index 3993a264..2ad 100644 --- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java +++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java @@ -19,6 +19,7 @@ package org.apache.camel.component.hystrix.processor; import java.util.ArrayList; import java.util.List; +import com.netflix.hystrix.HystrixCircuitBreaker; import com.netflix.hystrix.HystrixCommand; import com.netflix.hystrix.HystrixCommandGroupKey; import com.netflix.hystrix.HystrixCommandKey; @@ -144,6 +145,15 @@ public class HystrixProcessor extends ServiceSupport implements AsyncProcessor, return 0; } +@ManagedAttribute +public boolean isCircuitBreakerOpen() { +HystrixCircuitBreaker cb = HystrixCircuitBreaker.Factory.getInstance(commandKey); +if (cb != null) { +return cb.isOpen(); +} +return false; +} + @Override public String getId() { return id; http://git-wip-us.apache.org/repos/asf/camel/blob/82d77149/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java -- diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java index 4cb3db9..f281a05 100644 --- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java +++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java @@ -76,6 +76,9 @@ public class HystrixManagementTest extends CamelTestSupport { Long errorCount = (Long) mbeanServer.getAttribute(on, "HystrixErrorCount"); assertEquals(0, errorCount.longValue()); +Boolean open = (Boolean) mbeanServer.getAttribute(on, "CircuitBreakerOpen"); +assertEquals(false, open.booleanValue()); + // let it gather for a while Thread.sleep(1000);
camel git commit: CAMEL-11895: camel-hystrix - Expose state of circuit breaker on JMX mbean / java api on processor.
Repository: camel Updated Branches: refs/heads/master 8aa628ff0 -> ebf7b80c2 CAMEL-11895: camel-hystrix - Expose state of circuit breaker on JMX mbean / java api on processor. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ebf7b80c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ebf7b80c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ebf7b80c Branch: refs/heads/master Commit: ebf7b80c23006551f44000befa9a4347817ff97e Parents: 8aa628f Author: Claus Ibsen Authored: Wed Oct 11 15:25:41 2017 +0200 Committer: Claus Ibsen Committed: Wed Oct 11 15:25:51 2017 +0200 -- .../component/hystrix/processor/HystrixProcessor.java | 10 ++ .../hystrix/processor/HystrixManagementTest.java | 3 +++ 2 files changed, 13 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ebf7b80c/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java -- diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java index 3993a264..2ad 100644 --- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java +++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java @@ -19,6 +19,7 @@ package org.apache.camel.component.hystrix.processor; import java.util.ArrayList; import java.util.List; +import com.netflix.hystrix.HystrixCircuitBreaker; import com.netflix.hystrix.HystrixCommand; import com.netflix.hystrix.HystrixCommandGroupKey; import com.netflix.hystrix.HystrixCommandKey; @@ -144,6 +145,15 @@ public class HystrixProcessor extends ServiceSupport implements AsyncProcessor, return 0; } +@ManagedAttribute +public boolean isCircuitBreakerOpen() { +HystrixCircuitBreaker cb = HystrixCircuitBreaker.Factory.getInstance(commandKey); +if (cb != null) { +return cb.isOpen(); +} +return false; +} + @Override public String getId() { return id; http://git-wip-us.apache.org/repos/asf/camel/blob/ebf7b80c/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java -- diff --git a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java index 4cb3db9..f281a05 100644 --- a/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java +++ b/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor/HystrixManagementTest.java @@ -76,6 +76,9 @@ public class HystrixManagementTest extends CamelTestSupport { Long errorCount = (Long) mbeanServer.getAttribute(on, "HystrixErrorCount"); assertEquals(0, errorCount.longValue()); +Boolean open = (Boolean) mbeanServer.getAttribute(on, "CircuitBreakerOpen"); +assertEquals(false, open.booleanValue()); + // let it gather for a while Thread.sleep(1000);