diff --git a/restaurant-stream-apps/scdf-app-customer/src/main/resources/application.properties b/restaurant-stream-apps/scdf-app-customer/src/main/resources/application.properties index 618a6a7..3184315 100644 --- a/restaurant-stream-apps/scdf-app-customer/src/main/resources/application.properties +++ b/restaurant-stream-apps/scdf-app-customer/src/main/resources/application.properties @@ -1,2 +1,5 @@ spring.application.name=customer logging.level.root=info +logging.level.io.spring=debug +logging.level.org.springframework.cloud=debug +logging.level.com.rabbitmq.client=debug \ No newline at end of file diff --git a/restaurant-stream-apps/scdf-app-kitchen/src/main/resources/application.properties b/restaurant-stream-apps/scdf-app-kitchen/src/main/resources/application.properties index 3a49b47..6289a67 100644 --- a/restaurant-stream-apps/scdf-app-kitchen/src/main/resources/application.properties +++ b/restaurant-stream-apps/scdf-app-kitchen/src/main/resources/application.properties @@ -1,3 +1,6 @@ spring.application.name=restaurant logging.level.root=info +logging.level.io.spring=debug +logging.level.org.springframework.cloud=debug +logging.level.com.rabbitmq.client=debug \ No newline at end of file diff --git a/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/ScdfAppWaitronApplication.java b/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/ScdfAppWaitronApplication.java index ef3ebb1..e7b6130 100644 --- a/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/ScdfAppWaitronApplication.java +++ b/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/ScdfAppWaitronApplication.java @@ -17,8 +17,10 @@ package io.spring.scdf.waitron; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication +@EnableScheduling public class ScdfAppWaitronApplication { public static void main(String[] args) { diff --git a/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/Waitron.java b/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/Waitron.java index 740ad7f..00b1823 100644 --- a/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/Waitron.java +++ b/restaurant-stream-apps/scdf-app-waitron/src/main/java/io/spring/scdf/waitron/Waitron.java @@ -29,11 +29,14 @@ import org.springframework.cloud.stream.annotation.StreamListener; import org.springframework.context.event.EventListener; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; +import org.springframework.core.task.AsyncTaskExecutor; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.support.MessageBuilder; import org.springframework.stereotype.Component; +import java.util.concurrent.Callable; + /** * @author Corneil du Plessis */ @@ -44,11 +47,13 @@ public class Waitron { private final Events events; private final ApplicationAvailability applicationAvailability; private final Environment environment; + private final AsyncTaskExecutor taskExecutor; - public Waitron(Events events, ApplicationAvailability applicationAvailability, Environment environment) { + public Waitron(Events events, ApplicationAvailability applicationAvailability, Environment environment, AsyncTaskExecutor taskExecutor) { this.events = events; this.applicationAvailability = applicationAvailability; this.environment = environment; + this.taskExecutor = taskExecutor; } @StreamListener(Events.PAYMENT) @@ -62,8 +67,12 @@ public class Waitron { logger.info("availability:{}:{}", applicationAvailability.getLivenessState(), applicationAvailability.getReadinessState()); if (!environment.acceptsProfiles(Profiles.of("test"))) { if (LivenessState.CORRECT.equals(applicationAvailability.getLivenessState())) { - logger.info("onEvent:send:atWork:waitron"); - events.atWork().send(MessageBuilder.withPayload("waitron").build()); + taskExecutor.submit((Callable) () -> { + logger.info("onEvent:wait"); + Thread.sleep(30000L); + logger.info("onEvent:send:atWork:waitron"); + return events.atWork().send(MessageBuilder.withPayload("waitron").build()); + }); } } else { logger.info("onEvent:skip:test"); diff --git a/restaurant-stream-apps/scdf-app-waitron/src/main/resources/application.properties b/restaurant-stream-apps/scdf-app-waitron/src/main/resources/application.properties index 112c71a..35eee54 100644 --- a/restaurant-stream-apps/scdf-app-waitron/src/main/resources/application.properties +++ b/restaurant-stream-apps/scdf-app-waitron/src/main/resources/application.properties @@ -1,3 +1,6 @@ spring.application.name=waitron logging.level.root=info +logging.level.io.spring=debug +logging.level.org.springframework.cloud=debug +logging.level.com.rabbitmq.client=debug \ No newline at end of file