Skip to content

Allow NATS messages without message-type header when DefaultIncomingMessage is set#6

Merged
frankvdb7 merged 3 commits intomainfrom
fix-nats-default-incoming-message-required-type-13281418315348865178
May 7, 2026
Merged

Allow NATS messages without message-type header when DefaultIncomingMessage is set#6
frankvdb7 merged 3 commits intomainfrom
fix-nats-default-incoming-message-required-type-13281418315348865178

Conversation

@frankvdb7
Copy link
Copy Markdown
Owner

This PR fixes an issue where NATS messages were being dropped if they lacked a 'message-type' header, even when the endpoint was configured with a DefaultIncomingMessage.

The fix modifies CoreNatsSubscriber and JetStreamSubscriber to only skip messages without the 'message-type' header if no MessageType (default type) is configured for the endpoint. This allows Wolverine to correctly process raw NATS messages from external systems when a default type is provided.


PR created automatically by Jules for task 13281418315348865178 started by @frankvdb7

…aultIncomingMessage

Updated CoreNatsSubscriber and JetStreamSubscriber to allow messages
without the 'message-type' header if the endpoint has a MessageType
defined (configured via DefaultIncomingMessage).
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the message filtering logic in CoreNatsSubscriber and JetStreamSubscriber to allow processing messages without a 'message-type' header when the endpoint has a pre-defined MessageType. Reviewers suggested refactoring this duplicated logic into a shared method within NatsEndpoint, using constants for header keys, and simplifying the code using null-conditional operators.

Comment thread src/Transports/NATS/Wolverine.Nats/Internal/CoreNatsSubscriber.cs
Comment thread src/Transports/NATS/Wolverine.Nats/Internal/JetStreamSubscriber.cs
frankvdb7 added 2 commits May 7, 2026 16:55
…aultIncomingMessage

- Updated CoreNatsSubscriber to allow messages without 'message-type' header if DefaultIncomingMessage is configured.
- Updated JetStreamSubscriber to allow messages without 'message-type' header if DefaultIncomingMessage is configured.
- Added debug logging for skipped messages in JetStreamSubscriber (consistent with CoreNatsSubscriber).
- Added regression test DefaultIncomingMessageTests.
- Verified consistency with RabbitMQ transport behavior.
…aultIncomingMessage

- Updated CoreNatsSubscriber and JetStreamSubscriber to allow messages without 'message-type' header if the endpoint has a defined MessageType (configured via DefaultIncomingMessage).
- Added debug logging to JetStreamSubscriber for skipped messages, consistent with CoreNatsSubscriber.
- Added a regression test in NatsTransportIntegrationTests.cs verifying that raw NATS messages without headers are correctly received when a default message type is set.
- Ensured consistency with other transports like RabbitMQ which do not have this restriction.
@frankvdb7 frankvdb7 merged commit 265ca5f into main May 7, 2026
21 checks passed
@frankvdb7 frankvdb7 deleted the fix-nats-default-incoming-message-required-type-13281418315348865178 branch May 7, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant