public void Error(string workerId, string externalTaskId, string errorCode)
        {
            var request = new BpmnErrorRequest()
            {
                WorkerId  = workerId,
                ErrorCode = errorCode
            };

            var errorHttpRequest = new HttpClientRequest <BpmnErrorRequest>("external-task/" + externalTaskId + "/bpmnError", request);

            _httpClientService.PostAsync <BpmnErrorRequest>(errorHttpRequest);
        }
Beispiel #2
0
        public async Task ReportBpmnErrorAsync(string errorCode, string errorMessage,
                                               IDictionary <string, Variable>?variables = null)
        {
            ThrowIfDisposed();
            ThrowIfCompleted();

            using var client = ServiceProvider.GetRequiredService <IExternalTaskClient>();
            var request = new BpmnErrorRequest(Task.WorkerId, errorCode, errorMessage)
            {
                Variables = variables
            };
            await client.ReportBpmnErrorAsync(Task.Id, request);

            Completed = true;
        }
Beispiel #3
0
        public void Error(string workerId, string externalTaskId, string errorCode)
        {
            var http = helper.HttpClient();

            var request = new BpmnErrorRequest();

            request.WorkerId  = workerId;
            request.ErrorCode = errorCode;

            var requestContent = new StringContent(JsonConvert.SerializeObject(request, new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }), Encoding.UTF8, CamundaClientHelper.CONTENT_TYPE_JSON);
            var response = http.PostAsync("external-task/" + externalTaskId + "/bpmnError", requestContent).Result;

            if (!response.IsSuccessStatusCode)
            {
                throw new EngineException("Could not report BPMN error for external Task: " + response.ReasonPhrase);
            }
        }