@autofleet/rabbit 3.4.0-beta--beta--0.0 → 3.4.0-beta.0
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/dist/index.d.ts +17 -14
- package/dist/index.js +137 -129
- package/dist/lib/consts.d.ts +0 -2
- package/dist/lib/consts.js +1 -3
- package/dist/lib/types.d.ts +8 -0
- package/package.json +1 -1
- package/src/index.ts +165 -146
- package/src/lib/consts.ts +0 -2
- package/src/lib/types.ts +9 -0
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +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, AssertExchangePromisesDictionary } from './lib/types';
|
|
7
|
-
import { TaskData } from './lib/celery';
|
|
6
|
+
import { CallbackFunction, ConsumeMessageOrNull, ConsumeOptions, CustomMessageHeaders, QueuesCache, RedisLockType, ExchangesCache, QueueSetupPromisesDictionary, AssertExchangePromisesDictionary, ConnectionData } from './lib/types';
|
|
8
7
|
export interface IAfRabbitMq {
|
|
9
8
|
ack: any;
|
|
10
9
|
nack: any;
|
|
@@ -38,10 +37,12 @@ type newChannelOpts = {
|
|
|
38
37
|
name?: string;
|
|
39
38
|
onClose?: null | ((args: any | null) => void);
|
|
40
39
|
options?: CreateChannelOpts | undefined;
|
|
40
|
+
connection: ConnectionData;
|
|
41
41
|
};
|
|
42
42
|
type assertChannelOpts = {
|
|
43
43
|
channelName?: string;
|
|
44
44
|
force?: boolean;
|
|
45
|
+
connection: ConnectionData;
|
|
45
46
|
};
|
|
46
47
|
declare class RabbitMq implements IAfRabbitMq {
|
|
47
48
|
static parseMsg(msg: any): any;
|
|
@@ -58,10 +59,12 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
58
59
|
};
|
|
59
60
|
DISCONNECT_MSG: string;
|
|
60
61
|
RECONNECT_MSG: string;
|
|
61
|
-
|
|
62
|
+
publishChannel: ChannelWrapper | null;
|
|
62
63
|
publishChannelSetupPromise: Promise<ChannelWrapper> | null;
|
|
63
64
|
blockReconnect: boolean | null | undefined;
|
|
64
65
|
connection: AmqpConnectionManager | null | undefined;
|
|
66
|
+
publishConnection: ConnectionData;
|
|
67
|
+
consumeConnection: ConnectionData;
|
|
65
68
|
em: EventEmitter;
|
|
66
69
|
creatingConnection: boolean;
|
|
67
70
|
exchanges: ExchangesCache;
|
|
@@ -76,10 +79,11 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
76
79
|
private consumers;
|
|
77
80
|
private doesVHostExist;
|
|
78
81
|
private vhost;
|
|
79
|
-
|
|
82
|
+
oldPublishChannel: ChannelWrapper | null;
|
|
80
83
|
oldPublishChannelSetupPromise: Promise<ChannelWrapper> | null;
|
|
81
84
|
oldBlockReconnect: boolean | null | undefined;
|
|
82
|
-
|
|
85
|
+
oldPublishConnection: ConnectionData;
|
|
86
|
+
oldConsumeConnection: ConnectionData;
|
|
83
87
|
oldEm: EventEmitter;
|
|
84
88
|
oldCreatingConnection: boolean;
|
|
85
89
|
oldExchanges: ExchangesCache;
|
|
@@ -93,10 +97,10 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
93
97
|
private shouldConsumeMessageByTimestamp;
|
|
94
98
|
ack: (channel: ConfirmChannel, msg: ConsumeMessageOrNull, shouldUpdateRedisTimestamp?: boolean, releaseLock?: null) => (userMsg: ConsumeMessage) => Promise<any>;
|
|
95
99
|
nack: (channel: ConfirmChannel, queue: string, options: any, deadQueueOptions: Options.AssertQueue, msg: ConsumeMessageOrNull, releaseLock: any) => (userMsg: ConsumeMessageOrNull, { skipRetry, }?: NackOptions) => Promise<any>;
|
|
96
|
-
getConnection(): Promise<AmqpConnectionManager>;
|
|
97
|
-
getNewChannel({ name, onClose, options }
|
|
98
|
-
assertChannel({ force }
|
|
99
|
-
assertExchange(exchangeName: string,
|
|
100
|
+
getConnection(connection: ConnectionData): Promise<AmqpConnectionManager>;
|
|
101
|
+
getNewChannel({ name, onClose, options, connection, }: newChannelOpts): Promise<ChannelWrapper>;
|
|
102
|
+
assertChannel({ force, connection }: assertChannelOpts): Promise<ChannelWrapper>;
|
|
103
|
+
assertExchange(exchangeName: string, connection: ConnectionData): Promise<any>;
|
|
100
104
|
getQueueLength(queue: string): Promise<Replies.AssertQueue>;
|
|
101
105
|
private deleteQueue;
|
|
102
106
|
bindQueue(queue: string, exchange: string): Promise<void>;
|
|
@@ -113,18 +117,17 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
113
117
|
consumeFromExchange(queue: string, exchange: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any>;
|
|
114
118
|
publish(exchange: string, content: any, customHeaders?: any): Promise<boolean>;
|
|
115
119
|
sendToQueue(queue: string, content: any, options?: any, customHeaders?: any): Promise<boolean | undefined>;
|
|
116
|
-
sendToCeleryQueue(data: TaskData, taskName: string, queueName: string): Promise<boolean | undefined>;
|
|
117
120
|
isConnected(): Promise<boolean>;
|
|
118
121
|
gracefulShutdown(signal: string): Promise<void>;
|
|
119
122
|
private consumeFromRabbitOld;
|
|
120
|
-
getNewChannelOld({ name, onClose, options }
|
|
121
|
-
getConnectionOld(): Promise<AmqpConnectionManager>;
|
|
123
|
+
getNewChannelOld({ name, onClose, options, connection, }: newChannelOpts): Promise<ChannelWrapper>;
|
|
124
|
+
getConnectionOld(connection: ConnectionData): Promise<AmqpConnectionManager>;
|
|
122
125
|
private saveConsumerOld;
|
|
123
126
|
assertQueueOld(queueName: string, options?: Options.AssertQueue): Promise<any>;
|
|
124
127
|
setupQueueOld(queueName: string, options?: Options.AssertQueue): Promise<Replies.AssertQueue>;
|
|
125
|
-
assertChannelOld({ force }
|
|
128
|
+
assertChannelOld({ force, connection }: assertChannelOpts): Promise<ChannelWrapper>;
|
|
126
129
|
private deleteQueueOld;
|
|
127
|
-
assertExchangeOld(exchangeName: string,
|
|
130
|
+
assertExchangeOld(exchangeName: string, connection: ConnectionData): Promise<any>;
|
|
128
131
|
}
|
|
129
132
|
export default RabbitMq;
|
|
130
133
|
export { sendCeleryTaskViaHttp, } from './lib/celery';
|