Esempio n. 1
0
        public MessageTransceiver(SlaveContext contextManager, int session)
        {
            this._slaveContext = contextManager;

            // 创建上行队列
            FormatterType   formatterType = contextManager.GetProperty <FormatterType>("EngineQueueFormat");
            MessengerOption receiveOption = new MessengerOption(CoreConstants.UpLinkMQName, GetMessageType)
            {
                Type        = contextManager.GetProperty <MessengerType>("MessengerType"),
                Formatter   = formatterType,
                ReceiveType = ReceiveType.Synchronous
            };

            _uplinkMessenger = Messenger.GetMessenger(receiveOption);
            // 创建下行队列
            MessengerOption sendOption = new MessengerOption(CoreConstants.DownLinkMQName, GetMessageType)
            {
                Type        = contextManager.GetProperty <MessengerType>("MessengerType"),
                Formatter   = formatterType,
                ReceiveType = ReceiveType.Synchronous
            };

            _downLinkMessenger = Messenger.GetMessenger(sendOption);

            _messageQueue  = new LocalMessageQueue <MessageBase>(CoreConstants.DefaultEventsQueueSize);
            this.SessionId = session;
        }
 public UplinkMessageProcessor(SlaveContext context)
 {
     this._context           = context;
     this._transceiver       = _context.MessageTransceiver;
     this._waitTimer         = new Timer(SendHeartBeatMessage, null, Timeout.Infinite, Timeout.Infinite);
     this._heartBeatInterval = _context.GetProperty <int>("StatusUploadInterval");
     this._eventProcessFlag  = -1;
 }
Esempio n. 3
0
        public static StepTaskEntityBase GetStepEntity(SlaveContext context, CallStack stack)
        {
            if (stack.Session != context.SessionId)
            {
                return(null);
            }
            SequenceTaskEntity sequenceTaskEntity = context.SessionTaskEntity.GetSequenceTaskEntity(stack.Sequence);

            return(sequenceTaskEntity.GetStepEntity(stack));
        }
Esempio n. 4
0
        public static StepTaskEntityBase CreateSubStepModelChain(IList <ISequenceStep> steps, SlaveContext context, int sequenceIndex)
        {
            StepTaskEntityBase root = null;

            if (steps.Count == 0)
            {
                return(root);
            }

            root          = StepTaskEntityBase.GetStepModel(steps[0], context, sequenceIndex);
            root.NextStep = null;
            StepTaskEntityBase lastNode    = root;
            StepTaskEntityBase currentNode = null;

            for (int i = 1; i < steps.Count; i++)
            {
                currentNode          = StepTaskEntityBase.GetStepModel(steps[i], context, sequenceIndex);
                lastNode.NextStep    = currentNode;
                lastNode             = currentNode;
                currentNode.NextStep = null;
            }
            return(root);
        }
Esempio n. 5
0
        public static StepTaskEntityBase CreateStepModelChain(IList <ISequenceStep> steps, SlaveContext context,
                                                              int sequenceIndex)
        {
            StepTaskEntityBase root = null;

            if (steps.Count == 0)
            {
                context.LogSession.Print(LogLevel.Debug, context.SessionId,
                                         $"Empty steps created for sequence {sequenceIndex}");
                return(StepTaskEntityBase.GetEmptyStepModel(context, sequenceIndex));
            }

            root          = StepTaskEntityBase.GetStepModel(steps[0], context, sequenceIndex);
            root.NextStep = null;
            StepTaskEntityBase lastNode    = root;
            StepTaskEntityBase currentNode = null;

            for (int i = 1; i < steps.Count; i++)
            {
                currentNode          = StepTaskEntityBase.GetStepModel(steps[i], context, sequenceIndex);
                lastNode.NextStep    = currentNode;
                lastNode             = currentNode;
                currentNode.NextStep = null;
            }
            return(root);
        }
Esempio n. 6
0
 public StopWatchManager(SlaveContext context)
 {
     this._context     = context;
     this._stopWatches = new Dictionary <int, Stopwatch>(10);
 }
Esempio n. 7
0
 public DownlinkMessageProcessor(SlaveContext context)
 {
     this._context = context;
 }