Skip to content

InMemory-Testing KafkaRecordBatch #1691

Answered by ozangunalp
MandMaric asked this question in Q&A
Discussion options

You must be logged in to vote

InMemoryConnector will directly call your channel method. You need to create instances of KafkaRecordBatch and send them to your channel using the InMemorySource.
As it is the in-memory connector, you can mock everything. You can use IncomingKafkaRecordBatch using ConsumerRecords you want to test and mocked commit and failure handlers as such :

        InMemoryConnector connector;
        KafkaCommitHandler commitHandler; // mock
        KafkaFailureHandler failureHandler; // mock
        ConsumerRecords<K, V> records; ...
        InMemorySource<KafkaRecordBatch<K, V>> kafka = connector.source("kafka");
        IncomingKafkaRecordBatch<K ,V> batch = new IncomingKafkaRecordBatch<>(records, "…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ozangunalp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants