72
72
import static com .codahale .metrics .MetricRegistry .name ;
73
73
74
74
public class KafkaTransport extends ThrottleableTransport {
75
- public static final String GROUP_ID = "graylog2" ;
76
75
public static final String CK_FETCH_MIN_BYTES = "fetch_min_bytes" ;
77
76
public static final String CK_FETCH_WAIT_MAX = "fetch_wait_max" ;
78
77
public static final String CK_ZOOKEEPER = "zookeeper" ;
79
78
public static final String CK_TOPIC_FILTER = "topic_filter" ;
80
79
public static final String CK_THREADS = "threads" ;
81
80
public static final String CK_OFFSET_RESET = "offset_reset" ;
81
+ public static final String CK_GROUP_ID = "group_id" ;
82
82
83
83
// See https://kafka.apache.org/090/documentation.html for available values for "auto.offset.reset".
84
84
private static final ImmutableMap <String , String > OFFSET_RESET_VALUES = ImmutableMap .of (
@@ -87,6 +87,7 @@ public class KafkaTransport extends ThrottleableTransport {
87
87
);
88
88
89
89
private static final String DEFAULT_OFFSET_RESET = "largest" ;
90
+ private static final String DEFAULT_GROUP_ID = "graylog2" ;
90
91
91
92
private static final Logger LOG = LoggerFactory .getLogger (KafkaTransport .class );
92
93
@@ -185,7 +186,7 @@ public void run() {
185
186
186
187
final Properties props = new Properties ();
187
188
188
- props .put ("group.id" , GROUP_ID );
189
+ props .put ("group.id" , configuration . getString ( CK_GROUP_ID , DEFAULT_GROUP_ID ) );
189
190
props .put ("client.id" , "gl2-" + nodeId + "-" + input .getId ());
190
191
191
192
props .put ("fetch.min.bytes" , String .valueOf (configuration .getInt (CK_FETCH_MIN_BYTES )));
@@ -382,6 +383,13 @@ public ConfigurationRequest getRequestedConfiguration() {
382
383
"What to do when there is no initial offset in ZooKeeper or if an offset is out of range" ,
383
384
ConfigurationField .Optional .OPTIONAL ));
384
385
386
+ cr .addField (new TextField (
387
+ CK_GROUP_ID ,
388
+ "Consumer group id" ,
389
+ DEFAULT_GROUP_ID ,
390
+ "Name of the consumer group the Kafka input belongs to" ,
391
+ ConfigurationField .Optional .OPTIONAL ));
392
+
385
393
return cr ;
386
394
}
387
395
}
0 commit comments