Pass meta to tx and queue (#9695)

+ Pass ctx context via platform queue
+ Fix queue contracts
+ Add meta to tx, skip store.

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2025-08-20 12:13:43 +07:00
committed by GitHub
parent b438971926
commit c27ba3150f
26 changed files with 268 additions and 303 deletions
+3 -2
View File
@@ -5,7 +5,7 @@ import { type ConsumerHandle, type PlatformQueue, type PlatformQueueProducer, ty
* A dummy implementation of PlatformQueueProducer for testing and development
*/
class DummyQueueProducer<T> implements PlatformQueueProducer<T> {
async send (id: WorkspaceUuid | string, msgs: T[]): Promise<void> {
async send (ctx: MeasureContext, id: WorkspaceUuid | string, msgs: T[]): Promise<void> {
await Promise.resolve()
}
@@ -39,7 +39,8 @@ export class DummyQueue implements PlatformQueue {
topic: QueueTopic | string,
groupId: string,
onMessage: (
msg: { workspace: WorkspaceUuid, value: T }[],
ctx: MeasureContext,
msg: { workspace: WorkspaceUuid, value: T },
queue: {
pause: () => void
heartbeat: () => Promise<void>
+3 -3
View File
@@ -29,7 +29,7 @@ export interface ConsumerHandle {
export interface ConsumerMessage<T> {
workspace: WorkspaceUuid
value: T[]
value: T
}
export interface ConsumerControl {
@@ -48,7 +48,7 @@ export interface PlatformQueue {
ctx: MeasureContext,
topic: QueueTopic | string,
groupId: string,
onMessage: (msg: ConsumerMessage<T>[], queue: ConsumerControl) => Promise<void>,
onMessage: (ctx: MeasureContext, msg: ConsumerMessage<T>, queue: ConsumerControl) => Promise<void>,
options?: {
fromBegining?: boolean
}
@@ -71,7 +71,7 @@ export interface PlatformQueue {
* Create a producer for a topic.
*/
export interface PlatformQueueProducer<T> {
send: (workspace: WorkspaceUuid, msgs: T[], partitionKey?: string) => Promise<void>
send: (ctx: MeasureContext, workspace: WorkspaceUuid, msgs: T[], partitionKey?: string) => Promise<void>
close: () => Promise<void>
getQueue: () => PlatformQueue