Skip to content

abdokouta/medusa-event-bus-kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Medusa Medusa

@medusajs/module-event-bus-kafka

An open source composable commerce engine built for developers.

Medusa is released under the MIT license. Current CircleCI build status. PRs welcome! Product Hunt Discord Chat Follow @medusajs

Overview

Kafka Event Bus module for Medusa. When installed, the events system of Medusa is powered by BullMQ and kafkajs. BullMQ is responsible for the message queue and worker. io-kafka is the underlying Kafka client, that BullMQ connects to for events storage.

Getting started

Install the module:

yarn add @medusajs/module-event-bus-kafka

Add the module to your medusa-config.js:

module.exports = {
  // ...
  modules: [
    {
      resolve: "@medusajs/module-event-bus-kafka",
      options: {
        brokers: KAFKA_BROKERS,
        logLevel: KAFKA_LOG_LEVEL,
        retry: {
          retries: KAFKA_RETRIES,
          maxRetryTime: KAFKA_MAX_RETRY_TIME,
          initialRetryTime: KAFKA_INITIAL_RETRY_TIME,
        },
      },
    }
  ],
  // ...
}

Configuration

The module can be configured with the following options:

Option Type Description Default
queueName string? Name of the BullMQ queue. `"events-queue"
queueOptions QueueOptions? Options for configuring the BullMQ queue. See BullMQ's documentation. {}
workerOptions WorkerOptions? Options for configuring the BullMQ worker. {}
brokers string[]? An array of Kafka broker addresses. []
ssl `tls.ConnectionOptions boolean?` SSL options for connecting to Kafka.
sasl SaslOptions? Options for SASL authentication with Kafka. {}
clientId string? Client identifier used for connecting to Kafka. "kafka-client"
connectionTimeout number? Timeout for establishing a connection to Kafka (in milliseconds). 10000
authenticationTimeout number? Timeout for authentication with Kafka (in milliseconds). 10000
reauthenticationThreshold number? Threshold for re-authentication with Kafka (in milliseconds). 3600000
requestTimeout number? Timeout for Kafka request/response operations (in milliseconds). 30000
enforceRequestTimeout boolean? Enforce request timeout, causing requests to fail if they exceed the specified timeout. true
retry RetryOptions? Options for retrying Kafka operations. `{ retries: 5 }
socketFactory ISocketFactory? Custom socket factory for Kafka connections. undefined
logLevel logLevel? Log level for Kafka-related logs. undefined
logCreator logCreator? Custom log creator for Kafka-related logs. undefined

Info: See how the options are applied in the KafkaEventBusService and loader.

If you do not provide a brokers in the module options, the server will fail to start.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published