Skip to content

Commit

Permalink
Partially through bidirectional watcher implementation, but stopping …
Browse files Browse the repository at this point in the history
…at this point pending further discussion as to intended goals around how this is intended to be utilized (e.g. as opposed to strictly using an HTTP callback)

Signed-off-by: Whit Waldo <[email protected]>
  • Loading branch information
WhitWaldo committed Jul 10, 2024
1 parent 2cdd554 commit e713661
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Dapr.Jobs/DaprJobsGrpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,26 @@ public override Task<IAsyncEnumerable<WatchedJobDetails<T>>> WatchJobsAsync<T>(
var callOptions = CreateCallOptions(headers: null, cancellationToken);
var duplexStream = client.WatchJobs(callOptions);

//Leave this stream open - when new jobs come in, retrieve the job information and pass it back to the job invocator
//When that job invocator runs successfully, send back a response that contains the job ID so it can be marked as completed

//Run both operations at the same time
var receiveResult = Task.FromResult(RetrieveWatchedJobsAsync<T>(duplexStream, cancellationToken));



//TODO Flag whatever is subscribed to this that another job has been invoked

//TODO Return a response to the server indicating that the job ID has been handled
}

private async Task HandleJobInvocationAsync<T>(WatchedJobDetails<T> details, AsyncDuplexStreamingCall<Autogenerated.WatchJobsRequestResult, Autogenerated.WatchJobsResponse> duplexStream, CancellationToken cancellationToken)
{
//TODO Invoke it somehow
await duplexStream.RequestStream.WriteAsync(new Autogenerated.WatchJobsRequestResult { Id = details.Id },
cancellationToken);
}

/// <summary>
/// Retrieves the watched jobs from the Dapr scheduler.
/// </summary>
Expand Down

0 comments on commit e713661

Please sign in to comment.