1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.ServerFactory = void 0;
|
4 | const transport_enum_1 = require("../enums/transport.enum");
|
5 | const server_grpc_1 = require("./server-grpc");
|
6 | const server_kafka_1 = require("./server-kafka");
|
7 | const server_mqtt_1 = require("./server-mqtt");
|
8 | const server_nats_1 = require("./server-nats");
|
9 | const server_redis_1 = require("./server-redis");
|
10 | const server_tcp_1 = require("./server-tcp");
|
11 | const server_rmq_1 = require("./server-rmq");
|
12 | class ServerFactory {
|
13 | static create(microserviceOptions) {
|
14 | const { transport, options } = microserviceOptions;
|
15 | switch (transport) {
|
16 | case transport_enum_1.Transport.REDIS:
|
17 | return new server_redis_1.ServerRedis(options);
|
18 | case transport_enum_1.Transport.NATS:
|
19 | return new server_nats_1.ServerNats(options);
|
20 | case transport_enum_1.Transport.MQTT:
|
21 | return new server_mqtt_1.ServerMqtt(options);
|
22 | case transport_enum_1.Transport.GRPC:
|
23 | return new server_grpc_1.ServerGrpc(options);
|
24 | case transport_enum_1.Transport.KAFKA:
|
25 | return new server_kafka_1.ServerKafka(options);
|
26 | case transport_enum_1.Transport.RMQ:
|
27 | return new server_rmq_1.ServerRMQ(options);
|
28 | default:
|
29 | return new server_tcp_1.ServerTCP(options);
|
30 | }
|
31 | }
|
32 | }
|
33 | exports.ServerFactory = ServerFactory;
|