コード例 #1
0
            public void Source(string queue, Action <ShovelSourceConfigurator> configurator)
            {
                _sourceCalled = true;

                var impl = new ShovelSourceConfiguratorImpl();

                configurator?.Invoke(impl);

                _sourceProtocol           = impl.ShovelProtocol;
                _sourceQueue              = queue;
                _sourceExchangeName       = impl.ExchangeName;
                _sourceExchangeRoutingKey = impl.ExchangeRoutingKey;
                _sourcePrefetchCount      = impl.PrefetchCount;
                _deleteShovelAfter        = impl.DeleteAfterShovel;

                if (string.IsNullOrWhiteSpace(queue) && string.IsNullOrWhiteSpace(impl.ExchangeName))
                {
                    _errors.Add(new ErrorImpl("Both source queue and exchange missing."));
                }

                if (!string.IsNullOrWhiteSpace(queue) && !string.IsNullOrWhiteSpace(impl.ExchangeName))
                {
                    _errors.Add(new ErrorImpl("Both source queue and exchange cannot be present."));
                }
            }
コード例 #2
0
            public void Destination(string queue, Action <ShovelDestinationConfigurator> configurator)
            {
                _destinationCalled = true;

                var impl = new ShovelDestinationConfiguratorImpl();

                configurator?.Invoke(impl);

                _destinationProtocol           = impl.ShovelProtocol;
                _destinationQueue              = queue;
                _destinationExchangeName       = impl.ExchangeName;
                _destinationExchangeRoutingKey = impl.ExchangeRoutingKey;
                _destinationAddForwardHeaders  = impl.AddHeaders;
                _destinationAddTimestampHeader = impl.AddTimestampHeader;

                if (string.IsNullOrWhiteSpace(queue) && string.IsNullOrWhiteSpace(impl.ExchangeName))
                {
                    _errors.Add(new ErrorImpl("Both source queue and exchange missing."));
                }

                if (!string.IsNullOrWhiteSpace(queue) && !string.IsNullOrWhiteSpace(impl.ExchangeName))
                {
                    _errors.Add(new ErrorImpl("Both destination queue and exchange cannot be present."));
                }
            }
コード例 #3
0
 public ShovelRequestParams(
     AckMode acknowledgeMode,
     int reconnectDelay,
     ShovelProtocolType sourceProtocol,
     string sourceUri,
     string sourceQueue,
     string sourceExchange,
     string sourceExchangeRoutingKey,
     ulong sourcePrefetchCount,
     object sourceDeleteAfter,
     ShovelProtocolType destinationProtocol,
     string destinationUri,
     string destinationExchange,
     string destinationExchangeRoutingKey,
     string destinationQueue,
     bool destinationAddForwardHeaders,
     bool destinationAddTimestampHeader)
 {
     SourceProtocol                = sourceProtocol;
     SourceUri                     = sourceUri;
     SourceQueue                   = sourceQueue;
     DestinationProtocol           = destinationProtocol;
     DestinationUri                = destinationUri;
     DestinationQueue              = destinationQueue;
     ReconnectDelay                = reconnectDelay;
     AcknowledgeMode               = acknowledgeMode;
     SourceDeleteAfter             = sourceDeleteAfter;
     SourcePrefetchCount           = sourcePrefetchCount;
     SourceExchange                = sourceExchange;
     SourceExchangeRoutingKey      = sourceExchangeRoutingKey;
     DestinationExchange           = destinationExchange;
     DestinationExchangeRoutingKey = destinationExchangeRoutingKey;
     // DestinationPublishProperties = destinationPublishProperties;
     DestinationAddForwardHeaders  = destinationAddForwardHeaders;
     DestinationAddTimestampHeader = destinationAddTimestampHeader;
 }
コード例 #4
0
 public void Protocol(ShovelProtocolType protocol) => ShovelProtocol = protocol;