connect() {
		return new this.broker.Promise((resolve, reject) => {
			let Kafka;
			try {
				Kafka = require("kafka-node");
			} catch (err) {
				/* istanbul ignore next */
				this.broker.fatal(
					"The 'kafka-node' package is missing. Please install it with 'npm install kafka-node --save' command.",
					err,
					true
				);
			}

			this.client = new Kafka.KafkaClient(this.opts.client);

			// Create Producer
			this.producer = new Kafka.Producer(
				this.client,
				this.opts.producer,
				this.opts.customPartitioner
			);
			this.producer.on("ready", () => {
				/* Moved to ConsumerGroup
				// Create Consumer

				this.consumer = new Kafka.Consumer(this.client, this.opts.consumerPayloads || [], this.opts.consumer);

				this.consumer.on("error", e => {
					this.logger.error("Kafka Consumer error", e.message);
					this.logger.debug(e);

					if (!this.connected)
						reject(e);
				});

				this.consumer.on("message", message => {
					const topic = message.topic;
					const cmd = topic.split(".")[1];
					console.log(cmd);
					this.incomingMessage(cmd, message.value);
				});*/

				this.logger.info("Kafka client is connected.");

				this.onConnected().then(resolve);
			});

			/* istanbul ignore next */
			this.producer.on("error", e => {
				this.logger.error("Kafka Producer error", e.message);
				this.logger.debug(e);

				this.broker.broadcastLocal("$transporter.error", {
					error: e,
					module: "transporter",
					type: C.FAILED_PUBLISHER_ERROR
				});

				if (!this.connected) reject(e);
			});
		});
	}
Connect to the server

@memberof KafkaTransporter