com.soento.logback.kafka.keying.HostNameKeyingStrategy Maven / Gradle / Ivy
package com.soento.logback.kafka.keying;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.spi.ContextAwareBase;
import ch.qos.logback.core.spi.LifeCycle;
import java.nio.ByteBuffer;
/**
* This strategy uses the HOSTNAME as kafka message key.
* This is useful because it ensures that all log messages issued by this host will remain in the correct order for any consumer.
* But this strategy can lead to uneven log distribution for a small number of hosts (compared to the number of partitions).
* @since 0.0.1
*/
public class HostNameKeyingStrategy extends ContextAwareBase implements KeyingStrategy