queue-options.d.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import { AdvancedRepeatOptions } from './advanced-options';
  2. import { DefaultJobOptions } from './base-job-options';
  3. import { ConnectionOptions } from './redis-options';
  4. import { Telemetry } from './telemetry';
  5. export declare enum ClientType {
  6. blocking = "blocking",
  7. normal = "normal"
  8. }
  9. /**
  10. * Base Queue options
  11. */
  12. export interface QueueBaseOptions {
  13. /**
  14. * Options for connecting to a Redis instance.
  15. */
  16. connection: ConnectionOptions;
  17. /**
  18. * Denotes commands should retry indefinitely.
  19. * @deprecated not in use anymore.
  20. */
  21. blockingConnection?: boolean;
  22. /**
  23. * Prefix for all queue keys.
  24. */
  25. prefix?: string;
  26. /**
  27. * Avoid version validation to be greater or equal than v5.0.0.
  28. * @defaultValue false
  29. */
  30. skipVersionCheck?: boolean;
  31. /**
  32. * Telemetry client
  33. */
  34. telemetry?: Telemetry;
  35. /**
  36. * Skip waiting for connection ready.
  37. *
  38. * In some instances if you want the queue to fail fast if the connection is
  39. * not ready you can set this to true. This could be useful for testing and when
  40. * adding jobs via HTTP endpoints for example.
  41. *
  42. */
  43. skipWaitingForReady?: boolean;
  44. }
  45. /**
  46. * Options for the Queue class.
  47. */
  48. export interface QueueOptions extends QueueBaseOptions {
  49. defaultJobOptions?: DefaultJobOptions;
  50. /**
  51. * Options for the streams used internally in BullMQ.
  52. */
  53. streams?: {
  54. /**
  55. * Options for the events stream.
  56. */
  57. events: {
  58. /**
  59. * Max approximated length for streams. Default is 10 000 events.
  60. */
  61. maxLen: number;
  62. };
  63. };
  64. /**
  65. * Skip Meta update.
  66. *
  67. * If true, the queue will not update the metadata of the queue.
  68. * Useful for read-only systems that do should not update the metadata.
  69. *
  70. * @defaultValue false
  71. */
  72. skipMetasUpdate?: boolean;
  73. /**
  74. * Advanced options for the repeatable jobs.
  75. */
  76. settings?: AdvancedRepeatOptions;
  77. }
  78. /**
  79. * Options for the Repeat class.
  80. */
  81. export interface RepeatBaseOptions extends QueueBaseOptions {
  82. settings?: AdvancedRepeatOptions;
  83. }
  84. /**
  85. * Options for QueueEvents
  86. */
  87. export interface QueueEventsOptions extends Omit<QueueBaseOptions, 'telemetry'> {
  88. /**
  89. * Condition to start listening to events at instance creation.
  90. */
  91. autorun?: boolean;
  92. /**
  93. * Last event Id. If provided it is possible to continue
  94. * consuming events from a known Id instead of from the last
  95. * produced event.
  96. */
  97. lastEventId?: string;
  98. /**
  99. * Timeout for the blocking XREAD call to the events stream.
  100. */
  101. blockingTimeout?: number;
  102. }
  103. /**
  104. * Options for QueueEventsProducer
  105. */
  106. export type QueueEventsProducerOptions = Omit<QueueBaseOptions, 'telemetry'>;