Uploaded image for project: 'Red Hat Build of Apache Camel for Quarkus'
  1. Red Hat Build of Apache Camel for Quarkus
  2. CEQ-901

Quarkus Native: Slack fails to post a message using webhook

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • 0

      camel quarkus 2.2.1.fuse-800015-redhat-00004.

      generated an app with camel-quarkus-slack and camel-quarkus-timer and with following route:

      package com.test;
      
      import org.apache.camel.Exchange;
      import org.apache.camel.Processor;
      import org.apache.camel.builder.RouteBuilder;
      import com.slack.api.model.Message;
      import javax.enterprise.context.ApplicationScoped;
      
      @ApplicationScoped
      public class MyRouteBuilder extends RouteBuilder {
      
          @Override
          public void configure() throws Exception {
              from("timer:x?repeatCount=1").setBody().constant("Hello from quarkus").to("slack:#<channel>?webhookUrl=https://<webhook>");
          }
      }
      

      results in an exception while running it native:

      ./timer-to-slack-1.0.0-SNAPSHOT-runner
      __  ____  __  _____   ___  __ ____  ______ 
       --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
       -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
      --\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
      2021-05-31 13:18:24,270 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
      2021-05-31 13:18:24,271 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes startup summary (total:1 started:1)
      2021-05-31 13:18:24,271 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route1 (timer://x)
      2021-05-31 13:18:24,271 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.9.0 (camel-1) started in 0ms (build:0ms init:0ms start:0ms)
      2021-05-31 13:18:24,271 INFO  [io.quarkus] (main) timer-to-slack 1.0.0-SNAPSHOT native (powered by Quarkus 1.13.0.Final) started in 0.004s. 
      2021-05-31 13:18:24,271 INFO  [io.quarkus] (main) Profile prod activated. 
      2021-05-31 13:18:24,272 INFO  [io.quarkus] (main) Installed features: [camel-core, camel-slack, camel-support-common, camel-timer, cdi]
      2021-05-31 13:18:25,542 WARN  [org.apa.cam.com.tim.TimerConsumer] (Camel (camel-1) thread #0 - timer://x) Error processing exchange. Exchange[]. Caused by: [org.apache.camel.CamelExchangeException - Error POSTing to Slack API: WebhookResponse(code=400, message=, body=invalid_payload). Exchange[]]: org.apache.camel.CamelExchangeException: Error POSTing to Slack API: WebhookResponse(code=400, message=, body=invalid_payload). Exchange[]
      	at org.apache.camel.component.slack.SlackProducer.sendMessageByWebhookURL(SlackProducer.java:144)
      	at org.apache.camel.component.slack.SlackProducer.process(SlackProducer.java:68)
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:172)
      	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:439)
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:62)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:167)
      	at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:388)
      	at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:209)
      	at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76)
      	at java.util.TimerThread.mainLoop(Timer.java:556)
      	at java.util.TimerThread.run(Timer.java:506)
      	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
      	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
      

      non-native works OK and the message is posted to the channel successfully.

      I used the TNB test for testing this.
      https://gitlab.cee.redhat.com/jboss-fuse-qe/t-n-b/tnb-tests/-/blob/main/tests/universal/components/src/test/java/org/jboss/fuse/tnb/universal/component/slack/SlackITCase.java#L32

          1.
          Documentation Sub-task Closed Undefined Unassigned
          2.
          Productization Sub-task Closed Undefined Unassigned
          3.
          Review Test Sub-task Closed Undefined Unassigned
          4.
          Development Sub-task Closed Undefined Unassigned

              jondruse@redhat.com Jiri Ondrusek
              mmajerni@redhat.com Mario Majernik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: