public ClientCommandDispatcherFactory(
     IRabbitMqConfiguration configuration,
     IPersistentChannelFactory persistentChannelFactory)
 {
     this.configuration            = configuration;
     this.persistentChannelFactory = persistentChannelFactory;
 }
示例#2
0
 public ClientCommandDispatcherFactory(ConnectionConfiguration configuration, IPersistentChannelFactory persistentChannelFactory)
 {
     Preconditions.CheckNotNull(configuration, "configuration");
     Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");
     this.configuration            = configuration;
     this.persistentChannelFactory = persistentChannelFactory;
 }
 public ClientCommandDispatcherFactory(ConnectionConfiguration configuration, IPersistentChannelFactory persistentChannelFactory)
 {
     Preconditions.CheckNotNull(configuration, "configuration");
     Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");
     this.configuration = configuration;
     this.persistentChannelFactory = persistentChannelFactory;
 }
        /// <summary>
        /// Creates a dispatcher
        /// </summary>
        /// <param name="channelFactory">The channel factory</param>
        public SingleChannelClientCommandDispatcher(IPersistentChannelFactory channelFactory)
        {
            Preconditions.CheckNotNull(channelFactory, "channelFactory");

            channelPerOptions    = new ConcurrentDictionary <ChannelDispatchOptions, IPersistentChannel>();
            createChannelFactory = o => channelFactory.CreatePersistentChannel(new PersistentChannelOptions(o.PublisherConfirms));
        }
示例#5
0
        public ClientCommandDispatcher(IPersistentConnection connection, IPersistentChannelFactory persistentChannelFactory)
        {
            Preconditions.CheckNotNull(connection, "connection");
            Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");

            dispatcher = new Lazy <IClientCommandDispatcher>(
                () => new ClientCommandDispatcherSingleton(connection, persistentChannelFactory));
        }
 public ClientCommandDispatcherSingleton(
     IRabbitMqConfiguration configuration,
     IPersistentConnection connection,
     IPersistentChannelFactory persistentChannelFactory)
 {
     persistentChannel = persistentChannelFactory.CreatePersistentChannel(connection);
     StartDispatcherThread(configuration);
 }
示例#7
0
 /// <summary>
 ///     Creates PullingConsumerFactory
 /// </summary>
 /// <param name="channelFactory">The channel factory</param>
 /// <param name="produceConsumeInterceptor">The produce-consume interceptor</param>
 /// <param name="messageSerializationStrategy">The message serialization strategy</param>
 public PullingConsumerFactory(
     IPersistentChannelFactory channelFactory,
     IProduceConsumeInterceptor produceConsumeInterceptor,
     IMessageSerializationStrategy messageSerializationStrategy
     )
 {
     this.channelFactory               = channelFactory;
     this.produceConsumeInterceptor    = produceConsumeInterceptor;
     this.messageSerializationStrategy = messageSerializationStrategy;
 }
 /// <summary>
 /// Creates a dispatcher
 /// </summary>
 /// <param name="channelsCount">The max number of channels</param>
 /// <param name="channelFactory">The channel factory</param>
 public MultiChannelClientCommandDispatcher(int channelsCount, IPersistentChannelFactory channelFactory)
 {
     channelsPoolPerOptions = new ConcurrentDictionary <ChannelDispatchOptions, AsyncQueue <IPersistentChannel> >();
     channelsPoolFactory    = o => new AsyncQueue <IPersistentChannel>(
         Enumerable.Range(0, channelsCount)
         .Select(
             _ => channelFactory.CreatePersistentChannel(new PersistentChannelOptions(o.PublisherConfirms))
             )
         );
 }
示例#9
0
        public ClientCommandDispatcherSingleton(
            IPersistentConnection connection,
            IPersistentChannelFactory persistentChannelFactory)
        {
            Preconditions.CheckNotNull(connection, "connection");
            Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");

            persistentChannel = persistentChannelFactory.CreatePersistentChannel(connection);

            StartDispatcherThread();
        }
示例#10
0
        public ClientCommandDispatcherSingleton(
            ConnectionConfiguration configuration,
            IPersistentConnection connection,
            IPersistentChannelFactory persistentChannelFactory)
        {
            Preconditions.CheckNotNull(configuration, "configuration");
            Preconditions.CheckNotNull(connection, "connection");
            Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");

            persistentChannel = persistentChannelFactory.CreatePersistentChannel(connection);
            channelSemaphore  = new SemaphoreSlim(queueSize, queueSize);
        }
示例#11
0
        public ClientCommandDispatcherSingleton(
            ConnectionConfiguration configuration,
            IPersistentConnection connection,
            IPersistentChannelFactory persistentChannelFactory)
        {
            Preconditions.CheckNotNull(configuration, "configuration");
            Preconditions.CheckNotNull(connection, "connection");
            Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");

            queue             = new BlockingCollection <Action>(configuration.DispatcherQueueSize);
            persistentChannel = persistentChannelFactory.CreatePersistentChannel(connection);

            StartDispatcherThread(configuration);
        }
示例#12
0
        public When_an_action_is_invoked_using_multi_channel()
        {
            channelFactory = Substitute.For <IPersistentChannelFactory>();
            var channel = Substitute.For <IPersistentChannel>();
            var action  = Substitute.For <Func <IModel, int> >();

            channelFactory.CreatePersistentChannel(new PersistentChannelOptions()).Returns(channel);
            channel.InvokeChannelActionAsync(action).Returns(42);

            dispatcher   = new MultiChannelClientCommandDispatcher(1, channelFactory);
            actionResult = dispatcher.InvokeAsync(action, ChannelDispatchOptions.Default)
                           .GetAwaiter()
                           .GetResult();
        }
 public ClientCommandDispatcherFactory(IPersistentChannelFactory persistentChannelFactory)
 {
     Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");
     this.persistentChannelFactory = persistentChannelFactory;
 }
示例#14
0
 public ClientCommandDispatcher(IRabbitMqConfiguration configuration, IPersistentConnection connection, IPersistentChannelFactory persistentChannelFactory)
 {
     dispatcher = new Lazy <IClientCommandDispatcher>(
         () => new ClientCommandDispatcherSingleton(configuration, connection, persistentChannelFactory));
 }
示例#15
0
 public ClientCommandDispatcherFactory(IPersistentChannelFactory persistentChannelFactory)
 {
     Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory");
     this.persistentChannelFactory = persistentChannelFactory;
 }