Exemplo n.º 1
0
        public RebusOutboxProcessorConfigurer(StandardConfigurer <ITransport> configurer)
        {
            _configurer = configurer;
            _configurer.OtherService <IRebusOutboxProcessor>()
            .Register(s =>
            {
                return(new RebusOutboxProcessor(_options.MaxMessagesPerBatch,
                                                s.Get <ITransport>(),
                                                s.Get <IBackoffStrategy>(),
                                                s.Get <IRebusLoggerFactory>(),
                                                s.Get <IOutboxContextFactory>()));
            });

            _configurer.Decorate(c =>
            {
                var transport = c.Get <ITransport>();

                if (_options.StartProcessor)
                {
                    var p                = c.Get <IRebusOutboxProcessor>();
                    var events           = c.Get <BusLifetimeEvents>();
                    events.BusStarted   += () => p.Start();
                    events.BusDisposing += () => p.Stop();
                }

                return(new OutboxTransportDecorator(transport));
            });
        }
Exemplo n.º 2
0
 public static void TapReceivedMessagesInto(this StandardConfigurer <ITransport> configurer, ICollection <TransportMessage> receivedMessages)
 {
     configurer.Decorate(c =>
     {
         var tap              = new TransportTap(c.Get <ITransport>());
         tap.MessageReceived += receivedMessages.Add;
         return(tap);
     });
 }
        /// <summary>
        /// Configure fake override of the Transport DeliveryCount with an extarnal producer
        /// </summary>
        /// <param name="configurer"></param>
        /// <param name="count">Count producer</param>
        public static void UseFakeDeliveryCount(this StandardConfigurer <ITransport> configurer, Func <int> count)
        {
            configurer.Decorate(c =>
            {
                var inner = c.Get <ITransport>();

                return(new FakeDeliveryCountDecorator(inner, count));
            });
        }
Exemplo n.º 4
0
        public static void UseAzureServiceBusNativeDeliveryCount(this StandardConfigurer <ITransport> configurer)
        {
            configurer.Decorate(c =>
            {
                var inner = c.Get <ITransport>();

                return(new AzureServiceBusNativeDeliveryCountDecorator(inner));
            });
        }
Exemplo n.º 5
0
        /// <summary>
        /// Enables GZIP of the saved data bus data. Set <paramref name="dataCompressionMode"/> to control when data is gzipped - if <see cref="DataCompressionMode.Always"/>
        /// is selected the data will always be GZIPped, whereas selecting <see cref="DataCompressionMode.Explicit"/> makes the data be GZIPped
        /// only when <see cref="MetadataKeys.ContentEncoding"/> = "gzip" is detected among the metadata for the stored data.
        /// Please note that GZIPping the data requires that it can be fully contained in memory because the underlying streaming APIs do not support lazy-reading a
        /// GZIP stream.
        /// </summary>
        public static StandardConfigurer <IDataBusStorage> UseCompression(this StandardConfigurer <IDataBusStorage> configurer, DataCompressionMode dataCompressionMode)
        {
            configurer.Decorate(c =>
            {
                var dataBusStorage = c.Get <IDataBusStorage>();

                return(new ZippingDataBusStorageDecorator(dataBusStorage, dataCompressionMode));
            });

            return(configurer);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Enables GZIP of the saved data bus data. Set <paramref name="dataCompressionMode"/> to control when data is gzipped - if <see cref="DataCompressionMode.Always"/>
        /// is selected the data will always be GZIPped, whereas selecting <see cref="DataCompressionMode.Explicit"/> makes the data be GZIPped
        /// only when <see cref="MetadataKeys.ContentEncoding"/> = "gzip" is detected among the metadata for the stored data.
        /// Please note that GZIPping the data requires that it can be fully contained in memory because the underlying streaming APIs do not support lazy-reading a
        /// GZIP stream.
        /// </summary>
        public static StandardConfigurer <IDataBusStorage> UseCompression(this StandardConfigurer <IDataBusStorage> configurer, DataCompressionMode dataCompressionMode)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }

            configurer.Decorate(c =>
            {
                var dataBusStorage = c.Get <IDataBusStorage>();

                return(new ZippingDataBusStorageDecorator(dataBusStorage, dataCompressionMode));
            });

            return(configurer);
        }