Configure Kafka partitioning and keying strategies
masterKafka uses partitions to manage scalability and ordering. logback-kafka-appender allows you to control how log messages are distributed across partitions using different keying strategies.
Key considerations:
- Ordering: Kafka only guarantees read order within a single partition. To ensure messages from a specific source (like a host or thread) stay in order, use a strategy that uses that source as the message key.
- Distribution: Using a key (like
HostNameKeyingStrategy) can lead to uneven distribution across partitions if there are fewer unique keys than partitions. - Fixed Partitioning: You can bypass keying strategies entirely by providing a fixed partition using the
partitionproperty.