public void SendSignal(ActivityTask task, WorkflowSignalledEvent signal)
        {
            var signalJson = JsonConvert.SerializeObject(signal);
            var content    = new StringContent(signalJson, Encoding.UTF8, "application/json");
            var url        = $"/executions/{task.ExecutionId}/signal";

            client.PostAsync(url, content);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Signal for response from an asynchronous task
        /// </summary>
        /// <param name="task"></param>
        /// <param name="signalName"></param>
        protected void SignalCancelled(ActivityTask task, string signalName)
        {
            var signal = new WorkflowSignalledEvent
            {
                SignalName = signalName,
                Status     = "cancelled"
            };

            workflowClient.SendSignal(task, signal);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Signal for response from an asynchronous task
        /// </summary>
        /// <param name="task"></param>
        /// <param name="signalName"></param>
        /// <param name="result"></param>
        protected void SignalSuccess(ActivityTask task, string signalName, JObject result)
        {
            var signal = new WorkflowSignalledEvent
            {
                SignalName = signalName,
                Status     = "success",
                Result     = result
            };

            workflowClient.SendSignal(task, signal);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Signal for response from an asynchronous task
        /// </summary>
        /// <param name="task"></param>
        /// <param name="signalName"></param>
        /// <param name="reason"></param>
        /// <param name="details"></param>
        protected void SignalFailure(ActivityTask task, string signalName, string reason, JObject details = null)
        {
            var signal = new WorkflowSignalledEvent
            {
                SignalName = signalName,
                Status     = "failure",
                Reason     = reason,
                Details    = details
            };

            workflowClient.SendSignal(task, signal);
        }