public async Task ShouldRetrySendRequestOnUnavailableUntilSucceed() { // given var countdownEvent = new CountdownEvent(5); TestService.AddRequestHandler( typeof(CancelWorkflowInstanceRequest), req => { countdownEvent.Signal(); throw new RpcException(new Status(StatusCode.Unavailable, "exhausted")); }); var expectedRequest = new CancelWorkflowInstanceRequest { WorkflowInstanceKey = 12113 }; // when var resultTask = ZeebeClient.NewCancelInstanceCommand(12113).SendWithRetry(); countdownEvent.Wait(TimeSpan.FromSeconds(10)); // then Assert.AreEqual(0, countdownEvent.CurrentCount); TestService.AddRequestHandler(typeof(CancelWorkflowInstanceRequest), req => new CancelWorkflowInstanceResponse()); await resultTask; var request = TestService.Requests[typeof(CancelWorkflowInstanceRequest)][0]; Assert.AreEqual(expectedRequest, request); var requestCount = TestService.Requests[typeof(CancelWorkflowInstanceRequest)].Count; Assert.GreaterOrEqual(requestCount, 5); }
public CancelWorkflowInstanceCommand(Gateway.GatewayClient client, long workflowInstanceKey) { request = new CancelWorkflowInstanceRequest { WorkflowInstanceKey = workflowInstanceKey }; this.client = client; }
public CancelWorkflowInstanceCommand(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy, long workflowInstanceKey) { request = new CancelWorkflowInstanceRequest { WorkflowInstanceKey = workflowInstanceKey }; this.client = client; this.asyncRetryStrategy = asyncRetryStrategy; }
public async Task ShouldSendRequestAsExpected() { // given var expected = new CancelWorkflowInstanceRequest { WorkflowInstanceKey = 12113 }; // when await ZeebeClient.NewCancelInstanceCommand(12113).Send(); // then var request = TestService.Requests[typeof(CancelWorkflowInstanceRequest)][0]; Assert.AreEqual(expected, request); }
public override Task <CancelWorkflowInstanceResponse> CancelWorkflowInstance(CancelWorkflowInstanceRequest request, ServerCallContext context) { return(Task.FromResult((CancelWorkflowInstanceResponse)HandleRequest(request, context))); }
public override AsyncUnaryCall <CancelWorkflowInstanceResponse> CancelWorkflowInstanceAsync(CancelWorkflowInstanceRequest request, CallOptions options) { throw new ObjectDisposedException(ZeebeClientWasAlreadyDisposed); }
public override AsyncUnaryCall <CancelWorkflowInstanceResponse> CancelWorkflowInstanceAsync(CancelWorkflowInstanceRequest request, Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { throw new ObjectDisposedException(ZeebeClientWasAlreadyDisposed); }