-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve MockProducerFactory usability by wrapping MockProducer with … #2961
Conversation
…loseSafeMockProducer
@pszymczyk Checkstyle failures in the PR build. Could you fix them? https://github.com/spring-projects/spring-kafka/actions/runs/7251864605/job/19755109702?pr=2961 |
Build is still failing. |
I've executed |
Can you see the output on this build here? https://github.com/spring-projects/spring-kafka/actions/runs/7252844586/job/19758171575 |
I see:
|
Sorry but I have no idea what is wrong with following imports order:
|
spring-kafka/src/main/java/org/springframework/kafka/mock/MockProducerFactory.java
Show resolved
Hide resolved
spring-kafka/src/main/java/org/springframework/kafka/mock/MockProducerFactory.java
Show resolved
Hide resolved
@pszymczyk As a solution to this problem, in your test, you can extend the Discussed this with @artembilan. We will update the testing chapter in the reference docs with these details. |
…CloseSafeMockProducer
Hi
In the current project, I've opted to use the
MockProducer
class and Spring support in the form ofMockProducerFactory
. Unfortunately, it turns out that after the first message is sent,KafkaTemplate
by default closes the providedMockProducer
instance, making it impossible to send another message. I suggest a solution in which the factory wraps the MockProducer in a class that ignores the producer's closing.Best regards,
Pawel