예제 #1
0
        void ConfigureRegistrar(IListenerFactory factory, IListenerFactoryProcessor processor)
        {
            var r = new ListenerRegistrar(processor, factory);
            r.Add(new ReflectionListenerRegistrar());

            _registrar = r;
        }
예제 #2
0
        public async Task <IListener> CreateAsync(CancellationToken cancellationToken)
        {
            List <IListener> listeners = new List <IListener>();

            foreach (IFunctionDefinition functionDefinition in _functionDefinitions)
            {
                IListenerFactory listenerFactory = functionDefinition.ListenerFactory;
                if (listenerFactory == null)
                {
                    continue;
                }

                // Determine if the function is disabled
                MethodInfo method = functionDefinition.Descriptor.Method;
                if (IsDisabled(method, _nameResolver, _activator))
                {
                    _trace.Info(string.Format("Function '{0}' is disabled", functionDefinition.Descriptor.ShortName), TraceSource.Host);
                    continue;
                }

                IListener listener = await listenerFactory.CreateAsync(cancellationToken);

                // if the listener is a Singleton, wrap it with our SingletonListener
                SingletonAttribute singletonAttribute = SingletonManager.GetListenerSingletonOrNull(listener.GetType(), method);
                if (singletonAttribute != null)
                {
                    listener = new SingletonListener(method, singletonAttribute, _singletonManager, listener);
                }

                listeners.Add(listener);
            }

            return(new CompositeListener(listeners));
        }
예제 #3
0
 public AbortListenerFunctionExecutor(IListenerFactory abortListenerFactory, IFunctionExecutor abortExecutor,
                                      IFunctionExecutor innerExecutor)
 {
     _abortListenerFactory = abortListenerFactory;
     _abortExecutor        = abortExecutor;
     _innerExecutor        = innerExecutor;
 }
        /// <summary>
        /// 启动监听
        /// </summary>
        /// <returns></returns>
        private Task <bool> StartListenAsync()
        {
            _listeners = new List <IListener>();
            var serverOptions = _serverOptions.Value;

            foreach (ListenOptions listenOptions in serverOptions.Listeners)
            {
                IListenerFactory _listenerFactory = _listenerFactorys[0];
                if (listenOptions.ProtocolType == Baize.IPlugin.SuperSocket.ProtocolType.UDP)
                {
                    _listenerFactory = _listenerFactorys[1];
                }
                var listener = _listenerFactory.CreateListener(_appSessions, listenOptions, _loggerFactory);
                listener.NewClientAccepted += OnNewClientAccept;
                if (listener is UdpSocketListener)
                {
                    UdpSocketListener udpSocketListener = (UdpSocketListener)listener;
                    udpSocketListener.UDPData += Listener_UDPDataHandler;
                }
                if (!listener.Start())
                {
                    _logger.LogError($"Failed to listen {listener}.");
                }
                _listeners.Add(listener);
            }
            return(Task.FromResult(true));
        }
예제 #5
0
        protected internal virtual IBaseTaskListener CreateTaskListener(ActivitiListener activitiListener)
        {
            IBaseTaskListener taskListener = null;

            IListenerFactory listenerFactory = Context.ProcessEngineConfiguration.ListenerFactory;

            if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
            {
                taskListener = listenerFactory.CreateClassDelegateTaskListener(activitiListener);
            }
            else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
            {
                taskListener = listenerFactory.CreateExpressionTaskListener(activitiListener);
            }
            else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
            {
                if (activitiListener.OnTransaction is object)
                {
                    taskListener = listenerFactory.CreateTransactionDependentDelegateExpressionTaskListener(activitiListener);
                }
                else
                {
                    taskListener = listenerFactory.CreateDelegateExpressionTaskListener(activitiListener);
                }
            }
            else if (ImplementationType.IMPLEMENTATION_TYPE_INSTANCE.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
            {
                taskListener = (ITaskListener)activitiListener.Instance;
            }
            return(taskListener);
        }
예제 #6
0
        public async Task <IListener> CreateAsync(CancellationToken cancellationToken)
        {
            List <IListener> listeners = new List <IListener>();

            foreach (IFunctionDefinition functionDefinition in _functionDefinitions)
            {
                IListenerFactory listenerFactory = functionDefinition.ListenerFactory;

                if (listenerFactory == null)
                {
                    continue;
                }

                IListener listener = await listenerFactory.CreateAsync(cancellationToken);

                // if the listener is a Singleton, wrap it with our SingletonListener
                SingletonAttribute singletonAttribute = listener.GetType().GetCustomAttribute <SingletonAttribute>();
                if (singletonAttribute != null)
                {
                    if (!string.IsNullOrEmpty(singletonAttribute.Scope))
                    {
                        throw new InvalidOperationException("SingletonAttribute.Scope values are not supported for singleton listeners.");
                    }
                    listener = new SingletonListener(functionDefinition.Descriptor.Method, singletonAttribute, _singletonManager, listener);
                }

                listeners.Add(listener);
            }

            return(new CompositeListener(listeners));
        }
        internal static IListener CreateHostListener(IListenerFactory allFunctionsListenerFactory, SharedQueueHandler sharedQueue,
                                                     IRecurrentCommand heartbeatCommand, IWebJobsExceptionHandler exceptionHandler, CancellationToken shutdownToken)
        {
            IListener factoryListener   = new ListenerFactoryListener(allFunctionsListenerFactory, sharedQueue);
            IListener heartbeatListener = new HeartbeatListener(heartbeatCommand, exceptionHandler, factoryListener);
            IListener shutdownListener  = new ShutdownListener(shutdownToken, heartbeatListener);

            return(shutdownListener);
        }
예제 #8
0
        public virtual void ExecuteExecutionListeners(IHasExecutionListeners elementWithExecutionListeners, IExecutionEntity execution, string eventType)
        {
            IList <ActivitiListener> listeners = elementWithExecutionListeners.ExecutionListeners;

            if (listeners != null && listeners.Count > 0)
            {
                IListenerFactory listenerFactory = Context.ProcessEngineConfiguration.ListenerFactory;
                foreach (ActivitiListener activitiListener in listeners)
                {
                    if (eventType.Equals(activitiListener.Event))
                    {
                        IBaseExecutionListener executionListener = null;

                        if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
                        {
                            executionListener = listenerFactory.CreateClassDelegateExecutionListener(activitiListener);
                        }
                        else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
                        {
                            executionListener = listenerFactory.CreateExpressionExecutionListener(activitiListener);
                        }
                        else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
                        {
                            if (activitiListener.OnTransaction is object)
                            {
                                executionListener = listenerFactory.CreateTransactionDependentDelegateExpressionExecutionListener(activitiListener);
                            }
                            else
                            {
                                executionListener = listenerFactory.CreateDelegateExpressionExecutionListener(activitiListener);
                            }
                        }
                        else if (ImplementationType.IMPLEMENTATION_TYPE_INSTANCE.Equals(activitiListener.ImplementationType, StringComparison.CurrentCultureIgnoreCase))
                        {
                            executionListener = (IExecutionListener)activitiListener.Instance;
                        }

                        if (executionListener != null)
                        {
                            if (activitiListener.OnTransaction is object)
                            {
                                PlanTransactionDependentExecutionListener(listenerFactory, execution, (ITransactionDependentExecutionListener)executionListener, activitiListener);
                            }
                            else
                            {
                                execution.EventName = eventType; // eventName is used to differentiate the event when reusing an execution listener for various events
                                execution.CurrentActivitiListener = activitiListener;
                                ((IExecutionListener)executionListener).Notify(execution);
                                execution.EventName = null;
                                execution.CurrentActivitiListener = null;
                            }
                        }
                    }
                }
            }
        }
예제 #9
0
        protected internal virtual void PlanTransactionDependentExecutionListener(IListenerFactory listenerFactory, IExecutionEntity execution, ITransactionDependentExecutionListener executionListener, ActivitiListener activitiListener)
        {
            IDictionary <string, object> executionVariablesToUse  = execution.Variables;
            ICustomPropertiesResolver    customPropertiesResolver = CreateCustomPropertiesResolver(activitiListener);
            IDictionary <string, object> customPropertiesMapToUse = InvokeCustomPropertiesResolver(execution, customPropertiesResolver);

            TransactionDependentExecutionListenerExecutionScope scope = new TransactionDependentExecutionListenerExecutionScope(execution.ProcessInstanceId, execution.Id, execution.CurrentFlowElement, executionVariablesToUse, customPropertiesMapToUse);

            AddTransactionListener(activitiListener, new ExecuteExecutionListenerTransactionListener(executionListener, scope));
        }
        private static IListener CreateHostListener(IListenerFactory allFunctionsListenerFactory,
                                                    IRecurrentCommand heartbeatCommand, IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                                    CancellationToken shutdownToken)
        {
            IListener factoryListener   = new ListenerFactoryListener(allFunctionsListenerFactory);
            IListener heartbeatListener = new HeartbeatListener(heartbeatCommand, backgroundExceptionDispatcher, factoryListener);
            IListener shutdownListener  = new ShutdownListener(shutdownToken, heartbeatListener);

            return(shutdownListener);
        }
예제 #11
0
 public SuperSocketService(IServiceProvider serviceProvider, IOptions <ServerOptions> serverOptions, ILoggerFactory loggerFactory, IListenerFactory listenerFactory, Func <IAppSession, TReceivePackageInfo, Task> packageHandler)
 {
     Name             = _serverOptions.Value.Name;
     _serviceProvider = serviceProvider;
     _serverOptions   = serverOptions;
     _loggerFactory   = loggerFactory;
     _logger          = _loggerFactory.CreateLogger("SuperSocketService");
     _listenerFactory = listenerFactory;
     _packageHandler  = packageHandler;
 }
예제 #12
0
        public bool Init(IFunctionIndex functions, IListenerFactory functionsListenerFactory, out IFunctionExecutor hostCallExecutor, out IListener listener, out HostOutputMessage hostOutputMessage, string hostId, CancellationToken shutdownToken)
        {
            hostCallExecutor = new ShutdownFunctionExecutor(shutdownToken, _functionExecutor);

            IListener factoryListener  = new ListenerFactoryListener(functionsListenerFactory, _sharedQueueHandler);
            IListener shutdownListener = new ShutdownListener(shutdownToken, factoryListener);

            listener          = shutdownListener;
            hostOutputMessage = new DataOnlyHostOutputMessage();
            return(false);
        }
        internal static IFunctionExecutor CreateHostCallExecutor(IListenerFactory instanceQueueListenerFactory,
                                                                 IRecurrentCommand heartbeatCommand, IWebJobsExceptionHandler exceptionHandler,
                                                                 CancellationToken shutdownToken, IFunctionExecutor innerExecutor)
        {
            IFunctionExecutor heartbeatExecutor = new HeartbeatFunctionExecutor(heartbeatCommand,
                                                                                exceptionHandler, innerExecutor);
            IFunctionExecutor abortListenerExecutor    = new AbortListenerFunctionExecutor(instanceQueueListenerFactory, heartbeatExecutor);
            IFunctionExecutor shutdownFunctionExecutor = new ShutdownFunctionExecutor(shutdownToken, abortListenerExecutor);

            return(shutdownFunctionExecutor);
        }
        private static IFunctionExecutor CreateHostCallExecutor(IListenerFactory instanceQueueListenerFactory,
                                                                IRecurrentCommand heartbeatCommand, IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
                                                                CancellationToken shutdownToken, IFunctionExecutor innerExecutor)
        {
            IFunctionExecutor heartbeatExecutor = new HeartbeatFunctionExecutor(heartbeatCommand,
                                                                                backgroundExceptionDispatcher, innerExecutor);
            IFunctionExecutor abortListenerExecutor    = new AbortListenerFunctionExecutor(instanceQueueListenerFactory, heartbeatExecutor);
            IFunctionExecutor shutdownFunctionExecutor = new ShutdownFunctionExecutor(shutdownToken, abortListenerExecutor);

            return(shutdownFunctionExecutor);
        }
예제 #15
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            _pipelineFilterFactory = _serviceProvider.GetRequiredService <IPipelineFilterFactory <TReceivePackageInfo> >();

            _listenerFactory = _serviceProvider.GetService <IListenerFactory>();

            if (_listenerFactory == null)
            {
                _listenerFactory = new TcpSocketListenerFactory();
            }

            await StartListenAsync();
        }
        public Task <IListener> CreateListenerAsync(ListenerFactoryContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            IListenerFactory factory = null;

            if (_queueName != null)
            {
                factory = new ServiceBusQueueListenerFactory(_account, _queueName, context.Executor, _config);
            }
            else
            {
                factory = new ServiceBusSubscriptionListenerFactory(_account, _topicName, _subscriptionName, context.Executor, _config);
            }
            return(factory.CreateAsync(context.CancellationToken));
        }
예제 #17
0
        protected internal virtual ICustomPropertiesResolver CreateCustomPropertiesResolver(ActivitiListener activitiListener)
        {
            ICustomPropertiesResolver customPropertiesResolver = null;
            IListenerFactory          listenerFactory          = Context.ProcessEngineConfiguration.ListenerFactory;

            if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.Equals(activitiListener.CustomPropertiesResolverImplementationType, StringComparison.CurrentCultureIgnoreCase))
            {
                customPropertiesResolver = listenerFactory.CreateClassDelegateCustomPropertiesResolver(activitiListener);
            }
            else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.Equals(activitiListener.CustomPropertiesResolverImplementationType, StringComparison.CurrentCultureIgnoreCase))
            {
                customPropertiesResolver = listenerFactory.CreateExpressionCustomPropertiesResolver(activitiListener);
            }
            else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.Equals(activitiListener.CustomPropertiesResolverImplementationType, StringComparison.CurrentCultureIgnoreCase))
            {
                customPropertiesResolver = listenerFactory.CreateDelegateExpressionCustomPropertiesResolver(activitiListener);
            }
            return(customPropertiesResolver);
        }
        public async Task <IListener> CreateAsync(IFunctionExecutor executor, CancellationToken cancellationToken)
        {
            List <IListener> listeners = new List <IListener>();

            foreach (IFunctionDefinition functionDefinition in _functionDefinitions)
            {
                IListenerFactory listenerFactory = functionDefinition.ListenerFactory;

                if (listenerFactory == null)
                {
                    continue;
                }

                IListener listener = await listenerFactory.CreateAsync(executor, cancellationToken);

                listeners.Add(listener);
            }

            return(new CompositeListener(listeners));
        }
        public async Task <IListener> CreateListenerAsync(ListenerFactoryContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            IListenerFactory factory = null;

            if (_queueName != null)
            {
                factory = new ServiceBusQueueListenerFactory(_account, _queueName, context.Executor, _options, _messagingProvider);
            }
            else
            {
                factory = new ServiceBusSubscriptionListenerFactory(_account, _topicName, _subscriptionName, context.Executor, _options, _messagingProvider);
            }
            _listener = (ServiceBusListener)(await factory.CreateAsync(context.CancellationToken));

            return(_listener);
        }
예제 #20
0
        public async Task <IListener> CreateAsync(CancellationToken cancellationToken)
        {
            List <IListener> listeners = new List <IListener>();

            foreach (IFunctionDefinition functionDefinition in _functionDefinitions)
            {
                // Determine if the function is disabled
                if (functionDefinition.Descriptor.IsDisabled)
                {
                    string msg = string.Format("Function '{0}' is disabled", functionDefinition.Descriptor.ShortName);
                    _trace.Info(msg, TraceSource.Host);
                    _logger?.LogInformation(msg);
                    continue;
                }

                IListenerFactory listenerFactory = functionDefinition.ListenerFactory;
                if (listenerFactory == null)
                {
                    continue;
                }

                IListener listener = await listenerFactory.CreateAsync(cancellationToken);

                // if the listener is a Singleton, wrap it with our SingletonListener
                SingletonAttribute singletonAttribute = SingletonManager.GetListenerSingletonOrNull(listener.GetType(), functionDefinition.Descriptor);
                if (singletonAttribute != null)
                {
                    listener = new SingletonListener(functionDefinition.Descriptor, singletonAttribute, _singletonManager, listener, _trace, _loggerFactory);
                }

                // wrap the listener with a function listener to handle exceptions
                listener = new FunctionListener(listener, functionDefinition.Descriptor, _trace, _loggerFactory);
                listeners.Add(listener);
            }

            return(new CompositeListener(listeners));
        }
예제 #21
0
 public SocketServer( IServerConfiguration configuration, IListenerFactory listenerFactory, IScheduler scheduler )
 {
     Configuration = configuration;
     Scheduler = scheduler;
     ListenerFactory = listenerFactory;
 }
 public AbortListenerFunctionExecutor(IListenerFactory abortListenerFactory, IFunctionExecutor innerExecutor)
 {
     _abortListenerFactory = abortListenerFactory;
     _innerExecutor = innerExecutor;
 }
예제 #23
0
 /// <summary>
 /// Constructor to be called by the <seealso cref="BpmnParser"/>.
 /// </summary>
 public BpmnParse(BpmnParser parser)
 {
     this.activityBehaviorFactory = parser.ActivityBehaviorFactory;
     this.listenerFactory         = parser.ListenerFactory;
     this.bpmnParserHandlers      = parser.BpmnParserHandlers;
 }
        public bool Setup(
            IFunctionIndex functions,
            IListenerFactory functionsListenerFactory,
            out IFunctionExecutor hostCallExecutor,
            out IListener listener,
            out HostOutputMessage hostOutputMessage,
            string hostId,
            CancellationToken shutdownToken)
        {
            string sharedQueueName = HostQueueNames.GetHostQueueName(hostId);
            var    sharedQueue     = sharedQueueName;

            IListenerFactory sharedQueueListenerFactory = new HostMessageListenerFactory(_storageServices, sharedQueue,
                                                                                         _exceptionHandler, _loggerFactory, functions,
                                                                                         _functionInstanceLogger, _functionExecutor);

            Guid             hostInstanceId               = Guid.NewGuid();
            string           instanceQueueName            = HostQueueNames.GetHostQueueName(hostInstanceId.ToString("N"));
            var              instanceQueue                = instanceQueueName;
            IListenerFactory instanceQueueListenerFactory = new HostMessageListenerFactory(_storageServices, instanceQueue,
                                                                                           _exceptionHandler, _loggerFactory, functions,
                                                                                           _functionInstanceLogger, _functionExecutor);

            HeartbeatDescriptor heartbeatDescriptor = new HeartbeatDescriptor
            {
                SharedContainerName = HostContainerNames.Hosts,
                SharedDirectoryName = HostDirectoryNames.Heartbeats + "/" + hostId,
                InstanceBlobName    = hostInstanceId.ToString("N"),
                ExpirationInSeconds = (int)HeartbeatIntervals.ExpirationInterval.TotalSeconds
            };

            var dashboardAccount = _storageAccountOptions.GetDashboardStorageAccount();

            var blob = dashboardAccount.CreateCloudBlobClient()
                       .GetContainerReference(heartbeatDescriptor.SharedContainerName)
                       .GetBlockBlobReference(heartbeatDescriptor.SharedDirectoryName + "/" + heartbeatDescriptor.InstanceBlobName);
            IRecurrentCommand heartbeatCommand = new UpdateHostHeartbeatCommand(new HeartbeatCommand(blob));

            IEnumerable <MethodInfo> indexedMethods = functions.ReadAllMethods();
            Assembly hostAssembly = JobHostContextFactory.GetHostAssembly(indexedMethods);
            string   displayName  = hostAssembly != null?AssemblyNameCache.GetName(hostAssembly).Name : "Unknown";

            hostOutputMessage = new JobHostContextFactory.DataOnlyHostOutputMessage
            {
                HostInstanceId      = hostInstanceId,
                HostDisplayName     = displayName,
                SharedQueueName     = sharedQueueName,
                InstanceQueueName   = instanceQueueName,
                Heartbeat           = heartbeatDescriptor,
                WebJobRunIdentifier = WebJobRunIdentifier.Current
            };

            hostCallExecutor = JobHostContextFactory.CreateHostCallExecutor(instanceQueueListenerFactory, heartbeatCommand,
                                                                            _exceptionHandler, shutdownToken, _functionExecutor);
            IListenerFactory hostListenerFactory = new CompositeListenerFactory(functionsListenerFactory,
                                                                                sharedQueueListenerFactory, instanceQueueListenerFactory);

            listener = JobHostContextFactory.CreateHostListener(hostListenerFactory, _sharedQueueHandler, heartbeatCommand, _exceptionHandler, shutdownToken);

            return(true);
        }
예제 #25
0
 public ListenerFactoryListener(IListenerFactory factory)
 {
     _factory            = factory;
     _cancellationSource = new CancellationTokenSource();
 }
 public ListenerFactoryListener(IListenerFactory factory, IFunctionExecutor executor)
 {
     _factory            = factory;
     _executor           = executor;
     _cancellationSource = new CancellationTokenSource();
 }
 public FunctionDefinition(IFunctionInstanceFactory instanceFactory, IListenerFactory listenerFactory)
 {
     _instanceFactory = instanceFactory;
     _listenerFactory = listenerFactory;
 }
예제 #28
0
 public SuperSocketService(IServiceProvider serviceProvider, IOptions <ServerOptions> serverOptions, ILoggerFactory loggerFactory, IListenerFactory listenerFactory, Func <IAppSession, TReceivePackageInfo, Task> packageHandler)
     : base(serviceProvider, serverOptions, loggerFactory, listenerFactory, packageHandler)
 {
 }
예제 #29
0
 public ListenerFactoryProcessor(IListenerFactory factory)
     : base("Listener Factory Processor")
 {
     _factory = factory;
 }
 private static IFunctionExecutor CreateHostCallExecutor(IListenerFactory instanceQueueListenerFactory,
     IRecurrentCommand heartbeatCommand, IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
     CancellationToken shutdownToken, IFunctionExecutor innerExecutor)
 {
     IFunctionExecutor heartbeatExecutor = new HeartbeatFunctionExecutor(heartbeatCommand,
         backgroundExceptionDispatcher, innerExecutor);
     IFunctionExecutor abortListenerExecutor = new AbortListenerFunctionExecutor(instanceQueueListenerFactory, heartbeatExecutor);
     IFunctionExecutor shutdownFunctionExecutor = new ShutdownFunctionExecutor(shutdownToken, abortListenerExecutor);
     return shutdownFunctionExecutor;
 }
 public FunctionDefinition(FunctionDescriptor descriptor, IFunctionInstanceFactory instanceFactory, IListenerFactory listenerFactory)
 {
     _descriptor = descriptor;
     _instanceFactory = instanceFactory;
     _listenerFactory = listenerFactory;
 }
예제 #32
0
 public ListenerFactoryListener(IListenerFactory factory, SharedQueueHandler sharedQueue)
 {
     _factory            = factory;
     _sharedQueue        = sharedQueue;
     _cancellationSource = new CancellationTokenSource();
 }
예제 #33
0
 public FunctionDefinition(FunctionDescriptor descriptor, IFunctionInstanceFactory instanceFactory, IListenerFactory listenerFactory)
 {
     _descriptor      = descriptor;
     _instanceFactory = instanceFactory;
     _listenerFactory = listenerFactory;
 }
 public ListenerFactoryListener(IListenerFactory factory)
 {
     _factory = factory;
     _cancellationSource = new CancellationTokenSource();
 }
예제 #35
0
 public SuperSocketService(IServiceProvider serviceProvider, IOptions <ServerOptions> serverOptions, ILoggerFactory loggerFactory, IListenerFactory listenerFactory)
     : base(serviceProvider, serverOptions, loggerFactory, listenerFactory)
 {
 }
 private static IListener CreateHostListener(IListenerFactory allFunctionsListenerFactory,
     IRecurrentCommand heartbeatCommand, IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
     CancellationToken shutdownToken)
 {
     IListener factoryListener = new ListenerFactoryListener(allFunctionsListenerFactory);
     IListener heartbeatListener = new HeartbeatListener(heartbeatCommand, backgroundExceptionDispatcher, factoryListener);
     IListener shutdownListener = new ShutdownListener(shutdownToken, heartbeatListener);
     return shutdownListener;
 }
 public WorkflowEngineBuilder WithListenerFactory(IListenerFactory listenerFactory)
 {
     ListenerFactory = listenerFactory;
     return(this);
 }