Skip to main content

Sending Messages to Kafka from a Production

InterSystems IRIS becomes a Kafka Producer when an interoperability production includes a business operation that uses the Kafka outbound adapter. This adapter allows the business operation to send messages to a Kafka topic. You have two options when using a production as a Kafka Producer: use a built-in business operation that leverages the outbound adapter or build your own business operation that uses the adapter.

Adapter Details

The Kafka outbound adapter is the class EnsLib.Kafka.OutboundAdapter. It includes the following settings, all of which show up in the Management Portal as settings for the business operation that uses the adapter:

  • Servers defines a comma-separated list of IP address:port entries that identify servers in the Kafka cluster.

  • ClientID defines the Kafka client ID of the Producer.

  • Credentials defines the InterSystems credentials that correspond to the username and password of a Kafka client. For details on creating credentials, see Defining Reusable Items for Use in Settings.

For general information about building a custom business operation that uses an outbound adapter, see Defining Business Operations.

Sending Kafka Messages

The class of the messages sent by the outbound adapter to Kafka is EnsLib.Kafka.Message, which contains the following properties:

  • topic defines the Kafka topic where the Producer is sending messages.

  • value defines the content of the Kafka message.

  • key defines an optional tag for the Kafka message.

The outbound adapter's SendMessage() method takes a EnsLib.Kafka.Message object as its sole argument, and sends that message to the Kafka server. For example, a custom business operation could call the adapter’s method by including the following:

Do ..Adapter.SendMessage(pRequest)

Built-in Business Operation

Rather than building a custom business operation that uses the outbound adapter, you can simply add EnsLib.Kafka.Operation to the production and define the adapter properties using the Management Portal settings. This business operation calls the adapter's SendMessage() method when it receives a request from another business host in the production. This request should contain a Kafka message of type EnsLib.Kafka.Message.

For basic information about adding a business operation to a production, see Adding Business Hosts.

See Also

Feedback