示例#1
0
        public ProcessConsumer(CancellationToken parentToken, int processKey, long processId,
                               long groupId,
                               IStateManager stateManager,
                               ILogger logger, ITask taskHandler, ISerializer serializer, Bus bus,
                               IFrameworkLogger frameworkLogger, ITaskListenerHandler taskListener,
                               IProcessExecutionContext executionContext) //, ICacheAside cacheAside //, ProcessConfiguration processConfiguration
        {
            _systemLogger = frameworkLogger;
            _taskListener = taskListener;
            //_cacheAside = cacheAside;

            _processContext       = executionContext; //cacheAside.GetProcessExecutionContext(processId);
            _processConfiguration = _processContext.Configuration;

            _lastInputTime = DateTime.UtcNow;

            //_processId = processId;
            _maxConsumers = ProcessConfiguration.BatchSize;
            _parentToken  = parentToken;
            _logger       = logger;
            //_volumeHandler = volumeHandler;
            _processId    = processId; // processConfiguration.ProcessKey;
            _groupId      = groupId;
            _processKey   = processKey;
            _stateManager = stateManager;


            int queueSize = _processConfiguration.QueueSize ?? DefaultQueueSize; //Environment.ProcessorCount

            queueSize          = queueSize <= 0 ? 1 : queueSize;
            _taskContextsQueue = new BlockingCollection <TaskContext>(queueSize);

            _processTokenSource = CancellationTokenSource.CreateLinkedTokenSource(parentToken);
            _processToken       = _processTokenSource.Token;

            _handler = taskHandler;// ApplicationTasksHandlers.Instance.GetProcessTaskHandler(_processConfiguration.ProcessKey);
            if (_handler == null)
            {
                var error = $"Task processor for processKey {_processConfiguration.ProcessKey} not found.";
                logger.Fatal(error);
                throw new FrameworkException(error);
            }

            Type[] interfaces = _handler.GetType().GetInterfaces().Where(t => t.IsGenericType).ToArray();

            bool isStateful = interfaces.Any(x => x.GetGenericTypeDefinition() == typeof(ITaskSaga <>)); // (typeof(ITaskSaga<>).IsAssignableFrom(handler.GetType()))

            _isStateful = isStateful;

            _serializer = serializer; // ApplicationTasksHandlers.Instance.GetSerializer(_handler);
            _bus        = bus;
        }
示例#2
0
 public ProcessExecutionContext(ILogger logger, IReadWritableProcessState processState,
                                IProcessConfiguration configuration, IProcessDataStorage storage,
                                IReadWritableGroupEntity groupDetailsGroupEntity)
 {
     Logger = logger;
     //ProcessState = processState;
     WritableProcessState = processState;
     Configuration        = configuration;
     _storage             = storage;
     GroupEntity          = groupDetailsGroupEntity;
     Criteria             =
         SerializersFactory.Instance.DefaultSerializer.DeserializeFromString <JobCriteria>(processState.Criteria);
 }
		public ProcessModule(IDatabaseContextFactory databaseContextFactory, IEventStore eventStore, IKeyStore keyStore,
			IProcessConfiguration configuration)
		{
			Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
			Guard.AgainstNull(eventStore, "eventStore");
			Guard.AgainstNull(keyStore, "keyStore");
			Guard.AgainstNull(configuration, "configuration");

			_databaseContextFactory = databaseContextFactory;
			_eventStore = eventStore;
			_keyStore = keyStore;
			_configuration = configuration;
		}
示例#4
0
        public void UpdateData()
        {
            try
            {
                var foo = AvailableProcessConfigurationsItemSource?.First(
                    config => config.Name.EnglishValue == MRecipeDeviceLayerItemSource?.TargetProcessMode
                    );

                if (foo != null)
                {
                    _selectedProcessConfiguration = foo;
                    NotifyPropertyChanged(nameof(SelectedProcessConfiguration));
                }
            }
            catch (Exception) { }
        }
		public ProcessMessageHandlerInvoker(IDatabaseContextFactory databaseContextFactory, IEventStore eventStore,
			IKeyStore keyStore,
			IProcessConfiguration configuration)
		{
			Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
			Guard.AgainstNull(eventStore, "eventStore");
			Guard.AgainstNull(eventStore, "keyStore");
			Guard.AgainstNull(configuration, "configuration");

			_databaseContextFactory = databaseContextFactory;
			_eventStore = eventStore;
			_keyStore = keyStore;
			_configuration = configuration;

			_defaultMessageHandlerInvoker = new DefaultMessageHandlerInvoker();
		}
 public ProcessElement(IProcessConfiguration config)
     : this(config.Id + " Source", config.Name, config.Exe, config.MachineName)
 {
 }