@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 +1 -1
- package/dist/index.d.ts +32 -5
- package/dist/index.js +523 -76
- package/dist/lib/celery.d.ts +9 -0
- package/dist/lib/celery.js +54 -0
- package/dist/lib/consts.d.ts +1 -0
- package/dist/lib/consts.js +2 -1
- package/dist/lib/types.d.ts +4 -0
- package/dist/lib/utils.d.ts +2 -2
- package/package.json +5 -2
- package/src/index.ts +619 -86
- package/src/lib/celery.ts +89 -0
- package/src/lib/consts.ts +1 -0
- package/src/lib/types.ts +6 -0
- package/src/lib/utils.ts +6 -2
- package/coverage/clover.xml +0 -7
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -212
- package/coverage/lcov-report/index.html +0 -60
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -1
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -158
- package/coverage/lcov.info +0 -0
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
|
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';
|