Conversation
…endpointName Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…oint names Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
adenhertog
force-pushed
the
issue-322-message-id-sent-at-endpoint
branch
from
October 3, 2026 01:27
6457046 to
150f4ba
Compare
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.
Closes #322
Summary
Core stamps a
messageIdandsentAton every outgoing message, every transport carries them through retries and the DLQ, andTransportgets a requiredendpointName.Background
#258, #261, #262 and #264 all need a stable message id, a send time and the endpoint's name. This adds them once so those PRs don't each add them.
Problem
TransportMessage.idis the transport's native id: SQS changes it onfail, RabbitMQ made a new UUID per publish, and in-memory has none. Nothing recorded when a message was sent, and core had no way to know which endpoint it runs as.Approach
MessageAttributes(bus-messages): optionalmessageIdandsentAt(ISO 8601), also accepted bymessageAttributes().prepareTransportOptionssetsmessageId: randomUUID()andsentAt: new Date().toISOString()unless the caller passes them. Neither is copied from the message being handled.Transport.endpointNameis a required readonly property.InMemoryQueuetakes an optionalendpointName(defaultin-memory). It already passes the attributes object throughtoTransportMessage, so nothing changed there.messageIdandsentAtare top-level SNS attributes intoMessageAttributeMap/fromMessageAttributeMap, so bus-sqs-lambda gets them for free (spec added).endpointNameisqueueName, or the name fromqueueArn.messageIdproperty comes from the attribute. It falls back torandomUUID()only when the transport is called directly without one.sentAtgoes in asentAtheader.endpointNameisqueueName.transportTestschecks that a caller'smessageIdarrives unchanged, that a bus-stampedmessageId/sentAtarrives, and that both stay the same on every retry and in the DLQ, for poisoned and failed messages. bus-test'sin-memory.integration.tsnow runs the fulltransportTests(it used to run only the round trip cases) through a smallTransportTestInMemoryQueuefixture, so the in-memory queue is covered too.messageId/sentAtbut keeps thecorrelationId./guide/message-attributes/message-idpage (snippet indocs/snippets/message-id.ts), linked from/guide/message-attributesand the sidebar./transports/customdocumentsendpointNameand the carry-through rule, the custom transport skeleton has both, and the bus-test README is re-synced. MIGRATING entries and aminorchangeset are included, with Breaking: notes forTransport.endpointNameand the strictertransportTests.Checklist:
messageIdandsentAtthat a handler's sends don't inherit: confirmed & fixed. The new transportTests and handler-context tests fail on master (8 failures with the stamping removed) and pass now.messageIdreaches the handler unchanged: confirmed & fixed (transportTests, every transport).Transport.endpointNameon every transport, documented in/transports/custom: done.Worth a close look:
sentAtis set whensend/publishis called, not when the outbox flushes. The PR stamps where the attributes are prepared, to stay out of Incoming and outgoing pipeline behaviours (middleware) #263's way. If Incoming and outgoing pipeline behaviours (middleware) #263 moves that code, the stamp should move with it.SqsTransport.endpointNameis''for a send-only transport configured with neitherqueueNamenorqueueArn.bus-instance.tssend/publish JSDoc, therabbitmq-transport.tspublish headers, the root, bus-rabbitmq and bus-sqsCLAUDE.md,docs/transports/custom.mdand the add-transportSKILL.md. Whichever PR merges second resolves those conflicts and reservesmessageId/sentAtas transport header names.messageIdmust be unique per message (Inbox / idempotent consumer (message deduplication) #261 will dedup on(endpoint, messageId)), and at most 255 bytes on RabbitMQ. Both are documented on the message-id page, and the 255-byte limit also on the RabbitMQ page.🤖 Generated with Claude Code