Derivatives of KafkaProducerService
KafkaProducerService
lets publishing messages/records onto Kafka
topics. Following are the specialized types available for creating Kafka publisher service –
-
com.hcl.unica.system.integration.service.kafka.AbstractKafkaProducerService<K, V>
The type parameter K & V represents the key & value of the message to be sent onto target Kafka topic. Refer thecom.example.service.kafka.events.producer.ExampleKafkaProducerService from asset-integration-starter
project for a typical service definition. In addition to declaring type arguments, this service must implement thegetServiceInterface()
method to be able to invoke Kafka producer service programmatically. Apart from these declarations,AbstractKafkaProducerService
requires no other business logic.
Platform configuration
Parameter | Description |
{service-name}.kafka.topics | Comma separated list of target topic names. |
{service-name}.kafka.topics.{topic-name}.value.format | Expected message format. Supported formats are Avro & Json. |
{service-name}.kafka.batch.size | Same as standard batch.size property used for Apache Kafka producers. |
{service-name}. kafka.linger.ms | Same as standard linger.ms property used for Apache Kafka producers. |
{service-name} represents the name of service declared in custom-plugin-services.yml file.
For example,
message-publisher-service.kafka.topics: topic1, topic2
message-publisher-service.kafka.topics.topic1.value.format: Json
message-publisher-service.kafka.topics.topic2.value.format: Avro
message-publisher-service.kafka.batch.size: 16900
message-publisher-service.kafka.linger.ms: 10
Invocation of KafkaProducerService
Content Integration Framework does not directly invoke any Kafka producer service. Plugin
can define & use such service if required. Refer
com.example.service.client.ExampleKafkaProducerClient
from
asset-integration-starter
project to get clarity on how already
defined Kafka producer service can be invoked from inside any other service. By default,
Content Integration Framework publishes the message onto the topic configured in
Platform configuration. As demonstrated in ExampleKafkaProducerClient
,
it is important to note that, caller of the service can completely override the target
topic specifications if required.