コード例 #1
1
        protected AbstractMsmqListener(
            IQueueStrategy queueStrategy,
            Uri endpoint,
            int threadCount,
            IMessageSerializer messageSerializer,
            IEndpointRouter endpointRouter,
            TransactionalOptions transactional,
            IMessageBuilder<Message> messageBuilder)
        {
            this.queueStrategy = queueStrategy;
            this.messageSerializer = messageSerializer;
            this.endpointRouter = endpointRouter;
            this.endpoint = endpoint;

            this.threadCount = threadCount;
            threads = new Thread[threadCount];

            switch (transactional)
            {
                case TransactionalOptions.Transactional:
                    this.transactional = true;
                    break;
                case TransactionalOptions.NonTransactional:
                    this.transactional = false;
                    break;
                case TransactionalOptions.FigureItOut:
                    this.transactional = null;
                    break;
                default:
                    throw new ArgumentOutOfRangeException("transactional");
            }
            this.messageBuilder = messageBuilder;
            this.messageBuilder.Initialize(Endpoint);
        }
コード例 #2
0
        public IServiceBus CreateServiceBus(MassTransitConnectionDescriptor connectionDescriptor, IQueueStrategy queueStrategy, IReadOnlyList<Action<SubscriptionBusServiceConfigurator>> subscriptions)
        {
            return ServiceBusFactory.New(bus =>
            {
                var receiveUri = new Uri(connectionDescriptor.Host, queueStrategy.GetQueueName());

                bus.UseRabbitMq(r =>
                {
                    r.ConfigureHost(receiveUri, h =>
                    {
                        h.SetUsername(connectionDescriptor.UserName);
                        h.SetPassword(connectionDescriptor.Password);
                    });
                });

                bus.ReceiveFrom(receiveUri);
                bus.UseJsonSerializer();
                bus.SetConcurrentConsumerLimit(_concurrencyLimit);

                foreach (var subscription in subscriptions)
                    bus.Subscribe(subscription);

                bus.Validate();
            });
        }
コード例 #3
0
ファイル: MsmqTransport.cs プロジェクト: philiphoy/rhino-esb
 public MsmqTransport(IMessageSerializer serializer, IQueueStrategy queueStrategy, Uri endpoint, int threadCount, IMsmqTransportAction[] transportActions, IEndpointRouter endpointRouter, IsolationLevel queueIsolationLevel, TransactionalOptions transactional, bool consumeInTransaction)
     : base(queueStrategy, endpoint, threadCount, serializer, endpointRouter, transactional)
 {
     this.transportActions = transportActions;
     this.queueIsolationLevel = queueIsolationLevel;
     this.consumeInTransaction = consumeInTransaction;
 }
コード例 #4
0
        public static void Test(ITransport t, IQueueStrategy strategy,
            Endpoint queueEndpoint, Action<Message> send, Func<MessageEnumerator>
            enumer)
        {
            Guid id = Guid.NewGuid();
            var serializer = new XmlMessageSerializer(new
                                                          DefaultReflection(), new DefaultKernel());

            var subscriptionStorage = new MsmqSubscriptionStorage(new
                                                                      DefaultReflection(),
                                                                  serializer,
                                                                  queueEndpoint.Uri,
                                                                  new
                                                                      EndpointRouter(),
                                                                  strategy);
            subscriptionStorage.Initialize();

            var wait = new ManualResetEvent(false);

            subscriptionStorage.SubscriptionChanged += () => wait.Set();

            t.AdministrativeMessageArrived +=
                subscriptionStorage.HandleAdministrativeMessage;

            Message msg = new MessageBuilder
                (serializer).GenerateMsmqMessageFromMessageBatch(new
                                                                     AddInstanceSubscription
                {
                    Endpoint = queueEndpoint.Uri.ToString(),
                    InstanceSubscriptionKey = id,
                    Type = typeof (TestMessage2).FullName,
                });
            send(msg);

            wait.WaitOne();

            msg = new MessageBuilder
                (serializer).GenerateMsmqMessageFromMessageBatch(new
                                                                     RemoveInstanceSubscription
                {
                    Endpoint = queueEndpoint.Uri.ToString(),
                    InstanceSubscriptionKey = id,
                    Type = typeof (TestMessage2).FullName,
                });

            wait.Reset();

            send(msg);

            wait.WaitOne();

            IEnumerable<Uri> uris = subscriptionStorage
                .GetSubscriptionsFor(typeof (TestMessage2));
            Assert.Equal(0, uris.Count());

            int count = 0;
            MessageEnumerator copy = enumer();
            while (copy.MoveNext()) count++;
            Assert.Equal(0, count);
        }
コード例 #5
0
        protected AbstractFileListener(
            IQueueStrategy queueStrategy,
            Uri endpoint,
            int threadCount,
            IMessageSerializer messageSerializer,
            IEndpointRouter endpointRouter,
            TransactionalOptions transactional,
            IMessageBuilder <Message> messageBuilder)
        {
            this.queueStrategy     = queueStrategy;
            this.messageSerializer = messageSerializer;
            this.endpointRouter    = endpointRouter;
            this.endpoint          = endpoint;
            this.threadCount       = threadCount;
            threads = new Thread[threadCount];
            switch (transactional)
            {
            case TransactionalOptions.Transactional: this.transactional = true; break;

            case TransactionalOptions.NonTransactional: this.transactional = false; break;

            case TransactionalOptions.FigureItOut: this.transactional = null; break;

            default: throw new ArgumentOutOfRangeException("transactional");
            }
            this.messageBuilder = messageBuilder;
            this.messageBuilder.Initialize(Endpoint);
        }
コード例 #6
0
ファイル: MsmqTransport.cs プロジェクト: stemarie/rhino-esb
 public MsmqTransport(IMessageSerializer serializer, IQueueStrategy queueStrategy, Uri endpoint, int threadCount, IMsmqTransportAction[] transportActions, IEndpointRouter endpointRouter, IsolationLevel queueIsolationLevel, TransactionalOptions transactional, bool consumeInTransaction)
     : base(queueStrategy, endpoint, threadCount, serializer, endpointRouter, transactional)
 {
     this.transportActions     = transportActions;
     this.queueIsolationLevel  = queueIsolationLevel;
     this.consumeInTransaction = consumeInTransaction;
 }
コード例 #7
0
 public MsmqReadyForWorkListener(IQueueStrategy queueStrategy,
                                 Uri endpoint,
                                 int threadCount,
                                 IMessageSerializer messageSerializer,
                                 IEndpointRouter endpointRouter,
                                 TransactionalOptions transactional) : base(queueStrategy, endpoint, threadCount, messageSerializer, endpointRouter, transactional)
 {
 }
コード例 #8
0
		public MsmqReadyForWorkListener(IQueueStrategy queueStrategy, 
			Uri endpoint, 
			int threadCount, 
			IMessageSerializer messageSerializer, 
			IEndpointRouter endpointRouter, 
			TransactionalOptions transactional,
            IMessageBuilder<Message> messageBuilder) : base(queueStrategy, endpoint, threadCount, messageSerializer, endpointRouter, transactional, messageBuilder)
		{}
コード例 #9
0
 public MsmqLoadBalancer(
     IMessageSerializer serializer,
     IQueueStrategy queueStrategy,
     IEndpointRouter endpointRouter,
     Uri endpoint,
     int threadCount)
     : base(queueStrategy, endpoint, threadCount, serializer, endpointRouter)
 {
     heartBeatTimer = new Timer(SendHeartBeatToSecondaryServer);
     this.queueStrategy = queueStrategy;
 }
コード例 #10
0
 public MsmqLoadBalancer(
     IMessageSerializer serializer,
     IQueueStrategy queueStrategy,
     IEndpointRouter endpointRouter,
     Uri endpoint,
     int threadCount,
     Uri secondaryLoadBalancer)
     : this(serializer ,queueStrategy, endpointRouter,endpoint, threadCount)
 {
     this.secondaryLoadBalancer = secondaryLoadBalancer;
 }
コード例 #11
0
 public MsmqLoadBalancer(
     IMessageSerializer serializer,
     IQueueStrategy queueStrategy,
     IEndpointRouter endpointRouter,
     Uri endpoint,
     int threadCount,
     TransactionalOptions transactional)
     : base(queueStrategy, endpoint, threadCount, serializer, endpointRouter, transactional)
 {
     heartBeatTimer     = new Timer(SendHeartBeatToSecondaryServer);
     this.queueStrategy = queueStrategy;
 }
コード例 #12
0
 public MsmqLoadBalancer(
     IMessageSerializer serializer,
     IQueueStrategy queueStrategy,
     IEndpointRouter endpointRouter,
     Uri endpoint,
     int threadCount,
     Uri secondaryLoadBalancer,
     TransactionalOptions transactional)
     : this(serializer, queueStrategy, endpointRouter, endpoint, threadCount, transactional)
 {
     this.secondaryLoadBalancer = secondaryLoadBalancer;
 }
コード例 #13
0
ファイル: MessagePublisher.cs プロジェクト: avieru/rabbitBus
 public MessagePublisher(string userName,
                         IRouteConfiguration <IPublishInfo> publishRouteConfiguration,
                         IRouteConfiguration <IConsumeInfo> consumeRouteConfiguration,
                         ISerializationStrategy defaultSerializationStrategy,
                         IQueueStrategy queueStrategy)
 {
     _userName = userName;
     _publishRouteConfiguration    = publishRouteConfiguration;
     _consumeRouteConfiguration    = consumeRouteConfiguration;
     _defaultSerializationStrategy = defaultSerializationStrategy;
     _queueStrategy = queueStrategy;
 }
コード例 #14
0
 public MsmqSubscriptionStorage(
     IReflection reflection,
     IMessageSerializer messageSerializer,
     Uri subscriptionQueue,
     IQueueStrategy queueStrategy
     )
 {
     this.reflection = reflection;
     this.messageSerializer = messageSerializer;
     this.queueStrategy = queueStrategy;
     this.subscriptionQueue = this.queueStrategy.CreateSubscriptionQueueUri(subscriptionQueue);
 }
コード例 #15
0
 public MsmqSecondaryLoadBalancer(
     IMessageSerializer serializer,
     IQueueStrategy queueStrategy,
     IEndpointRouter endpointRouter,
     Uri endpoint,
     Uri primaryLoadBalancer,
     int threadCount)
     : base(serializer, queueStrategy, endpointRouter, endpoint, threadCount)
 {
     TimeoutForHeartBeatFromPrimary = TimeSpan.FromSeconds(10);
     this.primaryLoadBalancer = primaryLoadBalancer;
     tookOverWork = false;
 }
コード例 #16
0
		public MsmqLoadBalancer(
					IMessageSerializer serializer,
					IQueueStrategy queueStrategy,
					IEndpointRouter endpointRouter,
					Uri endpoint,
					int threadCount,
					Uri secondaryLoadBalancer,
					TransactionalOptions transactional,
                    IMessageBuilder<Message> messageBuilder)
			: this(serializer, queueStrategy, endpointRouter, endpoint, threadCount, transactional, messageBuilder)
		{
			this.secondaryLoadBalancer = secondaryLoadBalancer;
		}
コード例 #17
0
		public MsmqLoadBalancer(
			IMessageSerializer serializer,
			IQueueStrategy queueStrategy,
			IEndpointRouter endpointRouter,
			Uri endpoint,
			int threadCount,
			TransactionalOptions transactional,
            IMessageBuilder<Message> messageBuilder)
			: base(queueStrategy, endpoint, threadCount, serializer, endpointRouter, transactional, messageBuilder)
		{
			heartBeatTimer = new Timer(SendHeartBeatToSecondaryServer);
			this.queueStrategy = queueStrategy;
		}
コード例 #18
0
 public MsmqSubscriptionStorage(
     IReflection reflection,
     IMessageSerializer messageSerializer,
     Uri queueBusListensTo,
     IEndpointRouter  endpointRouter,
     IQueueStrategy queueStrategy
     )
 {
     this.reflection = reflection;
     this.messageSerializer = messageSerializer;
     this.endpointRouter = endpointRouter;
     this.queueStrategy = queueStrategy;
     this.subscriptionQueue = this.queueStrategy.CreateSubscriptionQueueUri(queueBusListensTo);
 }
コード例 #19
0
 public MsmqSecondaryLoadBalancer(
     IMessageSerializer serializer,
     IQueueStrategy queueStrategy,
     IEndpointRouter endpointRouter,
     Uri endpoint,
     Uri primaryLoadBalancer,
     int threadCount,
     TransactionalOptions transactional)
     : base(serializer, queueStrategy, endpointRouter, endpoint, threadCount, transactional)
 {
     TimeoutForHeartBeatFromPrimary = TimeSpan.FromSeconds(10);
     this.primaryLoadBalancer       = primaryLoadBalancer;
     tookOverWork = false;
 }
コード例 #20
0
 protected AbstractMsmqListener(
     IQueueStrategy queueStrategy,
     Uri endpoint,
     int threadCount,
     IMessageSerializer messageSerializer,
     IEndpointRouter endpointRouter)
 {
     this.queueStrategy = queueStrategy;
     this.messageSerializer = messageSerializer;
     this.endpointRouter = endpointRouter;
     this.endpoint = endpoint;
     this.threadCount = threadCount;
     threads = new Thread[threadCount];
 }
コード例 #21
0
 public MsmqSubscriptionStorage(
     IReflection reflection,
     IMessageSerializer messageSerializer,
     Uri queueBusListensTo,
     IEndpointRouter endpointRouter,
     IQueueStrategy queueStrategy
     )
 {
     this.reflection        = reflection;
     this.messageSerializer = messageSerializer;
     this.endpointRouter    = endpointRouter;
     this.queueStrategy     = queueStrategy;
     this.subscriptionQueue = this.queueStrategy.CreateSubscriptionQueueUri(queueBusListensTo);
 }
コード例 #22
0
        public IServiceBus CreateServiceBus(MassTransitConnectionDescriptor connectionDescriptor, IQueueStrategy queueStrategy, IReadOnlyList<Action<SubscriptionBusServiceConfigurator>> subscriptions)
        {
            UriBuilder builder = new UriBuilder(connectionDescriptor.Host) {Scheme = "loopback"};

            return ServiceBusFactory.New(bus =>
            {
                var receiveUri = new Uri(builder.Uri, queueStrategy.GetQueueName());

                bus.ReceiveFrom(receiveUri);
                bus.UseJsonSerializer();

                foreach (var subscription in subscriptions)
                    bus.Subscribe(subscription);

                bus.Validate();

            });
        }
コード例 #23
0
 public CreateReadyForWorkQueuesAction(IQueueStrategy queueStrategy, MsmqReadyForWorkListener readyForWorkListener)
 {
     this.queueStrategy        = queueStrategy;
     this.readyForWorkListener = readyForWorkListener;
 }
コード例 #24
0
 public CreateLoadBalancerQueuesAction(IQueueStrategy queueStrategy, MsmqLoadBalancer loadBalancer)
     : base(queueStrategy)
 {
     this.loadBalancer = loadBalancer;
 }
コード例 #25
0
 public CreateLoadBalancerQueuesAction(IQueueStrategy queueStrategy, MsmqLoadBalancer loadBalancer)
     : base(queueStrategy)
 {
     this.loadBalancer = loadBalancer;
 }
コード例 #26
0
        public IServiceBus CreateServiceBus(MassTransitConnectionDescriptor connectionDescriptor, IQueueStrategy queueStrategy, IReadOnlyList <Action <SubscriptionBusServiceConfigurator> > subscriptions)
        {
            return(ServiceBusFactory.New(bus =>
            {
                var receiveUri = new Uri(connectionDescriptor.Host, queueStrategy.GetQueueName());

                bus.UseRabbitMq(r =>
                {
                    r.ConfigureHost(receiveUri, h =>
                    {
                        h.SetUsername(connectionDescriptor.UserName);
                        h.SetPassword(connectionDescriptor.Password);
                    });
                });

                bus.ReceiveFrom(receiveUri);
                bus.UseJsonSerializer();

                bus.ConfigureJsonSerializer(ConfigureIsoDateTimeConverters);
                bus.ConfigureJsonDeserializer(ConfigureIsoDateTimeConverters);

                bus.SetConcurrentConsumerLimit(_concurrencyLimit);

                foreach (var subscription in subscriptions)
                {
                    bus.Subscribe(subscription);
                }

                bus.Validate();
            }));
        }
コード例 #27
0
 public IConfigurationContext WithConnectionUnavailableQueueStrategy(IQueueStrategy queueStrategy)
 {
     ConfigurationModel.ConnectionDownQueueStrategy = queueStrategy;
     return(this);
 }
コード例 #28
0
 public CreateLoadBalancerQueuesAction(IQueueStrategy queueStrategy, MsmqLoadBalancer loadBalancer)
 {
     this.queueStrategy = queueStrategy;
     this.loadBalancer  = loadBalancer;
 }
コード例 #29
0
 public QueueCreationModule(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #30
0
 public ErrorDescriptionAction(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #31
0
 protected AbstractCreateQueuesAction(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #32
0
 public CreateLoadBalancerQueuesAction(IQueueStrategy queueStrategy, MsmqLoadBalancer loadBalancer)
 {
     this.queueStrategy = queueStrategy;
     this.loadBalancer = loadBalancer;
 }
コード例 #33
0
ファイル: QueuePolicy.cs プロジェクト: ctguxp/Waffle
 /// <summary>
 /// Initializes a new instance of the <see cref="QueuePolicy"/> class.
 /// </summary> 
 /// <param name="strategy">The <see cref="IQueueStrategy"/>.</param>
 public QueuePolicy(IQueueStrategy strategy)
 {
     this.strategy = strategy;
 }
コード例 #34
0
 public CreateLogQueueAction(IQueueStrategy queueStrategy, MessageLoggingModule messageLoggingModule, ITransport transport)
     : base(queueStrategy)
 {
     this.messageLoggingModule = messageLoggingModule;
     this.transport = transport;
 }
コード例 #35
0
 public ErrorAction(int numberOfRetries, IQueueStrategy queueStrategy)
 {
     this.numberOfRetries = numberOfRetries;
     this.queueStrategy   = queueStrategy;
 }
コード例 #36
0
 public CreateReadyForWorkQueuesAction(IQueueStrategy queueStrategy, MsmqReadyForWorkListener readyForWorkListener)
 {
     this.queueStrategy = queueStrategy;
     this.readyForWorkListener = readyForWorkListener;
 }
コード例 #37
0
ファイル: MsmqTransport.cs プロジェクト: nkmajeti/rhino-tools
 public MsmqTransport(IMessageSerializer serializer, IQueueStrategy queueStrategy, Uri endpoint, int threadCount, IMsmqTransportAction[] transportActions, IEndpointRouter endpointRouter, IsolationLevel queueIsolationLevel)
     : base(queueStrategy,endpoint, threadCount, serializer,endpointRouter)
 {
     this.transportActions = transportActions;
     this.queueIsolationLevel = queueIsolationLevel;
 }
コード例 #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueuePolicy"/> class.
 /// </summary>
 /// <param name="strategy">The <see cref="IQueueStrategy"/>.</param>
 public QueuePolicy(IQueueStrategy strategy)
 {
     this.strategy = strategy;
 }
コード例 #39
0
 public DiscardAction(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #40
0
ファイル: ErrorAction.cs プロジェクト: BiYiTuan/rhino-esb
 public ErrorAction(int numberOfRetries, IQueueStrategy queueStrategy)
 {
     this.numberOfRetries = numberOfRetries;
     this.queueStrategy = queueStrategy;
 }
コード例 #41
0
 public CreateQueuesAction(IQueueStrategy queueStrategy, IServiceBus serviceBus)
 {
     this.queueStrategy = queueStrategy;
     this.serviceBus    = serviceBus;
 }
コード例 #42
0
 public TimeoutAction(IQueueStrategy queueStrategy, ITransactionStrategy transactionStrategy)
 {
     this.queueStrategy       = queueStrategy;
     this.transactionStrategy = transactionStrategy;
 }
コード例 #43
0
        public IServiceBus CreateServiceBus(MassTransitConnectionDescriptor connectionDescriptor, IQueueStrategy queueStrategy, IReadOnlyList <Action <SubscriptionBusServiceConfigurator> > subscriptions)
        {
            UriBuilder builder = new UriBuilder(connectionDescriptor.Host)
            {
                Scheme = "loopback"
            };

            return(ServiceBusFactory.New(bus =>
            {
                var receiveUri = new Uri(builder.Uri, queueStrategy.GetQueueName());

                bus.ReceiveFrom(receiveUri);
                bus.UseJsonSerializer();

                bus.ConfigureJsonSerializer(ConfigureIsoDateTimeConverters);
                bus.ConfigureJsonDeserializer(ConfigureIsoDateTimeConverters);

                foreach (var subscription in subscriptions)
                {
                    bus.Subscribe(subscription);
                }

                bus.Validate();
            }));
        }
コード例 #44
0
ファイル: FIeldProblem_Nick.cs プロジェクト: helge/rhino-esb
        public static void Test(ITransport t, IQueueStrategy strategy,
                                Endpoint queueEndpoint, Action <Message> send, Func <MessageEnumerator>
                                enumer)
        {
            Guid id         = Guid.NewGuid();
            var  serializer = new XmlMessageSerializer(new
                                                       DefaultReflection(), new DefaultKernel());

            var subscriptionStorage = new MsmqSubscriptionStorage(new
                                                                  DefaultReflection(),
                                                                  serializer,
                                                                  queueEndpoint.Uri,
                                                                  new
                                                                  EndpointRouter(),
                                                                  strategy);

            subscriptionStorage.Initialize();

            var wait = new ManualResetEvent(false);

            subscriptionStorage.SubscriptionChanged += () => wait.Set();

            t.AdministrativeMessageArrived +=
                subscriptionStorage.HandleAdministrativeMessage;

            Message msg = new MsmqMessageBuilder
                              (serializer, new DefaultKernel()).BuildFromMessageBatch(new
                                                                                      AddInstanceSubscription
            {
                Endpoint = queueEndpoint.Uri.ToString(),
                InstanceSubscriptionKey = id,
                Type = typeof(TestMessage2).FullName,
            });

            send(msg);

            wait.WaitOne();

            msg = new MsmqMessageBuilder
                      (serializer, new DefaultKernel()).BuildFromMessageBatch(new
                                                                              RemoveInstanceSubscription
            {
                Endpoint = queueEndpoint.Uri.ToString(),
                InstanceSubscriptionKey = id,
                Type = typeof(TestMessage2).FullName,
            });

            wait.Reset();

            send(msg);

            wait.WaitOne();

            IEnumerable <Uri> uris = subscriptionStorage
                                     .GetSubscriptionsFor(typeof(TestMessage2));

            Assert.Equal(0, uris.Count());

            int count = 0;
            MessageEnumerator copy = enumer();

            while (copy.MoveNext())
            {
                count++;
            }
            Assert.Equal(0, count);
        }
コード例 #45
0
 public CreateLogQueueAction(IQueueStrategy queueStrategy, MessageLoggingModule messageLoggingModule, ITransport transport)
     : base(queueStrategy)
 {
     this.messageLoggingModule = messageLoggingModule;
     this.transport            = transport;
 }
コード例 #46
0
 public QueueCreationModule(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #47
0
 public CreateQueuesAction(IQueueStrategy queueStrategy, IServiceBus serviceBus)
     : base(queueStrategy)
 {
     this.serviceBus = serviceBus;
 }
コード例 #48
0
 public CreateQueuesAction(IQueueStrategy queueStrategy, IServiceBus serviceBus)
     : base(queueStrategy)
 {
     this.serviceBus = serviceBus;
 }
コード例 #49
0
 public TimeoutAction(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #50
0
 public TimeoutAction(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #51
0
 protected AbstractCreateQueuesAction(IQueueStrategy queueStrategy)
 {
     this.queueStrategy = queueStrategy;
 }
コード例 #52
0
 public CreateQueuesAction(IQueueStrategy queueStrategy, IServiceBus serviceBus)
 {
     this.queueStrategy = queueStrategy;
     this.serviceBus = serviceBus;
 }