Skip to main content

Create Message Broker Client Options Factory

Description

Creates the client options of the message broker.

This event does NOTHING by default. All of the logic is handled by the broker-kafka plugin https://github.com/amplication/plugins/tree/master/plugins/broker-kafka

Event Name

CreateMessageBrokerClientOptionsFactory

Event Params

There are no additional params to this event

export interface CreateMessageBrokerClientOptionsFactoryParams
extends EventParams {}

Example:

  async afterCreateMessageBrokerClientOptionsFactory(
context: DsgContext,
eventParams: CreateMessageBrokerClientOptionsFactoryParams,
modules: ModuleMap
): Promise<ModuleMap> {
const { serverDirectories } = context;
const filePath = resolve(staticDirectory, "generateKafkaClientOptions.ts");
const file = await readFile(filePath, "utf8");
const generateFileName = "generateKafkaClientOptions.ts";

const path = join(
serverDirectories.messageBrokerDirectory,
generateFileName
);
modules.set({ code: file, path });
return modules;
}