Class KafkaSender.Builder

  • Enclosing class:
    KafkaSender

    public static final class KafkaSender.Builder
    extends Object
    Configuration including defaults needed to send spans to a Kafka topic.
    • Method Detail

      • bootstrapServers

        public final KafkaSender.Builder bootstrapServers​(String bootstrapServers)
        Initial set of kafka servers to connect to, rest of cluster will be discovered (comma separated). Ex "192.168.99.100:9092" No default
        See Also:
        ProducerConfig.BOOTSTRAP_SERVERS_CONFIG
      • messageMaxBytes

        public KafkaSender.Builder messageMaxBytes​(int messageMaxBytes)
        Maximum size of a message. Must be equal to or less than the server's "message.max.bytes". Default 500KB.
      • overrides

        public KafkaSender.Builder overrides​(Map<String,​?> overrides)
        By default, a producer will be created, targeted to bootstrapServers(String) with 0 required acks. Any properties set here will affect the producer config.

        For example: Reduce the timeout blocking from one minute to 5 seconds.

        
         Map<String, String> overrides = new LinkedHashMap<>();
         overrides.put(ProducerConfig.METADATA_FETCH_TIMEOUT_CONFIG, "5000");
         builder.overrides(overrides);
         
        See Also:
        ProducerConfig
      • encoding

        public KafkaSender.Builder encoding​(zipkin2.codec.Encoding encoding)
        Use this to change the encoding used in messages. Default is Encoding.JSON

        Note: If ultimately sending to Zipkin, version 2.8+ is required to process protobuf.