コード例 #1
0
        protected override void ConfigureServiceBus(Uri uri, IServiceBusConfigurator configurator)
        {
            base.ConfigureServiceBus(uri, configurator);

            configurator.AddService <SubscriptionPublisher>();
            configurator.AddService <SubscriptionConsumer>();
        }
コード例 #2
0
        /// <summary>
        /// Implements a distributor-to-worker pattern for the given message type.
        /// </summary>
        /// <typeparam name="T">The type of message to use the distributor</typeparam>
        /// <param name="configurator">Service bus to implement the distributor</param>
        /// <param name="endpointFactory">Factory to generate endpoints from a given URL</param>
        public static void UseDistributorFor <T>(this IServiceBusConfigurator configurator, IEndpointFactory endpointFactory)
            where T : class
        {
            configurator.AddService(() => new Distributor <T>(endpointFactory));

            configurator.SetReceiveTimeout(50.Milliseconds());
        }
コード例 #3
0
        /// <summary>
        /// Implements a distributor-to-worker pattern for the given message type.
        /// </summary>
        /// <typeparam name="T">The type of to use the distributor</typeparam>
        /// <typeparam name="K">The <code>IWorkerSelectionStrategy</code> used to pick
        /// which worker node to send a message</typeparam>
        /// <param name="configurator">Service bus to implement the distributor</param>
        /// <param name="endpointFactory">Factory to generate endpoints from a given URL</param>
        public static void UseDistributorFor <T, K>(this IServiceBusConfigurator configurator, IEndpointFactory endpointFactory)
            where T : class
            where K : class, IWorkerSelectionStrategy <T>, new()
        {
            configurator.AddService(() => new Distributor <T>(endpointFactory, new K()));

            configurator.SetReceiveTimeout(50.Milliseconds());
        }
コード例 #4
0
 public static void ImplementSagaDistributorWorker <T>(this IServiceBusConfigurator configurator, ISagaRepository <T> repository)
     where T : SagaStateMachine <T>, ISaga
 {
     configurator.AddService(() => new SagaWorker <T>());
 }
コード例 #5
0
 public static void ImplementDistributorWorker <T>(this IServiceBusConfigurator configurator, Func <T, Action <T> > getConsumer)
     where T : class
 {
     configurator.AddService(() => new Worker <T>(getConsumer));
 }
コード例 #6
0
// ReSharper disable UnusedMember.Local
        private void AddServiceForDataEvent <TMessage>()
// ReSharper restore UnusedMember.Local
            where TMessage : class
        {
            _configurator.AddService(() => new Distributor <TMessage>(_endpointFactory));
        }
コード例 #7
0
 protected void ConnectSubscriptionService(IServiceBusConfigurator configurator,
                                           ISubscriptionService subscriptionService)
 {
     configurator.AddService(IBusServiceLayer.Session, () => new SubscriptionPublisher(subscriptionService));
     configurator.AddService(IBusServiceLayer.Session, () => new SubscriptionConsumer(subscriptionService));
 }