Add pluggable envelope ID generation with GuidV7 option#2376
Merged
jeremydmiller merged 2 commits intomainfrom Mar 30, 2026
Merged
Add pluggable envelope ID generation with GuidV7 option#2376jeremydmiller merged 2 commits intomainfrom
jeremydmiller merged 2 commits intomainfrom
Conversation
NewId generates sequential GUIDs based on machine identity (MAC/DNS), which produces duplicate envelope IDs in cloud environments where multiple instances share network properties (Cloud Run, Kubernetes, serverless). This adds EnvelopeIdGeneration.GuidV7 as an opt-in alternative using Guid.CreateVersion7() per RFC 9562. Implementation uses a static Func<Guid> delegate on Envelope that is set once at startup — no runtime if/then overhead. All internal NewId.NextSequentialGuid() calls replaced with Envelope.IdGenerator(). Fixes #2375 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Guid.CreateVersion7() was added in .NET 9. Since Wolverine multi-targets net8.0/net9.0/net10.0, wrap the call in #if NET9_0_OR_GREATER and throw NotSupportedException on net8.0. Tests also wrapped in the same conditional. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Mar 30, 2026
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
Fixes #2375
NewId.NextSequentialGuid()generates envelope IDs based on machine identity (MAC/DNS hostname). In cloud environments where multiple instances share network properties (Google Cloud Run, Kubernetes, serverless), this produces duplicate envelope IDs causingDuplicate incoming envelopeerrors.EnvelopeIdGenerationenum withNewId(default, backward compatible) andGuidV7(Guid.CreateVersion7()per RFC 9562) options.Func<Guid>delegate onEnvelopeset once at startup — zero runtime branching overhead. All internalNewId.NextSequentialGuid()calls replaced withEnvelope.IdGenerator().Usage
Files changed
WolverineOptions.csEnvelopeIdGenerationenum and propertyEnvelope.csIdGeneratordelegate, property initializer uses itWolverineRuntime.csEnvelope.IdGeneratorat startup based on configCloudEventsMapper.csEnvelope.IdGenerator()DurableReceiver.csEnvelope.IdGenerator()(2 occurrences)EnvelopeGenerator.csEnvelope.IdGenerator()messages.mdTest plan
🤖 Generated with Claude Code