Kafka as a target
Use the Kafka Target operator to publish processed Mediation events to a Kafka topic.
Use the Kafka Target operator when you want to publish processed events from a Mediation pipeline into Kafka.
Typical use cases include sending enriched usage records to downstream systems, publishing billing-ready events, streaming data to analytics platforms, and integrating with external applications.
Meter volume limits
Configuration
Configure the following fields for the Kafka Target operator:
Name - Enter a user-defined name for the Kafka target.
Example:
Event Definition - Select the Event Definition that describes the records being published.
Example Event Definition:
Connection - Select the Kafka connection that points to the destination Kafka cluster.
Example:
Topic - Specify the Kafka topic where the target publishes records.
Example:
Data Format - Select how records are serialized before they are written to Kafka:
- JSON publishes JSON messages.
- AVRO publishes Avro messages.
Key Fields - Use Key Fields to define the Kafka message key. Kafka uses the message key to decide which partition receives a record. Records with the same key are routed to the same partition, which helps preserve ordering for related events. When you select multiple key fields, their values are combined in the order selected, with an underscore (_) between the values.
Example: Account-based partitioning
Select accountNumber as the key field.
Input event:
Generated key:
All records for account A100 are routed consistently to the same Kafka partition.
Example: Subscription-based partitioning
Select subscriptionNumber as the key field.
Input event:
Generated key:
All records for subscription S12345 are written to the same partition, preserving event order.
Example: Multiple key fields
Select accountNumber and chargeName as the key fields.
Input event:
Generated key:
Partitioning uses the combined values of both fields.
Example: Kafka target configuration
Input event:
Example Kafka target configuration:
Published Kafka message key:
Published Kafka message value:
Best practices
- Configure Key Fields whenever ordering is important.
- Use stable business identifiers such as
accountNumber,subscriptionNumber, orcustomerId. - Avoid highly repetitive values that may concentrate traffic into a single partition.
- Use the same Data Format expected by downstream consumers.