|
7 | 7 | use std::sync::Arc;
|
8 | 8 | use std::time::Duration;
|
9 | 9 |
|
| 10 | +#[cfg(feature = "future_dmq")] |
10 | 11 | use mithril_common::messages::RegisterSignatureMessageDmq;
|
| 12 | +#[cfg(feature = "future_dmq")] |
11 | 13 | use mithril_dmq_node::DmqConsumerPallas;
|
12 | 14 | use mithril_signed_entity_lock::SignedEntityTypeLock;
|
13 | 15 |
|
14 | 16 | use crate::database::repository::CertificateRepository;
|
15 | 17 | use crate::dependency_injection::{DependenciesBuilder, Result};
|
16 | 18 | use crate::get_dependency;
|
| 19 | +#[cfg(feature = "future_dmq")] |
| 20 | +use crate::services::SignatureConsumerDmq; |
17 | 21 | use crate::services::{
|
18 | 22 | AggregatorClient, AggregatorHTTPClient, MessageService, MithrilMessageService,
|
19 |
| - SequentialSignatureProcessor, SignatureConsumer, SignatureConsumerDmq, SignatureConsumerNoop, |
20 |
| - SignatureProcessor, |
| 23 | + SequentialSignatureProcessor, SignatureConsumer, SignatureConsumerNoop, SignatureProcessor, |
21 | 24 | };
|
22 | 25 | impl DependenciesBuilder {
|
23 | 26 | async fn build_signed_entity_type_lock(&mut self) -> Result<Arc<SignedEntityTypeLock>> {
|
@@ -77,17 +80,20 @@ impl DependenciesBuilder {
|
77 | 80 |
|
78 | 81 | /// Builds a [SignatureConsumer]
|
79 | 82 | pub async fn build_signature_consumer(&mut self) -> Result<Arc<dyn SignatureConsumer>> {
|
80 |
| - let signature_consumer = |
81 |
| - if let Some(dmq_node_socket_path) = self.configuration.dmq_node_socket_path() { |
| 83 | + #[cfg(feature = "future_dmq")] |
| 84 | + let signature_consumer = match self.configuration.dmq_node_socket_path() { |
| 85 | + Some(dmq_node_socket_path) => { |
82 | 86 | let dmq_consumer = Arc::new(DmqConsumerPallas::<RegisterSignatureMessageDmq>::new(
|
83 | 87 | dmq_node_socket_path,
|
84 | 88 | self.configuration.get_network()?,
|
85 | 89 | self.root_logger(),
|
86 | 90 | ));
|
87 | 91 | Arc::new(SignatureConsumerDmq::new(dmq_consumer)) as Arc<dyn SignatureConsumer>
|
88 |
| - } else { |
89 |
| - Arc::new(SignatureConsumerNoop) as Arc<dyn SignatureConsumer> |
90 |
| - }; |
| 92 | + } |
| 93 | + _ => Arc::new(SignatureConsumerNoop) as Arc<dyn SignatureConsumer>, |
| 94 | + }; |
| 95 | + #[cfg(not(feature = "future_dmq"))] |
| 96 | + let signature_consumer = Arc::new(SignatureConsumerNoop) as Arc<dyn SignatureConsumer>; |
91 | 97 |
|
92 | 98 | Ok(signature_consumer)
|
93 | 99 | }
|
|
0 commit comments