-
Notifications
You must be signed in to change notification settings - Fork 1
/
rabbitmq.module.js
51 lines (51 loc) · 2.27 KB
/
rabbitmq.module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var RabbitMqModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RabbitMqModule = void 0;
const common_1 = require("@nestjs/common");
const rabbitmq_constants_1 = require("./rabbitmq.constants");
const rabbitmq_service_1 = require("./rabbitmq.service");
const rabbitmq_client_provider_1 = require("./rabbitmq-client.provider");
let RabbitMqModule = RabbitMqModule_1 = class RabbitMqModule {
static forRoot(options) {
var _a;
return {
global: (_a = options === null || options === void 0 ? void 0 : options.global) !== null && _a !== void 0 ? _a : true,
module: RabbitMqModule_1,
providers: [
rabbitmq_client_provider_1.createClient(),
{
provide: rabbitmq_constants_1.RABBITMQ_MODULE_OPTIONS,
useValue: options
}
],
exports: [rabbitmq_service_1.RabbitMqService]
};
}
static forRootSync(options) {
var _a;
return {
global: (_a = options === null || options === void 0 ? void 0 : options.global) !== null && _a !== void 0 ? _a : true,
module: RabbitMqModule_1,
providers: [
rabbitmq_client_provider_1.createClient(),
rabbitmq_client_provider_1.createAsyncClientOptions(options),
],
exports: [rabbitmq_service_1.RabbitMqService]
};
}
};
RabbitMqModule = RabbitMqModule_1 = __decorate([
common_1.Global(),
common_1.Module({
providers: [rabbitmq_service_1.RabbitMqService],
exports: [rabbitmq_service_1.RabbitMqService]
})
], RabbitMqModule);
exports.RabbitMqModule = RabbitMqModule;