use of org.apache.kafka.clients.consumer.ConsumerRecords in project ksql by confluentinc.
the class KsqlEngineMetricsTest method consumeMessages.
private void consumeMessages(final int numMessages, final String groupId) {
final ConsumerCollector collector1 = new ConsumerCollector();
collector1.configure(ImmutableMap.of(ConsumerConfig.GROUP_ID_CONFIG, groupId, KsqlConfig.KSQL_INTERNAL_METRIC_COLLECTORS_CONFIG, metricCollectors));
final Map<TopicPartition, List<ConsumerRecord<Object, Object>>> records = new HashMap<>();
final List<ConsumerRecord<Object, Object>> recordList = new ArrayList<>();
for (int i = 0; i < numMessages; i++) {
recordList.add(new ConsumerRecord<>("foo", 1, 1, 1L, TimestampType.CREATE_TIME, 10, 10, "key", "1234567890", new RecordHeaders(), Optional.empty()));
}
records.put(new TopicPartition("foo", 1), recordList);
final ConsumerRecords<Object, Object> consumerRecords = new ConsumerRecords<>(records);
collector1.onConsume(consumerRecords);
}
Aggregations