embedded-kafka | A library that provides an in-memory Kafka instance to run | Pub Sub library
kandi X-RAY | embedded-kafka Summary
kandi X-RAY | embedded-kafka Summary
A library that provides an in-memory Kafka instance to run your tests against.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of embedded-kafka
embedded-kafka Key Features
embedded-kafka Examples and Code Snippets
Community Discussions
Trending Discussions on embedded-kafka
QUESTION
I am trying to implement non-blocking retries for my project using spring-kafka 2.8.0 with non-blocking retry feature.
I have done the following. autoCreateTopics property is false!
...ANSWER
Answered 2021-Dec-08 at 20:47No autoCreateTopics = "false"
simply means that the framework will not create the topics; it has no bearing on whether the broker is configured to create them.
@EmbeddedKafka(topics = ...)
will always create the topics.
To disable topic creation in the embedded kafka broker, use
@EmbeddedKafka(brokerProperties = "auto.create.topics.enable:false")
and don't specify any topics
there.
Or you can set the consumer property allow.auto.create.topics
to false
; it overrides the broker property (if it is true).
https://kafka.apache.org/documentation/#consumerconfigs_allow.auto.create.topics
QUESTION
when I run my tests in Intellij idea choosing code coverage tool as JaCoCo and include my packages I see I get 80% above coverage in the report but when I run it using maven command line I get 0% in JaCoCo report below are two questions.
can I see what command Intellij Idea Ultimate version is using to run my unit tests with code coverage ?
Why my maven command mvn clean test jacoco:report is showing my coverage percentage as 0%.
This is a Scala maven project.
My POM.xml file:-
...ANSWER
Answered 2021-Feb-03 at 22:16Assuming that you are using JaCoCo with cobertura coverage you need to declare the dependencies and the plugin to run the command mvn cobertura:cobertura
.
QUESTION
I am using fs2-kafka to read from embedded-kafka.
I create the embedded kafka using withRunningKafkaOnFoundPort
, create topic and publish a few messages. However when I try to read it back with fs2-kafka I get a NullPointerException. I have isolated a test case and the code is below.
Here is my code:
...ANSWER
Answered 2020-Jul-01 at 15:31Turns out the problem is that the key type in ConsumerSettings[IO, String, String]
is String
but embedded-kafka writes Null
as a key, so on deserializing the key it fails with NullPointerException. Setting key type to Unit
solves the problem with exception.
Another problem is that withRunningKafkaOnFoundPort
finished before the evaluation of the IO starts. To have it running it is needed to make a Resource
from embedded-kafka and wrap the IO into that.
QUESTION
I implemented a bunch of integration tests using EmbededKafka to test one of our Kafka streams application running using spring-kafka framework.
The stream application is reading a message from a Kafka topic, it stores it into an internal state store, does some transformation and sends it to another micro service into a requested topic. When the response comes back into the responded topic it retrieves the original message from the state store and depending on some business logic it forwards it to one of our downstream systems, each one having their own topic.
The integration tests just exercise the various permutations of the business conditions.
Initially the tests were split across to classes. When running the build the tests from one class were clashing with the ones in the other class with some conflict exceptions. I did not spend too much time on this and just moved all tests inside the same class. This fixed my issue with all tests passing either from gradle build or from intelij EDI.
Here is the test:
...ANSWER
Answered 2020-Jun-16 at 14:31Do not use a fixed port ports = 9092,
- by default the embedded kafka will listen on a random port selected by the operating system.
You should use that for your test cases.
You can get the broker addresses by calling this.kafkaBroker.getBrokersAsString()
.
QUESTION
When upgrading from KafkaStreams library from 2.3 to 2.5, keeping the same Scala version, it breaks when running with the following error:
...ANSWER
Answered 2020-Jun-16 at 11:10I just had to upgrade my Scala version to the one published in the "Compiled Dependencies" section here, which is:
QUESTION
I have one MicroService who sends to another microservice message that should consume.
So, the kafka configs works, and everything works, but I need to create one intregration test for this code, and I have no idea how.
My KafkaConsumer.Class anothed with component anottation:
...ANSWER
Answered 2020-Jan-21 at 07:39Since you are using an embedded Kafka broker you could simply produce/consume the desired topic(s) from within your integration test.
Consuming
Consuming can be done via a simple jUnit rule. A rule serving this purpose can be found here. Feel free to use it.
You can use it like this to assert consumed messages:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install embedded-kafka
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page