From 859c9da5f9c3e1ac6ee28a9750dc55d7e20bf599 Mon Sep 17 00:00:00 2001 From: Chris Richardson Date: Thu, 18 Aug 2022 10:20:35 +0900 Subject: [PATCH] Extracted TramCommandReplyProducerConfiguration from TramCommandConsumerConfiguration for https://github.com/eventuate-tram/eventuate-tram-sagas/issues/84 --- .../consumer/TramCommandConsumerConfiguration.java | 7 ++----- .../TramCommandReplyProducerConfiguration.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandReplyProducerConfiguration.java diff --git a/eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandConsumerConfiguration.java b/eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandConsumerConfiguration.java index bfde82f7..36d88c56 100644 --- a/eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandConsumerConfiguration.java +++ b/eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandConsumerConfiguration.java @@ -4,11 +4,12 @@ import io.eventuate.tram.commands.consumer.CommandDispatcherFactory; import io.eventuate.tram.commands.consumer.CommandReplyProducer; import io.eventuate.tram.messaging.consumer.MessageConsumer; -import io.eventuate.tram.messaging.producer.MessageProducer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; @Configuration +@Import(TramCommandReplyProducerConfiguration.class) public class TramCommandConsumerConfiguration { @Bean @@ -16,8 +17,4 @@ public CommandDispatcherFactory commandDispatcherFactory(MessageConsumer message return new CommandDispatcherFactory(messageConsumer, commandNameMapping, commandReplyProducer); } - @Bean - public CommandReplyProducer commandReplyProducer(MessageProducer messageProducer) { - return new CommandReplyProducer(messageProducer); - } } diff --git a/eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandReplyProducerConfiguration.java b/eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandReplyProducerConfiguration.java new file mode 100644 index 00000000..20269afa --- /dev/null +++ b/eventuate-tram-spring-commands/src/main/java/io/eventuate/tram/spring/commands/consumer/TramCommandReplyProducerConfiguration.java @@ -0,0 +1,14 @@ +package io.eventuate.tram.spring.commands.consumer; + +import io.eventuate.tram.commands.consumer.CommandReplyProducer; +import io.eventuate.tram.messaging.producer.MessageProducer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class TramCommandReplyProducerConfiguration { + @Bean + public CommandReplyProducer commandReplyProducer(MessageProducer messageProducer) { + return new CommandReplyProducer(messageProducer); + } +}