Kirill Byvshev created CAMEL-22816:
--------------------------------------

             Summary: Messages that don't require chatId fail when chatId is 
not configured
                 Key: CAMEL-22816
                 URL: https://issues.apache.org/jira/browse/CAMEL-22816
             Project: Camel
          Issue Type: Bug
          Components: camel-telegram
            Reporter: Kirill Byvshev


TelegramProducer.java requires chatId for ALL OutgoingMessage types, but these 
messages don't need it:
- AnswerPreCheckoutQueryMessage (uses pre_checkout_query_id)
- OutgoingAnswerInlineQuery (uses inline_query_id)
- OutgoingCallbackQueryMessage (uses callback_query_id)

Exception:
{code:java}
throw new IllegalStateException("Chat id is not set in message headers or route 
configuration"); {code}

Straightforward fix in TelegramProducer.java:

 
{code:java}
if (message.getChatId() == null) {
    if (!(message instanceof AnswerPreCheckoutQueryMessage)
            && !(message instanceof OutgoingAnswerInlineQuery)
            && !(message instanceof OutgoingCallbackQueryMessage)) {
        String chatId = resolveChatId(config, message, exchange);
        message.setChatId(chatId);
    }
} {code}
 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to