예제 #1
0
        public void ConnectTo(UntypedChannel channel)
        {
            UntypedChannel result = Visit(channel);

            if (!_added)
                throw new InvalidOperationException("The binding operation failed");
        }
        public List<IDisposable> CreateFileSystemEventProducers(string directory, bool usePolling, bool useFileSystemWatcher, UntypedChannel eventChannel, TimeSpan pollingInterval)
        {
            if (string.IsNullOrEmpty(directory))
            {
                throw new ArgumentException("Directory must not be null or empty.", "directory");
            }

            if (eventChannel != null)
            {
                throw new ArgumentException("A channel must be provided.", "eventChannel");
            }

            List<IDisposable> producers = new List<IDisposable>();

            FiberFactory fiberFactory = () => new SynchronousFiber();

            if (usePolling)
            {

                Scheduler scheduler = new TimerScheduler(fiberFactory());
                IDisposable poller = new PollingFileSystemEventProducer(directory, eventChannel,
                                                                        scheduler, fiberFactory(), pollingInterval);
                producers.Add(poller);
            }

            if (useFileSystemWatcher)
            {
                IDisposable watcher = new FileSystemEventProducer(directory, eventChannel);
            }

            return producers;
        }
        /// <summary>
        /// Creates a PollingFileSystemEventProducer
        /// </summary>		
        /// <param name="directory">The directory to watch</param>
        /// <param name="channel">The channel where events should be sent</param>
        /// <param name="scheduler">Event scheduler</param>
        /// <param name="fiber">Fiber to schedule on</param>
        /// <param name="checkInterval">The maximal time between events or polls on a given file</param>
        /// <param name="checkSubDirectory">Indicates if subdirectorys will be checked or ignored</param>
        public PollingFileSystemEventProducer(string directory, UntypedChannel channel, [NotNull] Scheduler scheduler, Fiber fiber,
            TimeSpan checkInterval, bool checkSubDirectory)
        {
            if (scheduler == null)
                throw new ArgumentNullException("scheduler");

            _directory = directory;
            _channel = channel;
            _fiber = fiber;
            _hashes = new Dictionary<string, Guid>();
            _scheduler = scheduler;
            _checkInterval = checkInterval;

            _scheduledAction = scheduler.Schedule(3.Seconds(), _fiber, HashFileSystem);

            var myChannel = new ChannelAdapter();

            _connection = myChannel.Connect(connectionConfigurator =>
                {
                    connectionConfigurator.AddConsumerOf<FileSystemChanged>().UsingConsumer(HandleFileSystemChangedAndCreated);
                    connectionConfigurator.AddConsumerOf<FileSystemCreated>().UsingConsumer(HandleFileSystemChangedAndCreated);
                    connectionConfigurator.AddConsumerOf<FileSystemRenamed>().UsingConsumer(HandleFileSystemRenamed);
                    connectionConfigurator.AddConsumerOf<FileSystemDeleted>().UsingConsumer(HandleFileSystemDeleted);
                });

            _fileSystemEventProducer = new FileSystemEventProducer(directory, myChannel, checkSubDirectory);
        }
예제 #4
0
		public void Run()
		{
			Stopwatch timer = Stopwatch.StartNew();

			const int channelCount = 10000;
			const int seedCount = 500;

			var channels = new UntypedChannel[channelCount];
			var connections = new ChannelConnection[channelCount];

			var complete = new Future<int>();

			var latch = new CountdownLatch(channelCount*seedCount, complete.Complete);

			for (int i = 0; i < channelCount; i++)
			{
				int channelNumber = i;
				channels[i] = new ChannelAdapter();
				connections[i] = channels[i].Connect(x =>
					{
						x.AddConsumerOf<AMessage>()
							.UsingConsumer(message =>
								{
									if (channelNumber < channels.Length - 1)
										channels[channelNumber + 1].Send(message);

									latch.CountDown();
								});
					});
			}

			var body = new AMessage();

			for (int i = 0; i < seedCount; i++)
			{
				channels[i].Send(body);

				for (int j = 0; j < i; j++)
					latch.CountDown();
			}

			bool completed = complete.WaitUntilCompleted(2.Minutes());

			timer.Stop();

			connections.Each(x => x.Dispose());
			

			if (!completed)
			{
				Console.WriteLine("Process did not complete");
				return;
			}

			Console.WriteLine("Processed {0} messages in with {1} channels in {2}ms", seedCount, channelCount,
			                  timer.ElapsedMilliseconds);

			Console.WriteLine("That's {0} messages per second!", ((long)seedCount*channelCount*1000)/timer.ElapsedMilliseconds);
		}
예제 #5
0
 public LogMessageLogger(string source, UntypedChannel output)
 {
     _debug = new LogMessageFormatter<DebugLogMessage>(output, (s, e) => new DebugLogMessageImpl(source, s, e));
     _info = new LogMessageFormatter<InfoLogMessage>(output, (s, e) => new InfoLogMessageImpl(source, s, e));
     _warn = new LogMessageFormatter<WarnLogMessage>(output, (s, e) => new WarnLogMessageImpl(source, s, e));
     _error = new LogMessageFormatter<ErrorLogMessage>(output, (s, e) => new ErrorLogMessageImpl(source, s, e));
     _fatal = new LogMessageFormatter<FatalLogMessage>(output, (s, e) => new FatalLogMessageImpl(source, s, e));
 }
예제 #6
0
 public HostHost(UntypedChannel inputChannel, Uri address, string endpoint)
 {
     _input = inputChannel;
     _inputConnection = _input.Connect(x =>
         {
             x.ReceiveFromWcfChannel(address, endpoint)
                 .HandleOnCallingThread();
         });
 }
		public ServiceBusReceiveContext(IServiceBus bus, UntypedChannel eventChannel, TimeSpan receiveTimeout)
		{
			_bus = bus;
			_eventChannel = eventChannel;
			_receiveTimeout = receiveTimeout;
			_receiveTime = new Stopwatch();
			_consumeTime = new Stopwatch();
			_consumeCount = 0;
		}
예제 #8
0
파일: Auction.cs 프로젝트: Nangal/Stact
		public Auction(Inbox inbox, Fiber fiber, Scheduler scheduler)
		{
			_currentBid = 1.00m;

			scheduler.Schedule(60000, fiber, () =>
			{
				inbox.Send(new EndAuction());
			});

			inbox.Loop(loop =>
			{
				loop.Receive<Request<AuctionStatus>>(request =>
				{
					request.Respond(new AuctionStatusImpl
					{
						CurrentBid = _currentBid,
						IsOpen = _open,
					});
				});

				loop.Receive<Request<PlaceBid>>(request =>
				{
					if (request.Body.MaximumBid <= _currentBid)
					{
						request.Respond(new OutBidImpl
						{
							CurrentBid = _currentBid
						});
					}
					else
					{
						_currentBid = request.Body.MaximumBid;
						request.Respond(new BidAcceptedImpl
						{
							CurrentBid = _currentBid
						});
						if (_highBidder != null)
						{
							_highBidder.Send(new OutBidImpl
							{
								CurrentBid = _currentBid
							});
						}
						_highBidder = request.ResponseChannel;
					}

					loop.Continue();
				});

				loop.Receive<EndAuction>(msg =>
				{
					_open = false;
//					_highBidder.Send(new YouWin());
				});
			});
		}
        public InProcessKlingerScheduleServer(EnvironmentValidatorRepository repository, TimeSpan schedulerDelay,
                                              TimeSpan schedulerInterval)
        {
            EventChannel = new ChannelAdapter();

            _fiber = new PoolFiber();
            _scheduler = new TimerScheduler(_fiber);
            _repository = repository;
            _schedulerDelay = schedulerDelay;
            _schedulerInterval = schedulerInterval;
        }
예제 #10
0
		public void Sending_a_message_to_a_channel()
		{
			_received = new Future<Simple>();

			_channel = new ChannelAdapter();
			_channel.Connect(x =>
				{
					x.AddConsumerOf<Simple>()
						.UsingConsumer(_received.Complete)
						.HandleOnCallingThread();
				});
		}
예제 #11
0
		public WcfChannelHost(Fiber fiber, UntypedChannel output, Uri serviceUri, string pipeName)
		{
			_serviceUri = serviceUri;

			var channel = new DeserializeMessageEnvelopeChannel<WcfMessageEnvelope>(fiber, new FastTextSerializer(), output);

			_service = new WcfChannelService<WcfMessageEnvelope>(channel);

			_serviceHost = new ConfigurationFreeServiceHost(_service, _serviceUri);
			_serviceHost.AddServiceEndpoint(typeof(WcfChannel<WcfMessageEnvelope>), new NetNamedPipeBinding(), pipeName);
			_serviceHost.Open();
		}
예제 #12
0
        /// <summary>
        /// Examines the channel network and identifies any audit event consumers and connects
        /// the appropriate event listeners to the NHibernate configuration so that events are
        /// sent from NHibernate to the channel network
        /// </summary>
        /// <param name="cfg">The NHibernate configuration being modified</param>
        /// <param name="channel">The channel containing the audit event listeners</param>
        public static void AddAuditEventListeners(this Configuration cfg, UntypedChannel channel)
        {
            var configurators = new EventListenerConfigurator[]
                {
                    new PreInsertEventConfigurator(),
                    new PostInsertEventConfigurator(),
                    new PreUpdateEventConfigurator(),
                    new PostUpdateEventConfigurator(),
                };

            var visitor = new AuditEventConsumerChannelVisitor(configurators);
            visitor.Configure(channel);

            configurators.Each(x => x.ApplyTo(cfg, channel));
        }
예제 #13
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }
            if (disposing)
            {
                if (_consumerPool != null)
                {
                    _consumerPool.Stop();
                    _consumerPool.Dispose();
                    _consumerPool = null;
                }

                if (_serviceContainer != null)
                {
                    _serviceContainer.Stop();
                    _serviceContainer.Dispose();
                    _serviceContainer = null;
                }

                if (ControlBus != this)
                {
                    ControlBus.Dispose();
                }

                if (_performanceCounterConnection != null)
                {
                    _performanceCounterConnection.Dispose();
                    _performanceCounterConnection = null;
                }

                _eventChannel = null;

                Endpoint = null;

                if (_counters != null)
                {
                    _counters.Dispose();
                    _counters = null;
                }

                EndpointCache.Dispose();
            }
            _disposed = true;
        }
예제 #14
0
        /// <summary>
        /// Creates a FileSystemEventProducer
        /// </summary>
        /// <param name="directory">The directory to watch</param>
        /// <param name="channel">The channel where events should be sent</param>
        /// <param name="checkSubDirectory">Indicates if subdirectories will be included</param>
        public FileSystemEventProducer(string directory, UntypedChannel channel, bool checkSubDirectory)
        {
            _directory = directory;
            _channel = channel;

            _watcher = new FileSystemWatcher(_directory)
            {
                EnableRaisingEvents = true,
                IncludeSubdirectories = checkSubDirectory,
                InternalBufferSize = 8 * 4 * 1024, // 8x the default size
            };

            _watcher.Changed += OnChanged;
            _watcher.Created += OnCreated;
            _watcher.Deleted += OnDeleted;
            _watcher.Renamed += OnRenamed;
        }
예제 #15
0
        /// <summary>
        /// Creates a FileSystemEventProducer
        /// </summary>
        /// <param name="directory">The directory to watch</param>
        /// <param name="channel">The channel where events should be sent</param>
        /// <param name="checkSubDirectory">Indicates if subdirectories will be included</param>
        public FileSystemEventProducer(string directory, UntypedChannel channel, bool checkSubDirectory)
        {
            _directory = directory;
            _channel   = channel;

            _watcher = new FileSystemWatcher(_directory)
            {
                EnableRaisingEvents   = true,
                IncludeSubdirectories = checkSubDirectory,
                InternalBufferSize    = 8 * 4 * 1024,                      // 8x the default size
            };

            _watcher.Changed += OnChanged;
            _watcher.Created += OnCreated;
            _watcher.Deleted += OnDeleted;
            _watcher.Renamed += OnRenamed;
        }
예제 #16
0
        public static Request <TRequest> Request <TRequest>(this Channel <Request <TRequest> > channel, object values,
                                                            UntypedChannel responseChannel)
            where TRequest : class
        {
            if (!typeof(TRequest).IsInterface)
            {
                throw new ArgumentException("Default Implementations can only be created for interfaces");
            }

            var request = InterfaceImplementationExtensions.InitializeProxy <TRequest>(values);

            var requestImpl = new RequestImpl <TRequest>(responseChannel, request);

            channel.Send(requestImpl);

            return(requestImpl);
        }
예제 #17
0
        public void ChangeOutputChannel(Func <UntypedChannel, UntypedChannel> mutator)
        {
            for (;;)
            {
                UntypedChannel originalValue = _output;

                UntypedChannel changedValue = mutator(originalValue);

                UntypedChannel previousValue = Interlocked.CompareExchange(ref _output, changedValue, originalValue);

                // if the value returned is equal to the original value, we made the change
                if (previousValue == originalValue)
                {
                    return;
                }
            }
        }
예제 #18
0
        /// <summary>
        ///   Sends an uninitialized interface implementation as a request
        /// </summary>
        /// <typeparam name = "TRequest">The request message type, which must be an interface</typeparam>
        /// <param name = "channel">The target channel</param>
        /// <param name = "responseChannel">The channel where responses should be sent</param>
        public static Request <TRequest> Request <TRequest>(this UntypedChannel channel,
                                                            UntypedChannel responseChannel)
        {
            if (!typeof(TRequest).IsInterface)
            {
                throw new ArgumentException("Default Implementations can only be created for interfaces");
            }

            Type requestImplType = InterfaceImplementationBuilder.GetProxyFor(typeof(TRequest));

            var request = (TRequest)FastActivator.Create(requestImplType);

            var requestImpl = new RequestImpl <TRequest>(responseChannel, request);

            channel.Send <Request <TRequest> >(requestImpl);

            return(requestImpl);
        }
예제 #19
0
        public static bool SendRequestWaitForResponse <TRequest>(this UntypedChannel channel, TimeSpan timeout)
        {
            using (var reset = new ManualResetEvent(false))
            {
                var responseChannel = new ChannelAdapter();
                using (responseChannel.Connect(x =>
                {
                    x.AddConsumerOf <Response <TRequest> >()
                    .UsingConsumer(m => reset.Set())
                    .HandleOnCallingThread();
                }))
                {
                    channel.Request <TRequest>(responseChannel);

                    return(reset.WaitOne(timeout, true));
                }
            }
        }
예제 #20
0
        protected override UntypedChannel Visitor(ChannelAdapter channel)
        {
            channel.ChangeOutputChannel(output =>
            {
                UntypedChannel replacement = Visit(output);

                if (_channels.Contains(output))
                {
                    replacement = null;

                    _channels.Remove(output);
                }

                return(replacement ?? new ShuntChannel());
            });

            return(channel);
        }
예제 #21
0
        public ActorInbox(Fiber fiber, Scheduler scheduler)
        {
            _fiber     = fiber;
            _scheduler = scheduler;

            _adapter            = new ChannelAdapter();
            _internalConnection = _adapter.Connect(x =>
            {
                x.AddConsumerOf <Exit>()
                .UsingConsumer(HandleExit)
                .HandleOnFiber(_fiber);
                x.AddConsumerOf <Kill>()
                .UsingConsumer(HandleKill)
                .HandleOnCallingThread();
            });

            _inboxCache = new Cache <Type, object>();
        }
예제 #22
0
		void CreateLocalNode(Uri uri, UntypedChannel input)
		{
			string key = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);

			ChunkWriter chunkWriter = GetWriter(uri);

			_localNode = new RemoteNode(input, chunkWriter, _fiberFactory, _scheduler, _serializer);

			try
			{
				GetReader(uri, _localNode);
			}
			catch
			{
				_localNode.Dispose();
				throw;
			}

			_nodes.Add(key, _localNode);
		}
예제 #23
0
        void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }
            if (disposing)
            {
                if (_channelConnection != null)
                {
                    _log.DebugFormat("[Topshelf] Closing coordinator channel");
                    _channelConnection.Dispose();
                    _channelConnection = null;
                }

                _channel = null;
            }

            _disposed = true;
        }
예제 #24
0
        void CreateLocalNode(Uri uri, UntypedChannel input)
        {
            string key = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);

            ChunkWriter chunkWriter = GetWriter(uri);

            _localNode = new RemoteNode(input, chunkWriter, _fiberFactory, _scheduler, _serializer);

            try
            {
                GetReader(uri, _localNode);
            }
            catch
            {
                _localNode.Dispose();
                throw;
            }

            _nodes.Add(key, _localNode);
        }
예제 #25
0
        /// <summary>
        /// Creates an instance of the ServiceBus, which implements IServiceBus. This is normally
        /// not called and should be created using the ServiceBusConfigurator to ensure proper defaults
        /// and operation.
        /// </summary>
        public ServiceBus(IEndpoint endpointToListenOn,
                          IEndpointCache endpointCache)
        {
            ReceiveTimeout = TimeSpan.FromSeconds(3);
            Guard.AgainstNull(endpointToListenOn, "endpointToListenOn", "This parameter cannot be null");
            Guard.AgainstNull(endpointCache, "endpointFactory", "This parameter cannot be null");

            Endpoint      = endpointToListenOn;
            EndpointCache = endpointCache;

            _eventChannel = new ChannelAdapter();

            _serviceContainer = new ServiceContainer(this);

            OutboundPipeline = new OutboundPipelineConfigurator(this).Pipeline;
            InboundPipeline  = InboundPipelineConfigurator.CreateDefault(this);

            ControlBus = this;

            InitializePerformanceCounters();
        }
        public void ApplyTo(Configuration cfg, UntypedChannel channel)
        {
            if (_types.Count == 0)
            {
                return;
            }

            PropertyInfo propertyInfo = _listenerAccessor.GetMemberPropertyInfo();
            var          property     = new FastProperty <EventListeners, TListener[]>(propertyInfo);

            TListener listener = _listenerFactory(channel, _types);

            TListener[] existing = property.Get(cfg.EventListeners);
            if (existing == null || existing.Length == 0)
            {
                property.Set(cfg.EventListeners, new[] { listener });
            }
            else
            {
                property.Set(cfg.EventListeners, existing.Concat(Enumerable.Repeat(listener, 1)).ToArray());
            }
        }
예제 #27
0
        protected override UntypedChannel Visitor(BroadcastChannel channel)
        {
            var  results = new List <UntypedChannel>();
            bool changed = false;

            foreach (UntypedChannel subscriber in channel.Listeners)
            {
                UntypedChannel newSubscriber = Visit(subscriber);

                if (_channels.Contains(newSubscriber))
                {
                    _channels.Remove(newSubscriber);
                    newSubscriber = null;
                }

                if (newSubscriber == null || newSubscriber != subscriber)
                {
                    changed = true;
                    if (newSubscriber == null)
                    {
                        continue;
                    }
                }

                results.Add(newSubscriber);
            }

            if (results.Count == 0)
            {
                return(null);
            }

            if (changed)
            {
                return(new BroadcastChannel(results));
            }

            return(channel);
        }
예제 #28
0
        void CreateCoordinatorChannel()
        {
            if (_channel != null)
            {
                return;
            }

            _channel           = new ChannelAdapter();
            _channelConnection = _channel.Connect(x =>
            {
                x.AddConsumerOf <ServiceEvent>()
                .UsingConsumer(OnServiceEvent)
                .HandleOnFiber(_fiber);

                x.AddConsumerOf <ServiceFault>()
                .UsingConsumer(OnServiceFault)
                .HandleOnFiber(_fiber);

                x.AddConsumerOf <ServiceStopped>()
                .UsingConsumer(OnServiceStopped)
                .HandleOnFiber(_fiber);

                x.AddConsumerOf <CreateShelfService>()
                .UsingConsumer(OnCreateShelfService)
                .HandleOnFiber(_fiber);

                x.AddConsumerOf <ServiceFolderChanged>()
                .UsingConsumer(OnServiceFolderChanged)
                .HandleOnFiber(_fiber);

                x.AddConsumerOf <ServiceFolderRemoved>()
                .UsingConsumer(OnServiceFolderRemoved)
                .HandleOnFiber(_fiber);

                x.AddConsumerOf <Request <ServiceStatus> >()
                .UsingConsumer(Status)
                .HandleOnFiber(_fiber);
            });
        }
예제 #29
0
        protected override UntypedChannel Visitor(ChannelAdapter channel)
        {
            UntypedChannel original = channel.Output;

            UntypedChannel replacement = Visit(original);

            if (!_added)
            {
                if (replacement.GetType() == typeof(ShuntChannel))
                {
                    replacement = new BroadcastChannel(new[] { _newChannel });
                    _added      = true;
                }
            }

            if (original != replacement)
            {
                channel.ChangeOutputChannel(original, replacement);
            }

            return(channel);
        }
예제 #30
0
        public HostChannel([NotNull] UntypedChannel output,
                           [NotNull] Uri address,
                           [NotNull] string pipeName)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }
            if (pipeName == null)
            {
                throw new ArgumentNullException("pipeName");
            }

            _output   = output;
            _address  = address;
            _pipeName = pipeName;

            _host = new WcfChannelHost(new SynchronousFiber(), output, address, pipeName);
        }
예제 #31
0
        protected override UntypedChannel Visitor(ChannelAdapter channel)
        {
            UntypedChannel original = channel.Output;

            UntypedChannel replacement = Visit(original);

            if (_channels.Contains(replacement))
            {
                _channels.Remove(replacement);
                replacement = null;
            }

            if (replacement == null)
            {
                replacement = new ShuntChannel();
            }

            if (replacement != original)
            {
                channel.ChangeOutputChannel(original, replacement);
            }

            return(channel);
        }
예제 #32
0
        protected override UntypedChannel Visitor(ChannelAdapter channel)
        {
            bool wasAdded = _added;

            channel.ChangeOutputChannel(original =>
            {
                _added = wasAdded;

                UntypedChannel replacement = Visit(original);

                if (!_added)
                {
                    if (replacement.GetType() == typeof(ShuntChannel))
                    {
                        replacement = new BroadcastChannel(new[] { _newChannel });
                        _added      = true;
                    }
                }

                return(replacement);
            });

            return(channel);
        }
예제 #33
0
        /// <summary>
        /// Creates a PollingFileSystemEventProducer
        /// </summary>
        /// <param name="directory">The directory to watch</param>
        /// <param name="channel">The channel where events should be sent</param>
        /// <param name="scheduler">Event scheduler</param>
        /// <param name="fiber">Fiber to schedule on</param>
        /// <param name="checkInterval">The maximal time between events or polls on a given file</param>
        /// <param name="checkSubDirectory">Indicates if subdirectorys will be checked or ignored</param>
        public PollingFileSystemEventProducer(string directory, UntypedChannel channel, Scheduler scheduler, Fiber fiber,
                                              TimeSpan checkInterval, bool checkSubDirectory)
        {
            _directory     = directory;
            _channel       = channel;
            _fiber         = fiber;
            _hashes        = new Dictionary <string, Guid>();
            _scheduler     = scheduler;
            _checkInterval = checkInterval;

            _scheduledAction = scheduler.Schedule(3.Seconds(), _fiber, HashFileSystem);

            ChannelAdapter myChannel = new ChannelAdapter();

            _connection = myChannel.Connect(connectionConfigurator =>
            {
                connectionConfigurator.AddConsumerOf <FileSystemChanged>().UsingConsumer(HandleFileSystemChangedAndCreated);
                connectionConfigurator.AddConsumerOf <FileSystemCreated>().UsingConsumer(HandleFileSystemChangedAndCreated);
                connectionConfigurator.AddConsumerOf <FileSystemRenamed>().UsingConsumer(HandleFileSystemRenamed);
                connectionConfigurator.AddConsumerOf <FileSystemDeleted>().UsingConsumer(HandleFileSystemDeleted);
            });

            _fileSystemEventProducer = new FileSystemEventProducer(directory, myChannel, checkSubDirectory);
        }
예제 #34
0
 public ChannelAdapter(UntypedChannel output)
 {
     _output = output;
 }
예제 #35
0
		static void DisconnectChannels(UntypedChannel channel, IEnumerable<Channel> channels)
		{
			new DisconnectChannelVisitor(channels).DisconnectFrom(channel);
		}
예제 #36
0
		public UntypedChannelConnection(UntypedChannel channel)
			: base(x => DisconnectChannels(channel, x))
		{
		}
예제 #37
0
		public UntypedConnectionConfigurator(UntypedChannel channel)
		{
			_channel = channel;
			_configurators = new List<ConnectionBuilderConfigurator>();
		}
예제 #38
0
		public ThreadPoolConsumerPool(IServiceBus bus, UntypedChannel eventChannel, TimeSpan receiveTimeout)
		{
			_receiveTimeout = receiveTimeout;
			_bus = bus;
			_eventChannel = eventChannel;
		}
예제 #39
0
        public ChannelConfiguratorImpl(UntypedChannel channel)
        {
            Guard.AgainstNull(channel);

            _channel = channel;
        }
예제 #40
0
		public SocketServer(Uri uri, Fiber fiber, UntypedChannel eventChannel)
			: base(uri, fiber, eventChannel)
		{
		}
예제 #41
0
        public static void Respond <TResponse>(this UntypedChannel channel, TResponse response, string requestId)
        {
            var responseImpl = new ResponseImpl <TResponse>(response, requestId);

            channel.Send <Response <TResponse> >(responseImpl);
        }
예제 #42
0
		public void Two_channels()
		{
			_client = new ChannelAdapter();
			_server = new ChannelAdapter();
		}
 public List<IDisposable> CreateFileSystemEventProducers(string directory, bool usePolling, bool useFileSystemWatcher, UntypedChannel eventChannel)
 {
     return CreateFileSystemEventProducers(directory, usePolling, useFileSystemWatcher, eventChannel, 2.Minutes());
 }
예제 #44
0
 public ConnectChannelVisitor(UntypedChannel newChannel)
 {
     _newChannel = newChannel;
 }
 /// <summary>
 /// Creates a PollingFileSystemEventProducer
 /// </summary>		
 /// <param name="directory">The directory to watch</param>
 /// <param name="channel">The channel where events should be sent</param>
 /// <param name="scheduler">Event scheduler</param>
 /// <param name="fiber">Fiber to schedule on</param>
 /// <param name="checkInterval">The maximal time between events or polls on a given file</param>
 public PollingFileSystemEventProducer(string directory, UntypedChannel channel, Scheduler scheduler, Fiber fiber,
     TimeSpan checkInterval)
     : this(directory, channel, scheduler, fiber, checkInterval, true)
 {
 }
예제 #46
0
 public DirectoryMonitor(string directory)
 {
     _baseDir = directory;
     _hostChannel = WellknownAddresses.GetHostChannelProxy();
 }
예제 #47
0
 public static HostHost GetShelfMakerHost(UntypedChannel hostProxy)
 {
     return new HostHost(hostProxy, GetBaseAddress(GetShelfMakerPipeName()), ShelfMakerEndpoint);
 }
예제 #48
0
 /// <summary>
 ///   Sends an Exit message to an actor instance without waiting for a response
 /// </summary>
 /// <param name = "instance">The actor instance</param>
 public static void Exit(this UntypedChannel instance)
 {
     instance.Send <Exit>();
 }
예제 #49
0
 public static HostHost GetServiceCoordinatorHost(UntypedChannel hostProxy)
 {
     return new HostHost(hostProxy, GetBaseAddress(GetServiceControllerPipeName()), ServiceCoordinatorEndpoint);
 }
예제 #50
0
 /// <summary>
 ///   Sends a Kill message to an actor instance
 /// </summary>
 /// <param name = "instance">The actor instance</param>
 public static void Kill(this UntypedChannel instance)
 {
     instance.Send <Kill>();
 }
예제 #51
0
 public static IEnumerable <Channel> Flatten(this UntypedChannel channel)
 {
     return(new FlattenChannelVisitor().Flatten(channel));
 }
예제 #52
0
        protected virtual UntypedChannel Visitor(UntypedChannel channel)
        {
            _log.Warn(x => x.Write("Unknown untyped channel implementation found: {0}", channel.GetType().FullName));

            return(channel);
        }
예제 #53
0
 public UntypedFilterChannel(UntypedChannel output, SelectiveConsumer <TOutput> filter)
 {
     _output = output;
     _filter = filter;
 }
예제 #54
0
        public virtual UntypedChannel Visit(UntypedChannel channel)
        {
            UntypedChannel result = this.FastInvoke <ChannelVisitor, UntypedChannel>("Visitor", channel);

            return(result);
        }
예제 #55
0
 public static void Stop(this UntypedChannel instance)
 {
     instance.Send <Stop>();
 }
예제 #56
0
 /// <summary>
 /// Creates a FileSystemEventProducer
 /// </summary>
 /// <param name="directory">The directory to watch</param>
 /// <param name="channel">The channel where events should be sent</param>
 public FileSystemEventProducer(string directory, UntypedChannel channel)
     : this(directory, channel, true)
 {
 }
예제 #57
0
 public ThreadPoolConsumerPool(IServiceBus bus, UntypedChannel eventChannel, TimeSpan receiveTimeout)
 {
     _receiveTimeout = receiveTimeout;
     _bus            = bus;
     _eventChannel   = eventChannel;
 }
예제 #58
0
 public static WcfChannelHost GetServiceCoordinatorHost(UntypedChannel hostProxy)
 {
     return new WcfChannelHost(new SynchronousFiber(), hostProxy, GetBaseAddress(GetServiceControllerPipeName()), ServiceCoordinatorEndpoint);
 }
예제 #59
0
        public override UntypedChannel Visit(UntypedChannel channel)
        {
            _channels.Add(channel);

            return(base.Visit(channel));
        }
예제 #60
0
 public static WcfChannelHost GetShelfMakerHost(UntypedChannel hostProxy)
 {
     return new WcfChannelHost(new SynchronousFiber(), hostProxy, GetBaseAddress(GetShelfMakerPipeName()), ShelfMakerEndpoint);
 }