davsclaus opened a new pull request, #28311:
URL: https://github.com/apache/camel/pull/28311

   Fixes [CAMEL-26027](https://issues.apache.org/jira/browse/CAMEL-26027).
   
   Each message handler of the telegram producer kept one 
`TelegramBodyPublisher`, which every send of that message type filled 
(`addBody`) and emptied when it serialized the request. The producer is called 
from several threads at once when a route has concurrent consumers or a 
parallel split, and then the sends shared the parts of their requests: a 
request carried the messages of several sends, to the chat of one of them, and 
another request went out empty.
   
   **Changes**
   - `TelegramMessageHandler.sendMessage` builds the body of each request in 
its own `TelegramBodyPublisher`, which it passes to `addBody` and the part 
helpers; the handlers no longer keep one. All of these classes are 
package-private.
   - To be backported (`port/camel-4.22.x`, `port/camel-4.18.x`): the same code 
is on both branches.
   
   **Tests**
   - `TelegramProducerConcurrentTest`: 100 sends from 10 threads through one 
endpoint; each request is the JSON of one message, to the chat of that message. 
Without the fix it fails, as sends fail.
   - The other 87 tests of the producer, consumer, chat bot, webhook and 
`OutgoingMessageHandlerTest` pass.
   - Checked before the fix with `camel run` against a fake Bot API: 300 text 
messages sent by a seda consumer with `concurrentConsumers=20` gave 10 requests 
with the messages of several chats, 46 empty requests and 6 failed sends.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to