/** * Returns the configured Kafka consumer group id. * @return group id */ @Override public String groupId() { return (String) consumerProperty(ConsumerConfig.GROUP_ID_CONFIG); }
/** * Returns the configured heartbeat interval for Kafka consumer. * @return heartbeat interval duration */ @Override public Duration heartbeatInterval() { long defaultValue = 3000; // Kafka default long heartbeatIntervalMs = getLongOption(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, defaultValue); return Duration.ofMillis(heartbeatIntervalMs); }
/** * Creates an options instance with default properties. * @return new instance of receiver options */ @NonNull static <K, V> ReceiverOptions<K, V> create() { return new MutableReceiverOptions<>(); }
/** * Creates an options instance with default properties. * @return new instance of receiver options */ @NonNull static <K, V> ReceiverOptions<K, V> create() { return new MutableReceiverOptions<>(); }
/** * Creates an options instance with the specified config overrides for {@link KafkaConsumer}. * @return new instance of receiver options */ @NonNull static <K, V> ReceiverOptions<K, V> create(@NonNull Map<String, Object> configProperties) { return new MutableReceiverOptions<>(configProperties); }
/** * Returns the configured Kafka consumer group id. * @return group id */ @Override public String groupId() { return (String) consumerProperty(ConsumerConfig.GROUP_ID_CONFIG); }
/** * Returns the configured heartbeat interval for Kafka consumer. * @return heartbeat interval duration */ @Override public Duration heartbeatInterval() { long defaultValue = 3000; // Kafka default long heartbeatIntervalMs = getLongOption(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, defaultValue); return Duration.ofMillis(heartbeatIntervalMs); }
/** * Creates an options instance with the specified config overrides for {@link KafkaConsumer}. * @return new instance of receiver options */ @NonNull static <K, V> ReceiverOptions<K, V> create(@NonNull Properties configProperties) { return new MutableReceiverOptions<>(configProperties); }
private long getLongOption(String optionName, long defaultValue) { Objects.requireNonNull(optionName); Object value = consumerProperty(optionName); long optionValue = 0; if (value != null) { if (value instanceof Long) optionValue = (Long) value; else if (value instanceof String) optionValue = Long.parseLong((String) value); else throw new ConfigException("Invalid value " + value); } else optionValue = defaultValue; return optionValue; } }
/** * Creates an options instance with the specified config overrides for {@link KafkaConsumer}. * @return new instance of receiver options */ @NonNull static <K, V> ReceiverOptions<K, V> create(@NonNull Map<String, Object> configProperties) { return new MutableReceiverOptions<>(configProperties); }
private long getLongOption(String optionName, long defaultValue) { Objects.requireNonNull(optionName); Object value = consumerProperty(optionName); long optionValue = 0; if (value != null) { if (value instanceof Long) optionValue = (Long) value; else if (value instanceof String) optionValue = Long.parseLong((String) value); else throw new ConfigException("Invalid value " + value); } else optionValue = defaultValue; return optionValue; } }
/** * Creates an options instance with the specified config overrides for {@link KafkaConsumer}. * @return new instance of receiver options */ @NonNull static <K, V> ReceiverOptions<K, V> create(@NonNull Properties configProperties) { return new MutableReceiverOptions<>(configProperties); }