diff --git a/.gitignore b/.gitignore index 7e9e6815..5caf8593 100755 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ out .settings bin .DS_Store +.java-version diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 26e0deaa..b0093170 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -2,10 +2,9 @@ test.enabled=false repositories { mavenCentral() - jcenter() } dependencies { - compile "com.jayway.restassured:rest-assured:2.9.0" + implementation "io.rest-assured:rest-assured:3.0.0" } diff --git a/buildSrc/src/main/groovy/WaitForCdc.java b/buildSrc/src/main/groovy/WaitForCdc.java index d3529f30..099cbff7 100644 --- a/buildSrc/src/main/groovy/WaitForCdc.java +++ b/buildSrc/src/main/groovy/WaitForCdc.java @@ -1,11 +1,10 @@ +import io.restassured.RestAssured; import org.gradle.api.DefaultTask; import org.gradle.api.tasks.TaskAction; import java.util.Optional; import java.util.concurrent.TimeUnit; -import com.jayway.restassured.RestAssured; - public class WaitForCdc extends DefaultTask { private String getenv(String name, String defaultValue) { @@ -54,4 +53,4 @@ public void waitForCdc() { throw new RuntimeException("CDC failed to start"); } -} \ No newline at end of file +} diff --git a/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/MyReplyConsumer.java b/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/MyReplyConsumer.java index aadc4401..b9514f89 100644 --- a/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/MyReplyConsumer.java +++ b/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/MyReplyConsumer.java @@ -5,7 +5,6 @@ import io.eventuate.tram.messaging.consumer.MessageConsumer; import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.PostConstruct; import java.util.concurrent.BlockingDeque; import java.util.concurrent.LinkedBlockingDeque; @@ -26,7 +25,6 @@ public MyReplyConsumer(MessageConsumer messageConsumer, String replyChannel) { this.replyChannel = replyChannel; } - @PostConstruct public void subscribe() { messageConsumer.subscribe(getClass().getName(), singleton(channelMapping.transform(replyChannel)), this::handler); } diff --git a/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/TramCommandsDBBrokerIntegrationTestConfiguration.java b/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/TramCommandsDBBrokerIntegrationTestConfiguration.java index 076bcc40..93cc1b8c 100644 --- a/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/TramCommandsDBBrokerIntegrationTestConfiguration.java +++ b/eventuate-tram-commands-db-broker-integration-test/src/test/java/io/eventuate/tram/commands/db/broker/integrationtests/TramCommandsDBBrokerIntegrationTestConfiguration.java @@ -29,13 +29,11 @@ TramCommandConsumerConfiguration.class }) public class TramCommandsDBBrokerIntegrationTestConfiguration { - - + @Bean public TramCommandsDBBrokerIntegrationData tramCommandsAndEventsIntegrationData() { return new TramCommandsDBBrokerIntegrationData(); -} - + } @Bean public ChannelMapping channelMapping(TramCommandsDBBrokerIntegrationData data) { @@ -51,14 +49,12 @@ public CommandDispatcher consumerCommandDispatcher(MyTestCommandHandler target, return commandDispatcherFactory.make("customerCommandDispatcher", target.defineCommandHandlers()); } - @Bean public MyTestCommandHandler myTestCommandHandler() { return Mockito.spy(new MyTestCommandHandler()); } - - @Bean + @Bean(initMethod = "subscribe") public MyReplyConsumer myReplyConsumer(MessageConsumer messageConsumer) { return new MyReplyConsumer(messageConsumer, "ReplyTo"); } diff --git a/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcher.java b/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcher.java index 4a28fcb7..b2a06e3c 100644 --- a/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcher.java +++ b/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcher.java @@ -10,7 +10,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PostConstruct; import java.util.List; import java.util.Map; import java.util.Optional; @@ -43,7 +42,6 @@ public CommandDispatcher(String commandDispatcherId, this.commandNameMapping = commandNameMapping; } - @PostConstruct public void initialize() { messageConsumer.subscribe(commandDispatcherId, commandHandlers.getChannels(), diff --git a/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcherFactory.java b/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcherFactory.java index 57cc9f46..81ce2dbc 100644 --- a/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcherFactory.java +++ b/eventuate-tram-commands/src/main/java/io/eventuate/tram/commands/consumer/CommandDispatcherFactory.java @@ -18,6 +18,8 @@ public CommandDispatcherFactory(MessageConsumer messageConsumer, public CommandDispatcher make(String commandDispatcherId, CommandHandlers commandHandlers) { - return new CommandDispatcher(commandDispatcherId, commandHandlers, messageConsumer, commandNameMapping, commandReplyProducer); + CommandDispatcher commandDispatcher = new CommandDispatcher(commandDispatcherId, commandHandlers, messageConsumer, commandNameMapping, commandReplyProducer); + commandDispatcher.initialize(); + return commandDispatcher; } } diff --git a/eventuate-tram-commands/src/test/java/io/eventuate/tram/commands/InMemoryCommands.java b/eventuate-tram-commands/src/test/java/io/eventuate/tram/commands/InMemoryCommands.java index 2339701d..9f629e27 100644 --- a/eventuate-tram-commands/src/test/java/io/eventuate/tram/commands/InMemoryCommands.java +++ b/eventuate-tram-commands/src/test/java/io/eventuate/tram/commands/InMemoryCommands.java @@ -25,7 +25,6 @@ public static InMemoryCommands make(CommandHandlers commandHandlers, InMemoryMes CommandReplyProducer commandReplyProducer = new CommandReplyProducer(inMemoryMessaging.messageProducer); CommandDispatcherFactory commandDispatcherFactory = new CommandDispatcherFactory(inMemoryMessaging.messageConsumer, commandNameMapping, commandReplyProducer); CommandDispatcher commandDispatcher = commandDispatcherFactory.make("subscriberId", commandHandlers); - commandDispatcher.initialize(); return new InMemoryCommands(commandProducer, commandReplyProducer); } -} \ No newline at end of file +} diff --git a/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcher.java b/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcher.java index 76fc8416..a0ac2664 100644 --- a/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcher.java +++ b/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcher.java @@ -9,7 +9,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PostConstruct; import java.util.Optional; public class DomainEventDispatcher { @@ -29,7 +28,6 @@ public DomainEventDispatcher(String eventDispatcherId, DomainEventHandlers domai this.domainEventNameMapping = domainEventNameMapping; } - @PostConstruct public void initialize() { logger.info("Initializing domain event dispatcher"); messageConsumer.subscribe(eventDispatcherId, domainEventHandlers.getAggregateTypesAndEvents(), this::messageHandler); diff --git a/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcherFactory.java b/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcherFactory.java index f6880092..70853156 100644 --- a/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcherFactory.java +++ b/eventuate-tram-events/src/main/java/io/eventuate/tram/events/subscriber/DomainEventDispatcherFactory.java @@ -14,6 +14,8 @@ public DomainEventDispatcherFactory(MessageConsumer messageConsumer, DomainEvent } public DomainEventDispatcher make(String eventDispatcherId, DomainEventHandlers domainEventHandlers) { - return new DomainEventDispatcher(eventDispatcherId, domainEventHandlers, messageConsumer, domainEventNameMapping); + DomainEventDispatcher domainEventDispatcher = new DomainEventDispatcher(eventDispatcherId, domainEventHandlers, messageConsumer, domainEventNameMapping); + domainEventDispatcher.initialize(); + return domainEventDispatcher; } } diff --git a/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcher.java b/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcher.java index a658632d..2dde9140 100644 --- a/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcher.java +++ b/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcher.java @@ -11,7 +11,6 @@ import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; -import javax.annotation.PostConstruct; import java.util.Optional; import static java.util.Collections.singletonList; @@ -38,7 +37,6 @@ public ReactiveCommandDispatcher(String commandDispatcherId, this.commandReplyProducer = commandReplyProducer; } - @PostConstruct public void initialize() { messageConsumer.subscribe(commandDispatcherId, commandHandlers.getChannels(), this::messageHandler); } diff --git a/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherFactory.java b/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherFactory.java index 9e01d158..7e58decd 100644 --- a/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherFactory.java +++ b/eventuate-tram-reactive-commands/src/main/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherFactory.java @@ -15,6 +15,8 @@ public ReactiveCommandDispatcherFactory(ReactiveMessageConsumer messageConsumer, public ReactiveCommandDispatcher make(String commandDispatcherId, ReactiveCommandHandlers commandHandlers) { - return new ReactiveCommandDispatcher(commandDispatcherId, commandHandlers, messageConsumer, commandReplyProducer); + ReactiveCommandDispatcher reactiveCommandDispatcher = new ReactiveCommandDispatcher(commandDispatcherId, commandHandlers, messageConsumer, commandReplyProducer); + reactiveCommandDispatcher.initialize(); + return reactiveCommandDispatcher; } } diff --git a/eventuate-tram-reactive-commands/src/test/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherTest.java b/eventuate-tram-reactive-commands/src/test/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherTest.java index ac66bb97..25c463ad 100644 --- a/eventuate-tram-reactive-commands/src/test/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherTest.java +++ b/eventuate-tram-reactive-commands/src/test/java/io/eventuate/tram/reactive/commands/consumer/ReactiveCommandDispatcherTest.java @@ -61,6 +61,7 @@ public void init() { @Test public void testHandlerInvocation() { reactiveCommandDispatcher = new ReactiveCommandDispatcher("", commandHandlers, messageConsumer, commandReplyProducer); + reactiveCommandDispatcher.initialize(); when(commandHandler.invokeMethod(any())).thenReturn(Mono.just(replyMessage)); @@ -80,6 +81,7 @@ protected Publisher invoke(ReactiveCommandHandler m, CommandMessage cm, return alternativeCommandHandler.invokeMethod(new CommandHandlerArgs<>(cm, new PathVariables(commandHandlerParams.getPathVars()), commandReplyToken)); } }; + reactiveCommandDispatcher.initialize(); invokeMessageHandler(); @@ -104,6 +106,7 @@ private Message makeMessage(String replyToChannel) { @Test public void shouldDispatchNotification() { reactiveCommandDispatcher = new ReactiveCommandDispatcher("", commandHandlers, messageConsumer, commandReplyProducer); + reactiveCommandDispatcher.initialize(); when(commandHandler.invokeMethod(any())).thenReturn(Mono.empty()); diff --git a/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcher.java b/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcher.java index ae713aeb..a5dd43e8 100644 --- a/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcher.java +++ b/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcher.java @@ -12,7 +12,6 @@ import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; -import javax.annotation.PostConstruct; import java.util.Optional; public class ReactiveDomainEventDispatcher { @@ -36,7 +35,6 @@ public ReactiveDomainEventDispatcher(String eventDispatcherId, this.domainEventNameMapping = domainEventNameMapping; } - @PostConstruct public void initialize() { logger.info("Initializing reactive domain event dispatcher"); messageConsumer.subscribe(eventDispatcherId, domainEventHandlers.getAggregateTypesAndEvents(), this::messageHandler); diff --git a/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcherFactory.java b/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcherFactory.java index dd782c18..76338562 100644 --- a/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcherFactory.java +++ b/eventuate-tram-reactive-events/src/main/java/io/eventuate/tram/reactive/events/subscriber/ReactiveDomainEventDispatcherFactory.java @@ -14,6 +14,8 @@ public ReactiveDomainEventDispatcherFactory(ReactiveMessageConsumer messageConsu } public ReactiveDomainEventDispatcher make(String eventDispatcherId, ReactiveDomainEventHandlers domainEventHandlers) { - return new ReactiveDomainEventDispatcher(eventDispatcherId, domainEventHandlers, messageConsumer, domainEventNameMapping); + ReactiveDomainEventDispatcher reactiveDomainEventDispatcher = new ReactiveDomainEventDispatcher(eventDispatcherId, domainEventHandlers, messageConsumer, domainEventNameMapping); + reactiveDomainEventDispatcher.initialize(); + return reactiveDomainEventDispatcher; } } diff --git a/eventuate-tram-spring-commands-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-commands-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..78e83343 --- /dev/null +++ b/eventuate-tram-spring-commands-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.commands.common.TramCommandsCommonAutoConfiguration diff --git a/eventuate-tram-spring-commands-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-commands-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..5407ded1 --- /dev/null +++ b/eventuate-tram-spring-commands-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.commands.autoconfigure.EventuateTramCommandsAutoConfigure diff --git a/eventuate-tram-spring-consumer-jdbc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-consumer-jdbc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..04979497 --- /dev/null +++ b/eventuate-tram-spring-consumer-jdbc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.consumer.jdbc.TramConsumerJdbcAutoConfiguration diff --git a/eventuate-tram-spring-events-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-events-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..1bd1fe98 --- /dev/null +++ b/eventuate-tram-spring-events-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.events.common.TramEventsCommonAutoConfiguration diff --git a/eventuate-tram-spring-events-publisher-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-events-publisher-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..a9b59633 --- /dev/null +++ b/eventuate-tram-spring-events-publisher-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.events.autoconfigure.TramEventsPublisherAutoConfiguration diff --git a/eventuate-tram-spring-events-subscriber-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-events-subscriber-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..1aaa2bf0 --- /dev/null +++ b/eventuate-tram-spring-events-subscriber-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.events.autoconfigure.TramEventsSubscriberAutoConfiguration diff --git a/eventuate-tram-spring-logging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-logging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..3832ed60 --- /dev/null +++ b/eventuate-tram-spring-logging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.logging.LoggingMessageInterceptorAutoConfiguration diff --git a/eventuate-tram-spring-messaging-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-messaging-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..97d82b93 --- /dev/null +++ b/eventuate-tram-spring-messaging-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,5 @@ +io.eventuate.tram.spring.messaging.autoconfigure.EventuateTramActiveMQMessageConsumerAutoConfiguration +io.eventuate.tram.spring.messaging.autoconfigure.EventuateTramKafkaMessageConsumerAutoConfiguration +io.eventuate.tram.spring.messaging.autoconfigure.EventuateTramRabbitMQMessageConsumerAutoConfiguration +io.eventuate.tram.spring.messaging.autoconfigure.EventuateTramRedisMessageConsumerAutoConfiguration +io.eventuate.tram.spring.messaging.autoconfigure.TramMessageProducerJdbcAutoConfiguration diff --git a/eventuate-tram-spring-messaging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-messaging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..790ee7c1 --- /dev/null +++ b/eventuate-tram-spring-messaging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.messaging.common.TramMessagingCommonAutoConfiguration diff --git a/eventuate-tram-spring-reactive-commands-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-reactive-commands-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..9cfaf6c9 --- /dev/null +++ b/eventuate-tram-spring-reactive-commands-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.reactive.commands.autoconfigure.EventuateReactiveTramCommandsAutoConfigure diff --git a/eventuate-tram-spring-reactive-consumer-jdbc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-reactive-consumer-jdbc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..acb6bdde --- /dev/null +++ b/eventuate-tram-spring-reactive-consumer-jdbc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.reactive.consumer.jdbc.ReactiveTramConsumerJdbcAutoConfiguration diff --git a/eventuate-tram-spring-reactive-events-publisher-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-reactive-events-publisher-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..b247ee6f --- /dev/null +++ b/eventuate-tram-spring-reactive-events-publisher-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.reactive.events.autoconfigure.ReactiveTramEventsPublisherAutoConfiguration diff --git a/eventuate-tram-spring-reactive-events-subscriber-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-reactive-events-subscriber-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..271b7dc0 --- /dev/null +++ b/eventuate-tram-spring-reactive-events-subscriber-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.reactive.events.autoconfigure.ReactiveTramEventsSubscriberAutoConfiguration diff --git a/eventuate-tram-spring-reactive-events-subscriber/src/main/java/io/eventuate/tram/spring/reactive/events/subscriber/SpringReactiveDomainEventDispatcherFactory.java b/eventuate-tram-spring-reactive-events-subscriber/src/main/java/io/eventuate/tram/spring/reactive/events/subscriber/SpringReactiveDomainEventDispatcherFactory.java index f747317d..89c0c2bf 100644 --- a/eventuate-tram-spring-reactive-events-subscriber/src/main/java/io/eventuate/tram/spring/reactive/events/subscriber/SpringReactiveDomainEventDispatcherFactory.java +++ b/eventuate-tram-spring-reactive-events-subscriber/src/main/java/io/eventuate/tram/spring/reactive/events/subscriber/SpringReactiveDomainEventDispatcherFactory.java @@ -2,10 +2,6 @@ import io.eventuate.tram.consumer.common.reactive.ReactiveMessageConsumer; import io.eventuate.tram.events.common.DomainEventNameMapping; -import io.eventuate.tram.events.subscriber.DomainEventDispatcher; -import io.eventuate.tram.events.subscriber.DomainEventDispatcherFactory; -import io.eventuate.tram.events.subscriber.DomainEventHandlers; -import io.eventuate.tram.messaging.consumer.MessageConsumer; import io.eventuate.tram.reactive.events.subscriber.ReactiveDomainEventDispatcher; import io.eventuate.tram.reactive.events.subscriber.ReactiveDomainEventDispatcherFactory; import io.eventuate.tram.reactive.events.subscriber.ReactiveDomainEventHandlers; @@ -18,6 +14,8 @@ public SpringReactiveDomainEventDispatcherFactory(ReactiveMessageConsumer messag @Override public ReactiveDomainEventDispatcher make(String eventDispatcherId, ReactiveDomainEventHandlers domainEventHandlers) { - return new ReactiveDomainEventDispatcher(eventDispatcherId, domainEventHandlers, messageConsumer, domainEventNameMapping); + ReactiveDomainEventDispatcher reactiveDomainEventDispatcher = new ReactiveDomainEventDispatcher(eventDispatcherId, domainEventHandlers, messageConsumer, domainEventNameMapping); + reactiveDomainEventDispatcher.initialize(); + return reactiveDomainEventDispatcher; } } diff --git a/eventuate-tram-spring-reactive-messaging-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-reactive-messaging-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..5fa84d19 --- /dev/null +++ b/eventuate-tram-spring-reactive-messaging-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +io.eventuate.tram.spring.reactive.messaging.autoconfigure.EventuateTramReactiveKafkaMessageConsumerAutoConfiguration +io.eventuate.tram.spring.reactive.messaging.autoconfigure.ReactiveTramMessageProducerJdbcAutoConfiguration diff --git a/eventuate-tram-spring-reactive-optimistic-locking/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eventuate-tram-spring-reactive-optimistic-locking/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..36cb9b38 --- /dev/null +++ b/eventuate-tram-spring-reactive-optimistic-locking/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +io.eventuate.tram.spring.reactive.optimisticlocking.OptimisticLockingDecoratorAutoConfiguration diff --git a/eventuate-tram-spring-testing-support-cloud-contract/src/main/java/io/eventuate/tram/spring/cloudcontractsupport/EventuateTramRoutesConfigurer.java b/eventuate-tram-spring-testing-support-cloud-contract/src/main/java/io/eventuate/tram/spring/cloudcontractsupport/EventuateTramRoutesConfigurer.java index 3f2d04ef..6cb07683 100644 --- a/eventuate-tram-spring-testing-support-cloud-contract/src/main/java/io/eventuate/tram/spring/cloudcontractsupport/EventuateTramRoutesConfigurer.java +++ b/eventuate-tram-spring-testing-support-cloud-contract/src/main/java/io/eventuate/tram/spring/cloudcontractsupport/EventuateTramRoutesConfigurer.java @@ -11,6 +11,7 @@ import io.eventuate.tram.messaging.producer.MessageProducer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.contract.spec.Contract; import org.springframework.cloud.contract.spec.internal.BodyMatcher; @@ -19,14 +20,13 @@ import org.springframework.cloud.contract.stubrunner.BatchStubRunner; import org.springframework.cloud.contract.verifier.util.*; -import javax.annotation.PostConstruct; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.regex.Pattern; import java.util.stream.Collectors; -public class EventuateTramRoutesConfigurer { +public class EventuateTramRoutesConfigurer implements InitializingBean { private Logger logger = LoggerFactory.getLogger(getClass()); @@ -44,7 +44,6 @@ public EventuateTramRoutesConfigurer(BatchStubRunner batchStubRunner) { private int idCounter; - @PostConstruct public void initialize() { for (Collection contracts : batchStubRunner.getContracts().values()) { for (Contract contract : contracts) { @@ -152,4 +151,9 @@ private boolean headersMatch(Message message, Contract groovyDsl) { } return matches; } + + @Override + public void afterPropertiesSet() { + initialize(); + } } diff --git a/settings.gradle b/settings.gradle index f23949ac..4dd7d72a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -57,7 +57,7 @@ include 'eventuate-tram-micronaut-commands' include 'eventuate-tram-test-util' include "eventuate-tram-testing-support" include "eventuate-tram-spring-testing-support-cloud-contract" -include "eventuate-tram-aggregate-domain-events" +//include "eventuate-tram-aggregate-domain-events" include 'eventuate-tram-consumer-kafka' include 'eventuate-tram-reactive-consumer-kafka' include 'eventuate-tram-spring-consumer-kafka'