Message loss when using asyncPublish() #343
Unanswered
et-hoangdv
asked this question in
Q&A
Replies: 1 comment
-
After some testing, I realized that the issue might be related to the use of public function handle()
{
for ($i = 0; $i < 100; $i++) {
$log = [
'message' => "message #{$i}",
'created_at' => now()->toIso8601String()
];
$message = new Message(
body: $log,
);
Kafka::asyncPublish()
->onTopic('laravel-logs')
->withMessage($message)
->send();
}
dd('done'); // I added this in my code
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm new to Kafka so I might be missing something fundamental — any help would be appreciated!
I’m currently testing message publishing and I’ve set up a basic command that sends 100 messages in a loop like this:
Then I created two consumers:
Main topic consumer:
Dead-letter topic consumer:
Problem:
When I run the producer command, the consumer sometimes receives all 100 messages, but often only receives around 80 or so.

Meanwhile, the dead-letter consumer does not show any message.
Questions:
Thanks a lot for any guidance!
Beta Was this translation helpful? Give feedback.
All reactions