@autofleet/rabbit 3.3.0-beta.0 → 3.3.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v20
1
+ v22.9.0
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
3
3
  import { AmqpConnectionManager, ChannelWrapper, CreateChannelOpts } from 'amqp-connection-manager';
4
4
  import { ConfirmChannel, ConsumeMessage, Options, Replies } from 'amqplib';
5
5
  import { RedisConfig } from './lib/redis';
6
- import { CallbackFunction, ConsumeMessageOrNull, ConsumeOptions, CustomMessageHeaders, QueuesCache, RedisLockType, ExchangesCache, QueueSetupPromisesDictionary } from './lib/types';
6
+ import { CallbackFunction, ConsumeMessageOrNull, ConsumeOptions, CustomMessageHeaders, QueuesCache, RedisLockType, ExchangesCache, QueueSetupPromisesDictionary, AssertExchangePromisesDictionary } from './lib/types';
7
7
  export interface IAfRabbitMq {
8
8
  ack: any;
9
9
  nack: any;
@@ -32,8 +32,6 @@ export interface AfRabbitOptions {
32
32
  */
33
33
  dontRetryAssert?: boolean;
34
34
  rabbitHost?: string;
35
- serviceName: string;
36
- podIp?: string;
37
35
  }
38
36
  type newChannelOpts = {
39
37
  name?: string;
@@ -60,21 +58,37 @@ declare class RabbitMq implements IAfRabbitMq {
60
58
  DISCONNECT_MSG: string;
61
59
  RECONNECT_MSG: string;
62
60
  channel: ChannelWrapper | null;
61
+ publishChannelSetupPromise: Promise<ChannelWrapper> | null;
63
62
  blockReconnect: boolean | null | undefined;
64
63
  connection: AmqpConnectionManager | null | undefined;
65
64
  em: EventEmitter;
66
- podId: string;
67
65
  creatingConnection: boolean;
68
66
  exchanges: ExchangesCache;
69
67
  queues: QueuesCache;
70
68
  queueSetupPromises: QueueSetupPromisesDictionary;
69
+ assertExchangePromises: AssertExchangePromisesDictionary;
71
70
  options: AfRabbitOptions | undefined;
72
71
  redisClient: any;
73
72
  redisLock?: RedisLockType;
74
73
  /** Array of consumers tags used for canceling consumption */
75
74
  consumersTags: Array<[ConfirmChannel, string]>;
76
75
  private consumers;
76
+ private doesVHostExist;
77
+ private vhost;
78
+ oldChannel: ChannelWrapper | null;
79
+ oldPublishChannelSetupPromise: Promise<ChannelWrapper> | null;
80
+ oldBlockReconnect: boolean | null | undefined;
81
+ oldConnection: AmqpConnectionManager | null | undefined;
82
+ oldEm: EventEmitter;
83
+ oldCreatingConnection: boolean;
84
+ oldExchanges: ExchangesCache;
85
+ oldQueues: QueuesCache;
86
+ oldQueueSetupPromises: QueueSetupPromisesDictionary;
87
+ oldAssertExchangePromises: AssertExchangePromisesDictionary;
88
+ oldConsumersTags: Array<[ConfirmChannel, string]>;
89
+ private oldConsumers;
77
90
  constructor(options?: AfRabbitOptions, redisConfig?: RedisConfig);
91
+ private assertVHost;
78
92
  private shouldConsumeMessageByTimestamp;
79
93
  ack: (channel: ConfirmChannel, msg: ConsumeMessageOrNull, shouldUpdateRedisTimestamp?: boolean, releaseLock?: null) => (userMsg: ConsumeMessage) => Promise<any>;
80
94
  nack: (channel: ConfirmChannel, queue: string, options: any, deadQueueOptions: Options.AssertQueue, msg: ConsumeMessageOrNull, releaseLock: any) => (userMsg: ConsumeMessageOrNull, { skipRetry, }?: NackOptions) => Promise<any>;
@@ -86,16 +100,29 @@ declare class RabbitMq implements IAfRabbitMq {
86
100
  private deleteQueue;
87
101
  bindQueue(queue: string, exchange: string): Promise<void>;
88
102
  setupQueue(queueName: string, options?: Options.AssertQueue): Promise<Replies.AssertQueue>;
103
+ static shouldUseQuorum(queueName: string): boolean;
89
104
  assertQueue(queueName: string, options?: Options.AssertQueue): Promise<any>;
90
105
  private saveConsumer;
91
106
  consume(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any>;
107
+ consumeNew(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any>;
108
+ consumeOld(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any>;
92
109
  private lockRedisIfNeeded;
93
110
  private unlockRedisIfNeeded;
94
111
  private consumeFromRabbit;
95
112
  consumeFromExchange(queue: string, exchange: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any>;
96
113
  publish(exchange: string, content: any, customHeaders?: any): Promise<boolean>;
97
- sendToQueue(queue: string, content: any, options?: any, customHeaders?: any, isBlocking?: boolean): Promise<boolean | undefined>;
114
+ sendToQueue(queue: string, content: any, options?: any, customHeaders?: any): Promise<boolean | undefined>;
98
115
  isConnected(): Promise<boolean>;
99
116
  gracefulShutdown(signal: string): Promise<void>;
117
+ private consumeFromRabbitOld;
118
+ getNewChannelOld({ name, onClose, options }?: newChannelOpts): Promise<ChannelWrapper>;
119
+ getConnectionOld(): Promise<AmqpConnectionManager>;
120
+ private saveConsumerOld;
121
+ assertQueueOld(queueName: string, options?: Options.AssertQueue): Promise<any>;
122
+ setupQueueOld(queueName: string, options?: Options.AssertQueue): Promise<Replies.AssertQueue>;
123
+ assertChannelOld({ force }?: assertChannelOpts): Promise<ChannelWrapper>;
124
+ private deleteQueueOld;
125
+ assertExchangeOld(exchangeName: string, options?: any): Promise<any>;
100
126
  }
101
127
  export default RabbitMq;
128
+ export { sendCeleryTaskViaHttp, } from './lib/celery';