protected override void ConfigureServiceBus(Uri uri, IServiceBusConfigurator configurator)
        {
            base.ConfigureServiceBus(uri, configurator);
            _received = new Future <TestMessage>();

            configurator.Subscribe(s => s.Handler <TestMessage>(message => _received.Complete(message)));
        }
        protected override void ConfigureServiceBus(Uri uri, IServiceBusConfigurator configurator)
        {
            base.ConfigureServiceBus(uri, configurator);

            _consumer = new SelectiveConsumer();
            configurator.Subscribe(s => s.Instance(_consumer));
        }
Exemple #3
0
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            configurator.UseJsonSerializer();

            configurator.Subscribe(s => s.Handler <B>(_responseReceived.Complete));
        }
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            _received = new FutureMessage <IProxyMe>();

            configurator.Subscribe(x => { x.Handler <IProxyMe>((message) => _received.Set(message)); });
        }
Exemple #5
0
        protected override void ConfigureServiceBus(Uri uri, IServiceBusConfigurator configurator)
        {
            base.ConfigureServiceBus(uri, configurator);

            _received = new Future <A>();

            configurator.Subscribe(x => x.Handler <A>(msg => _received.Complete(msg)));
        }
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            _timeoutSagaRepository = SetupSagaRepository <TimeoutSaga>();

            configurator.Subscribe(s => { s.Saga(_timeoutSagaRepository); });
        }
Exemple #7
0
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);


            _received = new Future <A>();

            configurator.Subscribe(s => s.Handler <A>(message => _received.Complete(message)));
        }
Exemple #8
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.Subscribe(cf =>
            {
                cf.Handler <MyMessage>(message => receivedMessages.Add(1));
                cf.Handler <MyMessage>(message => receivedMessages.Add(2));
            });
        }
Exemple #9
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.Subscribe(x =>
            {
                x.Handler <A>((context, message) => _receivedA.Set(message));
                x.Handler <B>((context, message) => _receivedB.Set(message));
                x.Handler <C>((context, message) => _receivedC.Set(message));
            });
        }
Exemple #10
0
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            configurator.Subscribe(x => x.Handler <Message <int> >((context, message) =>
            {
                _called.Set(message);

                context.Respond(new Message <string> {
                    Body = message.Body.ToString()
                });
            }));
        }
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            _baseMessage = new Future <BaseMessage>();
            _message     = new Future <Message>();

            configurator.Subscribe(cf =>
            {
                cf.Handler <BaseMessage>(message => _baseMessage.Complete(message));
                cf.Handler <Message>(message => _message.Complete(message));
            });
        }
        /// <summary>
        /// Specify the endpoint from which messages should be read
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="uriString">The uri of the endpoint</param>
        /// <param name="subscriptionSource">Action that returns the subscription configurator.</param>
        public static IServiceBusConfigurator Configure(this IServiceBusConfigurator configurator,
                                                        string uriString, Action <ISubscriptionBusServiceConfigurator> subscriptionSource = null)
        {
            configurator.ReceiveFrom(uriString.ToUri("The receive endpoint URI is invalid"));
            configurator.UseRabbitMq();
            configurator.UseControlBus();

            if (subscriptionSource != null)
            {
                configurator.Subscribe(subscriptionSource);
            }

            return(configurator);
        }
Exemple #13
0
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            configurator.SetConcurrentConsumerLimit(100);

            configurator.Subscribe(s =>
                                   s.Handler <A>(msg =>
            {
                _before.Release();
                _wait.WaitOne(30.Seconds());
                _after.Release();
            }));
        }
Exemple #14
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.Subscribe(x =>
            {
                x.Handler <PingMessage>((context, message) =>
                {
                    _pingReceived.Set(message);
                    context.Respond(new PongMessage {
                        TransactionId = message.TransactionId
                    });
                });
            });
        }
Exemple #15
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.UseJsonSerializer();

            configurator.Subscribe(s => s.Handler <A>((context, message) =>
            {
                _requestReceived.Complete(message);

                context.Respond(new B {
                    Key = message.Key, Value = "Value of " + message.Key
                });
            }));
        }
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            configurator.Subscribe(x =>
            {
                x.InterceptingConsumer(() => new MyConsumer(), consumer =>
                {
                    _first.Set(1);
                    using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew))
                    {
                        consumer();

                        scope.Complete();
                    }
                    _second.Set(2);
                });
            });
        }
        protected override void ConfigureServiceBus(Uri uri, IServiceBusConfigurator configurator)
        {
            base.ConfigureServiceBus(uri, configurator);

            _received      = new Future <A>();
            _faultReceived = new Future <Fault <A> >();

            configurator.Subscribe(s =>
            {
                s.Handler <A>(message =>
                {
                    _received.Complete(message);

                    throw new NullReferenceException(
                        "This is supposed to happen, cause this handler is naughty.");
                });

                s.Handler <Fault <A, Guid> >(message => { _faultReceived.Complete(message); });
            });
        }
Exemple #18
0
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            // this is our dependency, but could be dynamically resolved from a container in method
            // below is so desired.
            var dependency = new Dependency();

            // create the actual saga repository
            ISagaRepository <InjectingSampleSaga> sagaRepository = SetupSagaRepository <InjectingSampleSaga>();

            // decorate the saga repository with the injecting repository, specifying the property and a
            // lambda method to return the property value given the saga instance that was loaded
            // allows properties of the saga to be used in the resolution of the dependency
            ISagaRepository <InjectingSampleSaga> injectingRepository =
                InjectingSagaRepository <InjectingSampleSaga> .Create(sagaRepository,
                                                                      x => x.Dependency, saga => dependency);

            // subscribe the decorated saga repository to the bus during configuration
            configurator.Subscribe(x => x.Saga(injectingRepository));
        }
Exemple #19
0
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            configurator.Subscribe(x => { x.Consumer <CommandHandler>(); });
        }
Exemple #20
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.Subscribe(x => x.Consumer <CommandSecurityMaker <IBusinessCommand> >());
        }
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            configurator.Subscribe(s => { s.Handler <BadMessage>(x => { }); });
        }
Exemple #22
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.Subscribe(x => x.Handler <Request>((context, message) => context.Respond(new Response())));
        }
Exemple #23
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.Subscribe(x => x.Consumer <TestReplyService <PingMessage, Guid, PongMessage> >());
        }
Exemple #24
0
        protected override void ConfigureRemoteBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureRemoteBus(configurator);

            configurator.Subscribe(x => { x.Consumer <ConsumerOfAAndB>(); });
        }
Exemple #25
0
        protected override void ConfigureServiceBus(Uri uri, IServiceBusConfigurator configurator)
        {
            base.ConfigureServiceBus(uri, configurator);

            configurator.Subscribe(x => { x.Consumer <PingHandler>(); });
        }