minimal-queue.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930
  1. import { RedisClient } from './connection';
  2. import { Span } from './telemetry';
  3. import { SpanKind } from '../enums/telemetry-attributes';
  4. import { ScriptQueueContext } from './script-queue-context';
  5. export interface MinimalQueue extends ScriptQueueContext {
  6. readonly name: string;
  7. readonly qualifiedName: string;
  8. /**
  9. * Emits an event. Normally used by subclasses to emit events.
  10. *
  11. * @param event - The emitted event.
  12. * @param args -
  13. * @returns
  14. */
  15. emit(event: string | symbol, ...args: any[]): boolean;
  16. on(event: string | symbol, listener: (...args: any[]) => void): this;
  17. removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
  18. waitUntilReady(): Promise<RedisClient>;
  19. /**
  20. * Wraps the code with telemetry and provides a span for configuration.
  21. *
  22. * @param spanKind - kind of the span: Producer, Consumer, Internal
  23. * @param operation - operation name (such as add, process, etc)
  24. * @param destination - destination name (normally the queue name)
  25. * @param callback - code to wrap with telemetry
  26. * @param srcPropagationMetadata -
  27. * @returns
  28. */
  29. trace<T>(spanKind: SpanKind, operation: string, destination: string, callback: (span?: Span, dstPropagationMetadata?: string) => Promise<T> | T, srcPropagationMetadata?: string): Promise<T | Promise<T>>;
  30. }