|
7 | 7 | import lombok.extern.java.Log; |
8 | 8 | import org.reactivecommons.api.domain.Command; |
9 | 9 | import org.reactivecommons.api.domain.DomainEvent; |
10 | | -import org.reactivecommons.async.api.AsyncQuery; |
11 | | -import org.reactivecommons.async.api.DefaultCommandHandler; |
12 | | -import org.reactivecommons.async.api.DefaultQueryHandler; |
13 | | -import org.reactivecommons.async.api.DynamicRegistry; |
14 | | -import org.reactivecommons.async.api.HandlerRegistry; |
| 10 | +import org.reactivecommons.async.api.*; |
15 | 11 | import org.reactivecommons.async.commons.communications.Message; |
16 | 12 | import org.reactivecommons.async.commons.config.BrokerConfig; |
17 | 13 | import org.reactivecommons.async.commons.config.IBrokerConfigProps; |
|
36 | 32 | import org.springframework.context.annotation.Configuration; |
37 | 33 | import org.springframework.context.annotation.Import; |
38 | 34 | import reactor.core.publisher.Mono; |
39 | | -import reactor.rabbitmq.ChannelPool; |
40 | | -import reactor.rabbitmq.ChannelPoolFactory; |
41 | | -import reactor.rabbitmq.ChannelPoolOptions; |
42 | | -import reactor.rabbitmq.RabbitFlux; |
43 | | -import reactor.rabbitmq.Receiver; |
44 | | -import reactor.rabbitmq.ReceiverOptions; |
45 | | -import reactor.rabbitmq.Sender; |
46 | | -import reactor.rabbitmq.SenderOptions; |
47 | | -import reactor.rabbitmq.Utils; |
| 35 | +import reactor.rabbitmq.*; |
48 | 36 | import reactor.util.retry.Retry; |
49 | 37 |
|
50 | 38 | import java.time.Duration; |
@@ -74,9 +62,13 @@ public ConnectionManager buildConnectionManager(@Value("${spring.application.nam |
74 | 62 | RabbitProperties defaultAppProps, |
75 | 63 | MessageConverter converter, |
76 | 64 | ApplicationContext context, |
| 65 | + HandlerRegistry primaryRegistry, |
77 | 66 | DefaultCommandHandler<?> commandHandler) { |
78 | 67 | ConnectionManager connectionManager = new ConnectionManager(); |
79 | 68 | final Map<String, HandlerRegistry> registries = context.getBeansOfType(HandlerRegistry.class); |
| 69 | + if (!registries.containsValue(primaryRegistry)) { |
| 70 | + registries.put("primaryHandlerRegistry", primaryRegistry); |
| 71 | + } |
80 | 72 | props.getConnections().computeIfAbsent(DEFAULT_DOMAIN, k -> defaultAppProps); |
81 | 73 | props.getConnections() |
82 | 74 | .forEach((domain, properties) -> { |
@@ -213,4 +205,10 @@ public DefaultCommandHandler defaultCommandHandler() { |
213 | 205 | return message -> Mono.error(new RuntimeException("No Handler Registered")); |
214 | 206 | } |
215 | 207 |
|
| 208 | + @Bean |
| 209 | + @ConditionalOnMissingBean(HandlerRegistry.class) |
| 210 | + public HandlerRegistry defaultHandlerRegistry() { |
| 211 | + return HandlerRegistry.register(); |
| 212 | + } |
| 213 | + |
216 | 214 | } |
0 commit comments