Esempio n. 1
0
        /// <summary>
        /// Subscribes an object instance to the bus
        /// </summary>
        /// <param name="configurator">Service Bus Service Configurator
        /// - the item that is passed as a parameter to
        /// the action that is calling the configurator.</param>
        /// <param name="observer">The observer to connect to the endpoint</param>
        /// <returns>An instance subscription configurator.</returns>
        public static IObserverConfigurator <T> Observer <T>(this IReceiveEndpointConfigurator configurator, IObserver <ConsumeContext <T> > observer)
            where T : class
        {
            var observerConfigurator = new ObserverConfigurator <T>(observer);

            configurator.AddEndpointSpecification(observerConfigurator);

            return(observerConfigurator);
        }
        /// <summary>
        /// Subscribes an observer instance to the bus
        /// </summary>
        /// <param name="configurator">
        /// Service Bus Service Configurator
        /// - the item that is passed as a parameter to
        /// the action that is calling the configurator.
        /// </param>
        /// <param name="observer">The observer to connect to the endpoint</param>
        /// <param name="configureCallback"></param>
        /// <returns>An instance subscription configurator.</returns>
        public static void Observer <T>(this IReceiveEndpointConfigurator configurator, IObserver <ConsumeContext <T> > observer,
                                        Action <IObserverConfigurator <T> > configureCallback = null)
            where T : class
        {
            var observerConfigurator = new ObserverConfigurator <T>(observer);

            configureCallback?.Invoke(observerConfigurator);

            configurator.AddEndpointSpecification(observerConfigurator);
        }