You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/11/01 11:18:12 UTC
[camel] branch main updated: Added docs for camel get circuit-breaker
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new b320021c50f Added docs for camel get circuit-breaker
b320021c50f is described below
commit b320021c50fd7dd85e0277c08feb4c0545403e7d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Nov 1 12:17:29 2022 +0100
Added docs for camel get circuit-breaker
---
docs/user-manual/modules/ROOT/pages/camel-jbang.adoc | 16 ++++++++++++++++
.../jbang/core/commands/process/ListCircuitBreaker.java | 10 +++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index e75e811deb1..24892eb42d0 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -820,6 +820,22 @@ And finally the integration comes with embedded web console (started with the `-
NOTE: For a service to be listed then Camel components must be able to advertise the services using xref:camel-console.adoc[].
+==== Listing state of Circuit Breakers
+
+If your Camel integration uses xref:components:eips:circuitBreaker-eip.adoc[Circuit Breaker] then
+you can output the status of the breakers with Camel JBang as follows:
+
+[source,bash]
+----
+camel get circuit-breaker
+ PID NAME COMPONENT ROUTE ID STATE PENDING SUCCESS FAIL REJECT
+ 56033 mycb resilience4j route1 circuitBreaker1 HALF_OPEN 5 2 3 0
+----
+
+Here we can see the circuit breaker is in _half open_ state, i.e. a state where the breaker is attempting
+to transition back to closed, if the failures start to drop.
+
+TIP: You can run the command with watch to keep showing the latest state `watch camel get circuit-breaker`.
=== Using Jolokia and Hawtio
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListCircuitBreaker.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListCircuitBreaker.java
index 8dc0c8bfca1..7137f837236 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListCircuitBreaker.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListCircuitBreaker.java
@@ -78,7 +78,7 @@ public class ListCircuitBreaker extends ProcessBaseCommand {
for (int i = 0; i < arr.size(); i++) {
row = baseRow.copy();
JsonObject jo = (JsonObject) arr.get(i);
- row.component = "camel-resilience4j";
+ row.component = "resilience4j";
row.id = jo.getString("id");
row.routeId = jo.getString("routeId");
row.state = jo.getString("state");
@@ -98,7 +98,7 @@ public class ListCircuitBreaker extends ProcessBaseCommand {
for (int i = 0; i < arr.size(); i++) {
row = baseRow.copy();
JsonObject jo = (JsonObject) arr.get(i);
- row.component = "camel-microprofile-fault-tolerance";
+ row.component = "fault-tolerance";
row.id = jo.getString("id");
row.routeId = jo.getString("routeId");
row.state = jo.getString("state");
@@ -164,21 +164,21 @@ public class ListCircuitBreaker extends ProcessBaseCommand {
}
private String getPending(Row r) {
- if ("camel-resilience4j".equals(r.component)) {
+ if ("resilience4j".equals(r.component)) {
return "" + r.bufferedCalls;
}
return "";
}
private String getSuccess(Row r) {
- if ("camel-resilience4j".equals(r.component)) {
+ if ("resilience4j".equals(r.component)) {
return "" + r.successfulCalls;
}
return "";
}
private String getReject(Row r) {
- if ("camel-resilience4j".equals(r.component)) {
+ if ("resilience4j".equals(r.component)) {
return "" + r.notPermittedCalls;
}
return "";