bugfix/DEV-4588 - Veel NATS messages worden niet opgepakt zoals bij de GFP te zien - #1
Merged
Conversation
Stream::put() is fire-and-forget — no delivery guarantee from JetStream. Stream::publish() waits for an ack, ensuring the message was persisted. publish() now uses the ack-based path as the safe default. publishFireAndForget() retains the old put() behavior for cases where delivery confirmation is unnecessary (logging, telemetry). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Theorie A:
put()vspublish()❌We hebben
putin plaats vanpublishgebruikt voor deJetStreamPublisher.Bij een
putis het "fire and forget", wat handig is voor logging en monitoring als een message niet per se aan hoeft te komen. Met eenpublishkomt er ook een ACK terug. Echter napublishgeïmplementeerd te hebben, werkt het nog niet.We hebben nu wel beide, waarbij
publishstandaard ACK doet (= veiliger) en ik hebpublishFireAndForgettoegevoegd voor logging / telemetry mocht iemand dat willen gebruiken.Theorie B: Shared TCP socket ✅
De volgende theorie is dat shared TCP socket mogelijk het probleem is. (Gotta love FrankenPHP)
Yes dit is het. In FrankenPHP worker mode blijft PHP lekker draaien over meerdere requests heen. Normaal gesproken start/sterft het PHP proces als je geen FrankenPHP gebruikt.
Door worker mode worden Symfony services daarom maar 1x aangemaakt omdat het een shared resource is, en delen derhalve hetzelfde TCP socket. Zie dat als 1 telefoonlijn, waar dan meerdere mensen door elkaar heen praten; het gevolg is dat NATS maar flarden opvangt en dus inconsistent is voor de verwerking.
N.B. dit ging wel goed als er een lichte delay op zat, omdat er dan dus niet "door elkaar heen" gepraat wordt.
Changes
publish()gebruikt nuStream::publish()(met ACK) in plaats vanStream::put()publishFireAndForget()toegevoegd voor fire-and-forget use cases🤖 Generated with Claude Code