private async Task RaiseEvent(string processInstanceId, ProvisioningConfiguration configuration, ConsumeContext <RepresentationAddedEvent> context, HttpClient httpClient) { var message = ParseMessageToken(configuration, context); var request = new HttpRequestMessage { RequestUri = new Uri($"{configuration.GetBpmnEndpoint()}/processinstances/{processInstanceId}/messages"), Method = HttpMethod.Post, Content = new StringContent(message, Encoding.UTF8, "application/json") }; var httpResult = await httpClient.SendAsync(request); httpResult.EnsureSuccessStatusCode(); }
private async Task <string> CreateProcessInstance(ProvisioningConfiguration configuration, HttpClient httpClient) { var content = new JObject(); content.Add("processFileId", configuration.GetBpmnFileId()); var request = new HttpRequestMessage { RequestUri = new Uri($"{configuration.GetBpmnEndpoint()}/processinstances"), Method = HttpMethod.Post, Content = new StringContent(content.ToString(), Encoding.UTF8, "application/json") }; var httpResult = await httpClient.SendAsync(request); httpResult.EnsureSuccessStatusCode(); var str = await httpResult.Content.ReadAsStringAsync(); return(JObject.Parse(str).SelectToken("content[0].id").ToString()); }
private async Task LaunchProcessInstance(string processInstanceId, ProvisioningConfiguration configuration, HttpClient httpClient) { var httpResult = await httpClient.GetAsync($"{configuration.GetBpmnEndpoint()}/processinstances/{processInstanceId}/start"); httpResult.EnsureSuccessStatusCode(); }