コード例 #1
0
ファイル: RabbitBus.cs プロジェクト: forki/Contour
        /// <summary>
        /// Registers a receiver using the <paramref name="configuration"/>
        /// </summary>
        /// <param name="configuration">
        /// Receiver configuration
        /// </param>
        /// <param name="isCallback">
        /// Denotes if a receiver should handle the callback messages
        /// </param>
        /// <returns>
        /// The <see cref="RabbitReceiver"/>.
        /// </returns>
        public RabbitReceiver RegisterReceiver(IReceiverConfiguration configuration, bool isCallback = false)
        {
            this.logger.Trace(
                $"Registering a new receiver of [{configuration.Label}] with connection string [{configuration.Options.GetConnectionString()}]");

            RabbitReceiver receiver;

            if (isCallback)
            {
                receiver = new RabbitCallbackReceiver(this, configuration, this.connectionPool);

                // No need to subscribe to listener-created event as it will not be fired by the callback receiver. A callback listener is not checked with listeners in other receivers for compatibility.
            }
            else
            {
                receiver = new RabbitReceiver(this, configuration, this.connectionPool);
                receiver.ListenerCreated += this.OnListenerCreated;
            }

            this.ComponentTracker.Register(receiver);

            this.logger.Trace(
                $"A receiver of [{configuration.Label}] with connection string [{configuration.Options.GetConnectionString()}] registered successfully");
            return(receiver);
        }
コード例 #2
0
ファイル: RabbitBus.cs プロジェクト: ehramovich/Contour
        /// <summary>
        /// The build receivers.
        /// </summary>
        private void BuildReceivers()
        {
            this.ListenerRegistry = new ListenerRegistry(this);

            this.Configuration.ReceiverConfigurations.ForEach(
                c =>
            {
                var receiver = new RabbitReceiver(c, this.ListenerRegistry);
                this.ComponentTracker.Register(receiver);
            });
        }
コード例 #3
0
ファイル: RabbitBus.cs プロジェクト: Sliborskii/Contour
        /// <summary>
        /// Registers a receiver using the <paramref name="configuration"/>
        /// </summary>
        /// <param name="configuration">
        /// Receiver configuration
        /// </param>
        /// <returns>
        /// The <see cref="RabbitReceiver"/>.
        /// </returns>
        public RabbitReceiver RegisterReceiver(IReceiverConfiguration configuration)
        {
            this.logger.Trace(
                $"Registering a new receiver of [{configuration.Label}] with connection string [{configuration.Options.GetConnectionString()}]");

            var receiver = new RabbitReceiver(this, configuration, this.connectionPool);

            receiver.ListenerRegistered += this.OnListenerRegistered;
            this.ComponentTracker.Register(receiver);

            this.logger.Trace(
                $"A receiver of [{configuration.Label}] with connection string [{configuration.Options.GetConnectionString()}] registered successfully");
            return(receiver);
        }