-
Notifications
You must be signed in to change notification settings - Fork 186
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
Kafka Component Writing Messages with ProducerTemplate #743
Comments
You should not create a new producer template per request, see the FAQ |
You can inject the ProducerTemplate as we do e.g. here https://github.com/apache/camel-quarkus/blob/1.0.0-M3/integration-tests/base64/src/main/java/org/apache/camel/quarkus/component/base64/it/Base64Resource.java#L39-L40 |
Changed it to Injection, but the same problem still appears. Just trying to send 200 Messages and it gets stuck on the 46th message. |
Small Update: Our Project is combined with Quarkus and the project build as a Native Image does not have this Problem. As a Jar this error always happens. |
@bframke would it be possible to isolate the issue in a pure java/camel project ? |
I try to do that. |
Okay, so I build a basic JavaApplication with Camel Dependencies and sending 1000 messages via producerTemplate is not a problem. |
So not using RestEasy Endpoint to send the messages via ProducerTemplate does also work in the Quarkus Application |
I was about to suggest to remove resteasy, mind opening an issue on quarkus and reference this one ? |
Just created an issue there. |
noticed that the example provided there has a loop inside the |
Thanks, that was the left overs of a test 👍 |
Made another test with REST-DSL and Netty-Http, both are the components from Camel and it also works fine. So calling a RESTEasy Endpoint to create one Route and then call the created Camel Route works also. |
Trying to use it with "from" and a "processor" for the message and a "to" to the kafka it gets stuck. With "rest", "post", "consumes", "to" kafka it works, but then we have no processor available for our messages. |
Okay "from" and "rest" combined also works without a problem. edit: okay, now it worked for one time and for all the others it doesn't anymore. |
Well it looks like logging is the problem here. After doing the rebuild to route only with processor we checked with Visual-VM and saw that one Thread just gets stuck on writing out to log. We tried the Camel Logging Component and SLF4J-Logger and both got the Thread stuck at some point. Without logging it works fine. |
Out of curiosity: would mind testing if the same problem occurs with an |
Tried it out and got stuck. From VisualVM I have this information regarding how it gets stuck. The State is RUNNABLE but you can see that nothing is happening on it.
|
Thanks a lot for the info, @bframke! Do you happen to have a shareable reproducer at hand? |
I can create one. Also tested Logging via extra route in Camel, but this also got stuck after 534 messages. |
That would be awesome, thanks! |
Created an Reproducer, you can find it here: https://github.com/bframke/quarkus-examples/tree/master/camel-logging |
@ppalaga Please, assign to me. |
Hi @bframke , I'm trying to simulate an error with your producer. Unfortunately there is no error. Here are my execution steps. Would it be possible to validate, whether I'm using it in the same way?
I've also modified your script to show number of requests correctly Do you have any idea, what am I doing differently? |
Hi @JiriOndrusek, sorry for the late response, alot of to do in the last days and no, I got the Thread always stuck when there was traffic on it. I've tried it with a built quarkus image and a built native image. |
@bframke on which operating system are you reproducing this? |
We could reproduce this on Arch-Linux Manjaro and Ubuntu 16 & 18.04, but with our new application with newer camel and quarkus it no longer happens. So I'm not sure if this topic is still needed to be adressed. |
Happy to hear that, thanks for the info! Let's close based on the fact that @JiriOndrusek could not reproduce either. |
We currently are trying to send a high load of messages from an Test over an Camel Application with the Kafka Component. We use the ProducerTemplate to send Body and Headers over the given route for the Topic but most of the times get stuck. Its like the ProducerTemplate just wont get finished with its Task.
We also tried to put the sendBodyAndHeaders into extra Threads so that we don't clog one Thread, but we still got stuck after some messages.
Test-CURL
for i in {1..100}; do echo "$i"; curl -v -d '{"Event": "Event $i" }' -H "content-type: application/json" http://localhost:8081/topic/curltopic3/event; done
Maybe it could also be the problem that we just use one route with an everchanging list of topics?
Camel-Route Building
REST-Endpoint we call to send Events
The text was updated successfully, but these errors were encountered: