Background and motivation
I'd like to contribute a Fedify MessageQueue adapter backed by Temporal.io, the durable execution platform.
In our project, byulmaru/kosmo, we already use Temporal, while Fedify uses a separate PgMessageQueue for message processing. Reusing our existing Temporal infrastructure could reduce the overhead of managing these separate queue mechanisms.
Proposed approach
I propose a separate adapter package implementing Fedify's MessageQueue interface, with message handlers executed as Temporal Activities.
The initial design would be:
- For messages without an ordering key, start a Workflow per message. The Workflow waits for any requested delay and then invokes the message-processing Activity.
- For ordered messages, use a Workflow per ordering key, addressed through Signal-With-Start. Signal handlers buffer messages, while the main Workflow loop processes eligible messages one at a time.
- Delayed messages become eligible after their delay and do not block later messages that are already eligible. Once an Activity starts, its retries hold up subsequent messages for the same key until it succeeds or reaches a terminal failure.
- Use Temporal's Activity retries and declare nativeRetrial so Fedify does not independently schedule retries for the same failure. Define a bounded retry policy and terminal-failure handling so one failed message cannot block a key indefinitely.
- Have listen() start a Temporal Worker with the supplied handler registered as an Activity, and initiate graceful worker shutdown when its abort signal fires.
- Use Continue-As-New to bound Workflow history, carrying pending messages forward, and allow idle ordering Workflows to complete.
This is an initial design, not yet validated by an implementation. I would like to confirm the delay and retry semantics against the intended MessageQueue contract.
Deduplication also needs verification: using a Workflow ID alone should not be assumed to match Fedify's deduplication window. I would verify that behavior before advertising native deduplication support. Optional queue depth reporting and atomic batch enqueue would be outside the initial scope.
The contribution would include documentation of supported runtimes and worker setup, along with integration tests covering delayed processing, retries, ordering, worker restart and shutdown, and pending-message preservation across Continue-As-New.
Questions for maintainers
Would you be open to including this adapter in the Fedify monorepo, or would you prefer it to start as a third-party package?
Does this approach fit the intended MessageQueue contract? I'd appreciate feedback on the proposed worker lifecycle and ordering model before implementing it.
AI assistance
ChatGPT (GPT-5.6 Sol) assisted with exploring the technical approach. Codex (GPT-6, with GPT-5.6 Luna assisting repository investigation) reviewed repository materials and drafted this issue.
I provided the use case from byulmaru/kosmo and reviewed the proposal's motivation, terminology, scope, and AI disclosure. The technical analysis and English draft were AI-assisted.
Background and motivation
I'd like to contribute a Fedify MessageQueue adapter backed by Temporal.io, the durable execution platform.
In our project, byulmaru/kosmo, we already use Temporal, while Fedify uses a separate PgMessageQueue for message processing. Reusing our existing Temporal infrastructure could reduce the overhead of managing these separate queue mechanisms.
Proposed approach
I propose a separate adapter package implementing Fedify's MessageQueue interface, with message handlers executed as Temporal Activities.
The initial design would be:
This is an initial design, not yet validated by an implementation. I would like to confirm the delay and retry semantics against the intended MessageQueue contract.
Deduplication also needs verification: using a Workflow ID alone should not be assumed to match Fedify's deduplication window. I would verify that behavior before advertising native deduplication support. Optional queue depth reporting and atomic batch enqueue would be outside the initial scope.
The contribution would include documentation of supported runtimes and worker setup, along with integration tests covering delayed processing, retries, ordering, worker restart and shutdown, and pending-message preservation across Continue-As-New.
Questions for maintainers
Would you be open to including this adapter in the Fedify monorepo, or would you prefer it to start as a third-party package?
Does this approach fit the intended MessageQueue contract? I'd appreciate feedback on the proposed worker lifecycle and ordering model before implementing it.
AI assistance
ChatGPT (GPT-5.6 Sol) assisted with exploring the technical approach. Codex (GPT-6, with GPT-5.6 Luna assisting repository investigation) reviewed repository materials and drafted this issue.
I provided the use case from byulmaru/kosmo and reviewed the proposal's motivation, terminology, scope, and AI disclosure. The technical analysis and English draft were AI-assisted.