Class KafkaSender.Builder

  • Enclosing class:
    KafkaSender

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

      • topic

        public KafkaSender.Builder topic​(java.lang.String topic)
        Topic zipkin spans will be send to. Defaults to "zipkin"
      • bootstrapServers

        public final KafkaSender.Builder bootstrapServers​(java.lang.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 1000000.
      • overrides

        public final KafkaSender.Builder overrides​(java.util.Map<java.lang.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.MAX_BLOCK_MS_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.