zhfeng commented on issue #1200:
URL: https://github.com/apache/camel-quarkus/issues/1200#issuecomment-628436535


   There is also a problem that the webhook creates the TelegramEndpoint before 
the camel context is started, and this endpoint is added to the 
[DeferServiceStartupListener 
services](https://github.com/apache/camel/blob/master/core/camel-base/src/main/java/org/apache/camel/impl/engine/DeferServiceStartupListener.java#L39).
 So it is started in the onCamelContextStarted() and can not be triggered.
   
   The other possible solution is adding the registerWebhook() in the doStart()
   ```
   @Override
   protected void doStart() throws Exception {
       super.doStart();
       /* codes of the initialization of AsyncHttpClient and the 
telegramService */
       if (deferRegisterWebhook) {
          doRegisterWebhook();
       }
   }
   
   @Override
   public void registerWebhook() throws Exception {
       if (telegramService != null) {
           doRegisterWebhook();
       } else {
           LOG.info("defer the webhook register till the endpoint is started");
           deferRegisterWebhook = true;
       }
   }
   
   ```
   @davsclaus WDYT ?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to