use of org.apache.camel.impl.MemoryStateRepository in project camel by apache.
the class KafkaConsumerOffsetRepositoryResumeTest method doPreSetup.
@Override
protected void doPreSetup() throws Exception {
Properties props = getDefaultProperties();
producer = new org.apache.kafka.clients.producer.KafkaProducer<>(props);
// Create the topic with 2 partitions + send 10 messages (5 in each partitions)
kafkaBroker.createTopic(TOPIC, 2);
for (int i = 0; i < 10; i++) {
producer.send(new ProducerRecord<>(TOPIC, i % 2, "key", "message-" + i));
}
// Create the state repository with some initial offsets
stateRepository = new MemoryStateRepository();
stateRepository.setState(TOPIC + "/0", "2");
stateRepository.setState(TOPIC + "/1", "3");
}
use of org.apache.camel.impl.MemoryStateRepository in project camel by apache.
the class KafkaConsumerOffsetRepositoryEmptyTest method doPreSetup.
// FIXME lifecycle issue here
@Override
protected void doPreSetup() throws Exception {
// Create the topic with 2 partitions + send 10 messages (5 in each partitions)
kafkaBroker.createTopic(TOPIC, 2);
Properties props = getDefaultProperties();
producer = new org.apache.kafka.clients.producer.KafkaProducer<>(props);
for (int i = 0; i < 10; i++) {
producer.send(new ProducerRecord<>(TOPIC, i % 2, "key", "message-" + i));
}
stateRepository = new MemoryStateRepository();
}
Aggregations