public ClientCommandDispatcherFactory( IRabbitMqConfiguration configuration, IPersistentChannelFactory 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)); }
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); }
/// <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)) ) ); }
public ClientCommandDispatcherSingleton( IPersistentConnection connection, IPersistentChannelFactory persistentChannelFactory) { Preconditions.CheckNotNull(connection, "connection"); Preconditions.CheckNotNull(persistentChannelFactory, "persistentChannelFactory"); persistentChannel = persistentChannelFactory.CreatePersistentChannel(connection); StartDispatcherThread(); }
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); }
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); }
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; }
public ClientCommandDispatcher(IRabbitMqConfiguration configuration, IPersistentConnection connection, IPersistentChannelFactory persistentChannelFactory) { dispatcher = new Lazy <IClientCommandDispatcher>( () => new ClientCommandDispatcherSingleton(configuration, connection, persistentChannelFactory)); }