This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component | |
| @RemoteApplicationEventScan | |
| class BusConfig | |
| class UpdateDataEvent(source: Any? = "", originService: String, var newData: Int) : RemoteApplicationEvent(source, originService) | |
| @Component | |
| class UpdateDataEventListener : ApplicationListener<UpdateDataEvent> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| upstream servers { | |
| server service1:8080 fail_timeout=50s max_fails=5; | |
| server service2:8080 fail_timeout=50s max_fails=5; | |
| server service3:8080 fail_timeout=50s max_fails=5; | |
| } | |
| server { | |
| listen 9090; | |
| location / { | |
| proxy_pass http://servers; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dependencies { | |
| implementation("org.springframework.boot:spring-boot-starter-web") | |
| // Following dependencies added for this example | |
| implementation("org.springframework.boot:spring-boot-starter-actuator") // Spring Cloud Bus runs on top of Actuator | |
| implementation("org.springframework.cloud:spring-cloud-starter-bus-amqp:2.2.2.RELEASE") // Spring Cloud Bus with AMQP | |
| implementation("com.fasterxml.jackson.module:jackson-module-kotlin") // Jackson is used for Event Serialization to JSON | |
| // End of new dependencies | |
| implementation("org.jetbrains.kotlin:kotlin-reflect") | |
| implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") | |
| testImplementation("org.springframework.boot:spring-boot-starter-test") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| services: | |
| lb: | |
| build: | |
| context: ./nginx | |
| dockerfile: Dockerfile | |
| ports: | |
| - "9090:9090" | |
| depends_on: | |
| - service1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM nginx | |
| RUN rm /etc/nginx/conf.d/default.conf | |
| COPY nginx.conf /etc/nginx/conf.d/default.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| upstream servers { | |
| server service1:8080 fail_timeout=50s max_fails=5; | |
| server service2:8080 fail_timeout=50s max_fails=5; | |
| } | |
| server { | |
| listen 9090; | |
| location / { | |
| proxy_pass http://servers; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM adoptopenjdk/openjdk11 | |
| ARG JAR_FILE=build/libs/*.jar | |
| COPY ${JAR_FILE} app.jar | |
| ENTRYPOINT ["java","-jar","/app.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RestController | |
| @RequestMapping("/api") | |
| class DummyController { | |
| var data = 10 | |
| @RequestMapping("", method = [RequestMethod.GET]) | |
| fun getResult(): Int { | |
| return data | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
| b4e2f9d64676 lbsandbox_lb "/docker-entrypoint.…" About an hour ago Up 14 minutes 80/tcp, 0.0.0.0:9090->9090/tcp lbsandbox_lb_1 | |
| 683d925d0345 lbsandbox_service1 "java -jar /app.jar" 2 hours ago Up 14 minutes 0.0.0.0:8181->8080/tcp lbsandbox_service1_1 | |
| 01ed6f990ed8 lbsandbox_service2 "java -jar /app.jar" 2 hours ago Up 14 minutes 0.0.0.0:8282->8080/tcp lbsandbox_service2_1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aba |