add asp commands#2001
Draft
nickpoindexter wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class driver support for Atlas Stream Processing (ASP), implementing the ASP driver spec. Users currently have to drop down to
client.GetDatabase("admin").RunCommand(...)against a workspace endpoint; this PR adds a dedicated client / handles layer matching what's already shipped for PHP, Rust, and Ruby.What's new
Public API (
src/MongoDB.Driver/StreamProcessing/)StreamProcessingClient— workspace-scoped client distinct fromMongoClient. Validates the workspace URI (atlas-stream-*.<region>.a.query.mongodb.netand the.mongodb-<env>.netstaging variants), enforces TLS, defaultsauthSourcetoadmin. ImplementsIDisposableand disposes the underlyingMongoClient. StaticStreamProcessingClient.IsWorkspaceUri(uri)exposed for callers that want to gate before connecting.StreamProcessors—Create/Get/GetInfo(plusAsyncpairs) for managing processors in a workspace.StreamProcessor—Start/Stop/Drop/Stats/Samples(plusAsyncpairs) for a named processor.StreamProcessorInfo— typed accessor over thegetStreamProcessorresponse. Fields the spec marks as optional (e.g.Id,PipelineVersion) areNullable<T>/ nullable reference types.StreamProcessorSamples— result ofSamples/SamplesAsync, exposesCursorId,Documents,IsExhausted.CreateStreamProcessorOptions,StartStreamProcessorOptions,FailoverOptions,GetStreamProcessorStatsOptions,GetStreamProcessorSamplesOptions. POCO classes following the existing options-class convention.Wire commands
All 8 ASP commands routed through
IMongoDatabase.RunCommand/RunCommandAsyncagainst theadmindatabase:createStreamProcessor,startStreamProcessor,stopStreamProcessor,dropStreamProcessor,getStreamProcessor,getStreamProcessorStats,startSampleStreamProcessor,getMoreSampleStreamProcessor.Notable spec / server alignment
startAfter(inStartStreamProcessorOptions) is intentionally not exposed — the spec marks it RESERVED for future use and explicitly forbids drivers from sending it.StreamProcessors.GetInfounwraps a top-levelresultwrapper when the server returns{ ok: 1, result: { … } }.StreamProcessor.Samplesaccepts bothnextBatch(spec) andmessages(current dev server).StreamProcessorInfo.IdandPipelineVersionreturnnullwhen the server omits them.Samplesis a single-call dispatch: null/zeroCursorId→startSampleStreamProcessor(returnsStreamProcessorSampleswith cursor id, empty docs); non-zero →getMoreSampleStreamProcessor. Callers stop whenCursorId == 0(or usethe
IsExhaustedpredicate).tenantID,projectId,processorId) are not surfaced in the public API.Test plan
dotnet build CSharpDriver.sln— 0 errors (14 pre-existing warnings:SharpCompressvulnerability +netcoreapp3.1TFM support notices, neither introduced by this PR)dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0 --filter "FullyQualifiedName~StreamProcessing"— all unit tests pass (URI detection for prod / staging / creds-and-port / case-insensitivity / four rejectcases; constructor rejection paths; full
StreamProcessorInfogetter coverage including defaults and error fields;StreamProcessorSamplespredicates)dotnet test ... --filter "FullyQualifiedName~StreamProcessingLifecycle"(no env var) — self-skips cleanlytests/MongoDB.Driver.Examples/StreamProcessingExample.cs— create → start → stats → samples (cursor opened + telemetry docs returned in second call) → stop → drop. Alltransitions clean.