diff --git a/spring/microservices-circuit-breaking/.gitignore b/spring/microservices-circuit-breaking/.gitignore
deleted file mode 100644
index 7750e9a..0000000
--- a/spring/microservices-circuit-breaking/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.idea/
-*.iml
-*.ipr
-target
diff --git a/spring/microservices-circuit-breaking/fruit-service/pom.xml b/spring/microservices-circuit-breaking/fruit-service/pom.xml
deleted file mode 100644
index d9c36c2..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/pom.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
- 4.0.0
-
- spring-boot-circuit-breaker-greeting
- io.openshift.booster
- 1.0.0-SNAPSHOT
-
- Spring Boot - Circuit Breaker Booster - Greeting Service
-
- 1.8
- 1.8
- UTF-8
- UTF-8
- 1.0.3
-
- 3.3.9
- 9.4.1212
- 1.5
-
- 2.1.6.RELEASE
- 2.1.6.SP3-redhat-00001
- 2.20
- 3.5.40
- true
- true
-
- registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:${openjdk18-openshift.version}
-
- 3.1.0
- 1.4.0.Final
- 3.1.0
-
-
-
-
- me.snowdrop
- spring-boot-bom
- ${spring-boot-bom.version}
- pom
- import
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-hystrix
- 2.1.0.RELEASE
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-websocket
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- ${spring-boot.version}
-
-
-
- repackage
-
-
-
-
-
- local
-
- exec
-
-
-
-
-
-
-
- openshift
-
-
-
-
-
-
- io.fabric8
- fabric8-maven-plugin
- ${fabric8-maven-plugin.version}
-
-
- fmp
-
- resource
- build
-
-
-
-
-
-
-
-
-
-
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/fabric8/route.yml b/spring/microservices-circuit-breaking/fruit-service/src/main/fabric8/route.yml
deleted file mode 100644
index e63998c..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/fabric8/route.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-apiVersion: v1
-kind: Route
-metadata:
- name: ${project.artifactId}
-spec:
- port:
- targetPort: 8080
- to:
- kind: Service
- name: ${project.artifactId}
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/BoosterApplication.java b/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/BoosterApplication.java
deleted file mode 100644
index f790567..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/BoosterApplication.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
-
-/**
- * Entry point to the application.
- */
-@SpringBootApplication
-@EnableCircuitBreaker
-public class BoosterApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(BoosterApplication.class, args);
- }
-
-}
-
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerController.java b/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerController.java
deleted file mode 100644
index 3727d23..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerController.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Circuit Breaker state controller.
- */
-@RestController
-public class CircuitBreakerController {
-
- private NameService nameService;
-
- public CircuitBreakerController(NameService nameService) {
- this.nameService = nameService;
- }
-
- @RequestMapping("/api/cb-state")
- public CircuitBreakerState getState() throws Exception {
- return nameService.getState();
- }
-
-}
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerHandler.java b/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerHandler.java
deleted file mode 100644
index f2471af..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.springframework.web.socket.CloseStatus;
-import org.springframework.web.socket.TextMessage;
-import org.springframework.web.socket.WebSocketHandler;
-import org.springframework.web.socket.WebSocketMessage;
-import org.springframework.web.socket.WebSocketSession;
-
-/**
- * Circuit Breaker state handler.
- */
-public class CircuitBreakerHandler implements WebSocketHandler {
-
- private Queue currentSessions = new ConcurrentLinkedQueue<>();
-
- void sendMessage(CircuitBreakerState state) throws Exception {
- TextMessage message = new TextMessage("isOpen:" + CircuitBreakerState.OPEN.equals(state));
- for (WebSocketSession session : currentSessions) {
- session.sendMessage(message);
- }
- }
-
- public void afterConnectionEstablished(WebSocketSession session) throws Exception {
- currentSessions.add(session);
- }
-
- public void handleMessage(WebSocketSession session, WebSocketMessage> webSocketMessage) throws Exception {
- }
-
- public void handleTransportError(WebSocketSession session, Throwable throwable) throws Exception {
-
- }
-
- public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
- currentSessions.remove(session);
- }
-
- public boolean supportsPartialMessages() {
- return false;
- }
-}
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerState.java b/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerState.java
deleted file mode 100644
index 990e3ca..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/CircuitBreakerState.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-/**
- * Circuit Breaker state.
- */
-public class CircuitBreakerState {
-
- static final CircuitBreakerState OPEN = new CircuitBreakerState("open");
- static final CircuitBreakerState CLOSED = new CircuitBreakerState("closed");
-
- private String state;
-
- public CircuitBreakerState() {
- }
-
- public CircuitBreakerState(String state) {
- this.state = state;
- }
-
- public String getState() {
- return state;
- }
-
-}
-
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/FruitController.java b/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/FruitController.java
deleted file mode 100644
index aa2862e..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/FruitController.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.socket.WebSocketHandler;
-
-/**
- * Fruit service controller.
- */
-@RestController
-public class FruitController {
-
- private final NameService nameService;
- private final CircuitBreakerHandler handler = new CircuitBreakerHandler();
-
- public FruitController(NameService nameService) {
- this.nameService = nameService;
- }
-
- @RequestMapping("/api/ping")
- public Fruit getPing() throws Exception {
- return new Fruit("OK");
- }
-
- /**
- * Endpoint to get a greeting. This endpoint uses a name server to get a name for the greeting.
- *
- * Request to the name service is guarded with a circuit breaker. Therefore if a name service is not available or is too
- * slow to response fallback name is used.
- *
- * @return Fruit string.
- */
- @RequestMapping("/api/greeting")
- public Fruit getFruit() throws Exception {
- String result = String.format("You've picked %s!", nameService.getName());
- handler.sendMessage(nameService.getState());
- return new Fruit(result);
- }
-
- @Bean
- public WebSocketHandler getHandler() {
- return handler;
- }
-
- static class Fruit {
- private final String content;
-
- public Fruit(String content) {
- this.content = content;
- }
-
- public String getContent() {
- return content;
- }
- }
-}
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/NameService.java b/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/NameService.java
deleted file mode 100644
index 4d827d2..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/NameService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-import com.netflix.hystrix.HystrixCircuitBreaker;
-import com.netflix.hystrix.HystrixCommandKey;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
-import org.springframework.stereotype.Service;
-import org.springframework.web.client.RestTemplate;
-
-/**
- * Service invoking name-service via REST and guarded by Hystrix.
- */
-@Service
-public class NameService {
-
- private static final HystrixCommandKey KEY = HystrixCommandKey.Factory.asKey("NameService");
-
- private final String nameHost = System.getProperty("name.host", "http://spring-boot-circuit-breaker-name:8080");
- private final RestTemplate restTemplate = new RestTemplate();
-
- @HystrixCommand(commandKey = "NameService", fallbackMethod = "getFallbackName", commandProperties = {
- @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "1000")
-})
-
- public String getName() {
- return restTemplate.getForObject(nameHost + "/api/name", String.class);
- }
-
- private String getFallbackName() {
- return "banana from fallback";
- }
-
- CircuitBreakerState getState() throws Exception {
- HystrixCircuitBreaker circuitBreaker = HystrixCircuitBreaker.Factory.getInstance(KEY);
- return circuitBreaker != null && circuitBreaker.isOpen() ? CircuitBreakerState.OPEN : CircuitBreakerState.CLOSED;
- }
-}
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/WebSocketConfig.java b/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/WebSocketConfig.java
deleted file mode 100644
index 672606a..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/java/io/openshift/booster/service/WebSocketConfig.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.socket.WebSocketHandler;
-import org.springframework.web.socket.config.annotation.EnableWebSocket;
-import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
-import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
-
-/**
- */
-@Configuration
-@EnableWebSocket
-public class WebSocketConfig implements WebSocketConfigurer {
-
- private WebSocketHandler handler;
-
- @Autowired
- public WebSocketConfig(WebSocketHandler handler) {
- this.handler = handler;
- }
-
- public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
- registry.addHandler(handler, "/cb-ws");
- }
-}
\ No newline at end of file
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/resources/application.yml b/spring/microservices-circuit-breaking/fruit-service/src/main/resources/application.yml
deleted file mode 100644
index 1dd9fd1..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/resources/application.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-hystrix:
- command:
- default:
- circuitBreaker:
- requestVolumeThreshold: 3
- metrics:
- healthSnapshot:
- intervalInMilliseconds: 100
\ No newline at end of file
diff --git a/spring/microservices-circuit-breaking/fruit-service/src/main/resources/static/index.html b/spring/microservices-circuit-breaking/fruit-service/src/main/resources/static/index.html
deleted file mode 100644
index 8eb63f0..0000000
--- a/spring/microservices-circuit-breaking/fruit-service/src/main/resources/static/index.html
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
- Cloud applications are often comprised of many services. And between those services there often can be many interactions.
- But even if some of those services fail or are unavailable, we may want to offer an alternative response to an error condition,
- that it does not increase load on service in, which is unavailable because of high load. And to achieve this, we need a generic
- mechanism over the failed or unavailable service to service communication, which can quickly and easily determine that the services
- are not functioning properly, hence can either return a default result or fail quickly and gracefully with enough information about
- the current failure. This mechanism is called circuit breaker.
-
-
- On this page you can invoke the greeting service. This service uses a name
- service. The invocations are protected by a circuit breaker. You can configure the state of the
- name service using the toggle button.
-
-
-
-
-
-
Greeting service
-
-
-
Results:
-
-
-
-
-
-
Name service
-
-
-
Requests:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/spring/microservices-circuit-breaking/name-service/pom.xml b/spring/microservices-circuit-breaking/name-service/pom.xml
deleted file mode 100644
index fce4f0a..0000000
--- a/spring/microservices-circuit-breaking/name-service/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
- 4.0.0
-
- spring-boot-circuit-breaker-name
- io.openshift.booster
- 1.0.0-SNAPSHOT
-
- Spring Boot - Circuit Breaker Booster - Name Service
-
- 1.8
- 1.8
- UTF-8
- UTF-8
-
- 3.3.9
- 9.4.1212
- 1.3
-
- 1.0.3
- 2.1.6.RELEASE
- 2.1.6.SP3-redhat-00001
- 2.20
- 3.5.40
- true
- true
-
- registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:${openjdk18-openshift.version}
-
- 3.1.0
- 1.4.0.Final
- 3.1.0
-
-
-
-
-
- me.snowdrop
- spring-boot-bom
- ${spring-boot-bom.version}
- pom
- import
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-websocket
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- ${spring-boot.version}
-
-
- local
-
- exec
-
-
-
-
- repackage
-
-
-
-
-
-
-
-
-
- openshift
-
-
-
-
-
-
- io.fabric8
- fabric8-maven-plugin
- ${fabric8-maven-plugin.version}
-
-
- fmp
-
- resource
- build
-
-
-
-
-
-
-
-
-
-
diff --git a/spring/microservices-circuit-breaking/name-service/src/main/fabric8/route.yml b/spring/microservices-circuit-breaking/name-service/src/main/fabric8/route.yml
deleted file mode 100644
index e63998c..0000000
--- a/spring/microservices-circuit-breaking/name-service/src/main/fabric8/route.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-apiVersion: v1
-kind: Route
-metadata:
- name: ${project.artifactId}
-spec:
- port:
- targetPort: 8080
- to:
- kind: Service
- name: ${project.artifactId}
diff --git a/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/BoosterApplication.java b/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/BoosterApplication.java
deleted file mode 100644
index bf652f9..0000000
--- a/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/BoosterApplication.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Entry point to the application.
- */
-@SpringBootApplication
-public class BoosterApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(BoosterApplication.class, args);
- }
-
-}
-
diff --git a/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/service/NameController.java b/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/service/NameController.java
deleted file mode 100644
index 3a7ee87..0000000
--- a/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/service/NameController.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-import java.io.IOException;
-import java.time.LocalTime;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.servlet.Filter;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.cors.CorsConfiguration;
-import org.springframework.web.filter.CorsFilter;
-import org.springframework.web.socket.CloseStatus;
-import org.springframework.web.socket.TextMessage;
-import org.springframework.web.socket.WebSocketHandler;
-import org.springframework.web.socket.WebSocketMessage;
-import org.springframework.web.socket.WebSocketSession;
-
-/**
- * Name service controller.
- */
-@RestController
-public class NameController {
-
- private static final Logger LOG = LoggerFactory.getLogger(NameController.class);
-
- private static final String theName = "apple";
-
- private final AtomicBoolean doFail = new AtomicBoolean();
- private final NameServiceWebSockerHandler handler = new NameServiceWebSockerHandler();
-
- @RequestMapping("/api/ping")
- public StateInfo getPing() throws Exception {
- return StateInfo.OK;
- }
-
- /**
- * Endpoint to get a name.
- *
- * @return Host name.
- */
- @RequestMapping("/api/name")
- public ResponseEntity getName() throws IOException {
- handler.sendMessage("GET /api/name at " + LocalTime.now());
-
- if (doFail.get()) {
- return new ResponseEntity<>("Name service down", HttpStatus.INTERNAL_SERVER_ERROR);
- } else {
- LOG.info(String.format("Returning a name '%s'", theName));
- return new ResponseEntity<>(theName, HttpStatus.OK);
- }
- }
-
- /**
- * Set name service state - via GET.
- */
- @GetMapping("/api/state")
- public StateInfo applyState(@RequestParam(name = "state") String state) throws Exception {
- doFail.set("fail".equalsIgnoreCase(state));
- LOG.info("Name service state set to " + state);
- handler.sendMessage("state:" + !doFail.get());
- return getState();
- }
-
- /**
- * Set name service state - via PUT.
- */
- @PutMapping("/api/state")
- public StateInfo applyState(@RequestBody StateInfo info) throws Exception {
- return applyState(info.getState());
- }
-
- /**
- * Set name service state.
- */
- @RequestMapping("/api/info")
- public StateInfo getState() throws Exception {
- return doFail.get() ? StateInfo.FAIL : StateInfo.OK;
- }
-
- static class StateInfo {
- private String state;
-
- static final StateInfo OK = new StateInfo("ok");
- static final StateInfo FAIL = new StateInfo("fail");
-
- public StateInfo() {
- }
-
- public StateInfo(String state) {
- this.state = state;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
- }
-
- @Bean
- public WebSocketHandler getHandler() {
- return handler;
- }
-
- @Bean
- public Filter getCorsFilter() {
- final CorsConfiguration configuration = new CorsConfiguration();
- configuration.addAllowedOrigin(CorsConfiguration.ALL);
- configuration.addAllowedMethod(CorsConfiguration.ALL);
- configuration.addAllowedHeader(CorsConfiguration.ALL);
- return new CorsFilter(request -> configuration);
- }
-
- private class NameServiceWebSockerHandler implements WebSocketHandler {
- private Queue currentSessions = new ConcurrentLinkedQueue<>();
-
- void sendMessage(String message) throws IOException {
- TextMessage textMessage = new TextMessage(message);
- for (WebSocketSession session : currentSessions) {
- session.sendMessage(textMessage);
- }
- }
-
- public void afterConnectionEstablished(WebSocketSession session) throws Exception {
- currentSessions.add(session);
- }
-
- public void handleMessage(WebSocketSession session, WebSocketMessage> webSocketMessage) throws Exception {
- }
-
- public void handleTransportError(WebSocketSession session, Throwable throwable) throws Exception {
-
- }
-
- public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
- currentSessions.remove(session);
- }
-
- public boolean supportsPartialMessages() {
- return false;
- }
- }
-}
diff --git a/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/service/WebSocketConfig.java b/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/service/WebSocketConfig.java
deleted file mode 100644
index fb8dbcd..0000000
--- a/spring/microservices-circuit-breaking/name-service/src/main/java/io/openshift/booster/service/WebSocketConfig.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2016-2017 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.openshift.booster.service;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.socket.WebSocketHandler;
-import org.springframework.web.socket.config.annotation.EnableWebSocket;
-import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
-import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
-
-/**
- */
-@Configuration
-@EnableWebSocket
-public class WebSocketConfig implements WebSocketConfigurer {
-
- private WebSocketHandler handler;
-
- @Autowired
- public WebSocketConfig(WebSocketHandler handler) {
- this.handler = handler;
- }
-
- public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
- registry.addHandler(handler, "/name-ws").setAllowedOrigins("*");
- }
-}
\ No newline at end of file
diff --git a/spring/microservices-circuit-breaking/pom.xml b/spring/microservices-circuit-breaking/pom.xml
deleted file mode 100644
index eda6659..0000000
--- a/spring/microservices-circuit-breaking/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
- 4.0.0
-
- booster-circuit-breaker-spring-boot
-
- io.openshift.booster
- 1.0.0-SNAPSHOT
- pom
-
- Spring Boot - Circuit Breaker Booster
- Spring Boot - Circuit Breaker Booster
-
-
-
- 1.0.3
-
-
-
- fruit-service
- name-service
-
-
-
-
-
- org.glassfish
- javax.json
- ${org.glassfish.javax.json}
-
-
-
-
-