Пример #1
0
        public void Start()
        {
            _bus = BusCreator.CreateBus(Context.ProcessConfig);
            _bus.Start();

            // 根据process配置,找到第一个start
            var startId   = Context.ProcessConfig.StartEvent.Id;
            var startFlow = Context.ProcessConfig.SequenceFlow.FirstOrDefault(t => t.SourceRef == startId);

            if (startFlow == null)
            {
                return;
            }
            Context.CurrentSequenceFlow = startFlow;
            var sendToUri = new Uri($"{Context.ProcessConfig.RabbitMqUri.Url}{startFlow?.Id}");

            BusCreator.SendCommand(_bus, sendToUri, Context);
        }
Пример #2
0
        public void DoNext()
        {
            _bus = BusCreator.CreateBus(Context.ProcessConfig);
            _bus.Start();

            // 找到当前的节点的下一个节点执行(TODO:目标的服务可能是列表)
            var nextFlows = Context.ProcessConfig.SequenceFlow.Where(t => t.SourceRef == Context.CurrentSequenceFlow?.TargetRef).ToList();

            if (!nextFlows.Any())
            {
                return;
            }

            var node = GetNextNode(nextFlows);

            Context.CurrentSequenceFlow = node;
            var sendToUri = new Uri($"{Context.ProcessConfig.RabbitMqUri.Url}{node.Id}");

            BusCreator.SendCommand(_bus, sendToUri, Context);
        }