示例#1
0
        public IActionResult Ack(Guid id)
        {
            // You could of course do a lot more here like ask for more information
            // and publish that data as part of the event.

            workflowHost.PublishEvent("ContactFormAcknowledged", id.ToString(), null);

            return(View());
        }
示例#2
0
        public static async Task PublishUserAction(this IWorkflowHost host, string actionKey, string user, object value)
        {
            UserAction data = new UserAction
            {
                User         = user,
                OutcomeValue = value
            };

            await host.PublishEvent(UserTask.EventName, actionKey, data);
        }
        public IActionResult PhanXuLy(NhiemVuModel request)
        {
            var phanXuLy = Database.PhanXuLyNhiemVus.First(p => p.Id == request.PhanXuLyId && p.NhiemVuId == request.NhiemVuId);

            var id = Database.PhanXuLyNhiemVus.Where(p => p.NhiemVuId == request.NhiemVuId).Max(n => n.Id) + 1;

            _host.PublishEvent(NhiemVuWorkflowEvents.DaPhanXuLy, phanXuLy.WorkflowId, new PhanXuLyNhiemVu
            {
                Id = id,
                PhanXuLyNhiemVuChaId = phanXuLy.Id,
                CanBoId    = 2,
                DonViId    = 2,
                NhiemVuId  = request.NhiemVuId,
                TrangThai  = TrangThaiPhanXuLy.DangThucHien,
                VaiTroXuLy = VaiTroXuLy.PhoiHop,
                WorkflowId = phanXuLy.WorkflowId
            });

            return(Ok());
        }
示例#4
0
        private static async Task TestExternalEventAsync(IWorkflowHost host)
        {
            var data = new MyData {
                Request = "abc"
            };
            var workflowId = await host.StartWorkflow("ExternalEventWorkflow", 1, data);

            //#pragma warning disable 4014
            //            Task.Run(async () => {
            //#pragma warning restore 4014
            //                await Task.Delay(10 * 1000);
            //                await host.PublishEvent(ExternalEventWorkflow.EventName, "abc", new MyData{ Request = "abc" });
            //            }).ConfigureAwait(false);

            Console.Write("------> Please input event data: ");
            var eventData = Console.ReadLine();
            await host.PublishEvent(ExternalEventWorkflow.EventName01, data.Request, eventData);

            await Task.Delay(500);

            await host.PublishEvent(ExternalEventWorkflow.EventName02, data.Request, eventData + " -- other");
        }
示例#5
0
        public static void EventWorkflow(IWorkflowHost host, IServiceProvider provider)
        {
            var workflowController = provider.GetService <IWorkflowController>();
            var persist            = provider.GetService <IPersistenceProvider>();

            host.RegisterWorkflow <EventSampleWorkflow, EventFlowData>();
            host.Start();

            var initialData = new EventFlowData();
            var workflowId  = host.StartWorkflow("EventSampleWorkflow", 1, initialData).Result;

            var id = "EventSampleWorkflow";

            //var workflow = workflowController.SuspendWorkflow(workflowId).Result;
            Console.WriteLine("Enter value to publish");
            string value = Console.ReadLine();

            host.PublishEvent("MyEvent", workflowId, value);
        }
示例#6
0
        public async Task Pdf4meActionHandlerAsync(ProcessingMessage message, CancellationToken token)
        {
            var logTrace = new LogTrace();

            try
            {
                AiLogger.LogInfo(logTrace, "WfMessage to execute: " + JsonConvert.SerializeObject(message));

                var msgId = message.MessageId;

                var docPluginRes = JsonConvert.DeserializeObject <DocPluginRes>(message.MessageBody);

                await _wfHost.PublishEvent(docPluginRes.WfEventName, docPluginRes.WfEventKey, message.MessageBody);

                AiLogger.LogInfo(logTrace, "WfMessage executed!");
            }catch (Exception e)
            {
                AiLogger.LogException(logTrace, e);
            }
        }
示例#7
0
        public async Task <IActionResult> Post(string eventName, string eventKey, [FromBody] object eventData)
        {
            await _workflowHost.PublishEvent(eventName, eventKey, eventData);

            return(Ok());
        }
示例#8
0
 public virtual async Task PublishEventAsync(string eventName, string eventKey, object eventData)
 {
     await _workflowHost.PublishEvent(eventName, eventKey, eventData);
 }
        private void FileWatcher_FileDetectHandler(object sender, EventArgs e)
        {
            var fileEvent = (FileEventArgs)e;

            _host.PublishEvent(fileEvent.EventName, fileEvent.WorkflowId, fileEvent.EventData);
        }
示例#10
0
 public async Task ExecuteEvent(string eventName, string workflowId, string eventData)
 {
     await _host.PublishEvent(eventName, workflowId, eventData);
 }