mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-27 12:04:56 +02:00
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:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user