Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiretap to Kamelet does not work in YAML #2139

Closed
BramMusters opened this issue Mar 16, 2021 · 3 comments
Closed

Wiretap to Kamelet does not work in YAML #2139

BramMusters opened this issue Mar 16, 2021 · 3 comments
Milestone

Comments

@BramMusters
Copy link

BramMusters commented Mar 16, 2021

I am observing errors while writing a YAML integration containing a wiretap to a Kamelet, here is a minimal example: This example should log "Hello from Camel K yaml" twice.

- from:
    uri: "timer:yaml"
    parameters:
      period: "1000"
    steps:
      - set-body:
          constant: "Hello Camel K from yaml"
      - wiretap:
          uri: "kamelet:logger?message=${body}"
      - to: "log:info"

Where the logger Kamelet is just a simple sink Kamelet that logs:

apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: logger
  namespace: default
  labels:
    camel.apache.org/kamelet.type: "sink"
spec:
  definition:
    title: "Logger"
    description: Logger
    required:
      - message
    properties:
      message:
        title: Message
        description: Message
        type: string
  flow:
    from:
      uri: "kamelet:source"
      steps:
        - log: "{{message}}"

After kubectl apply -f and kamel run, I receive the following error:
WARN [org.apa.cam.pro.WireTapProcessor] (Camel (camel-1) thread #3 - WireTap) Error occurred during processing Exchange[72E859E2207EED5-0000000000000005] wiretap to kamelet:logger?message=${body}. This exception will be ignored.: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: kamelet://logger?message=Hello+Camel+K+from+yaml, please check your classpath contains the needed Camel component jar.

Changing the wiretap to a to statement works: ("Hello .. " is printed once every second)

- from:
    uri: "timer:yaml"
    parameters:
      period: "1000"
    steps:
      - set-body:
          constant: "Hello Camel K from yaml"
      - to:
          uri: "kamelet:logger?message=${body}"

Changing the kamelet:logger to the baked in log also works: ("Hello .. " is printed twice every second)

- from:
    uri: "timer:yaml"
    parameters:
      period: "1000"
    steps:
      - set-body:
          constant: "Hello Camel K from yaml"
      - wiretap:
          uri: "log:info"
      - to: "log:info"

Another interesing thing: when I remove the final to: log:info statement, it doesn't work either:

- from:
    uri: "timer:yaml"
    parameters:
      period: "1000"
    steps:
      - set-body:
          constant: "Hello Camel K from yaml"
      - wiretap:
          uri: "log:info"

The /etc/camel/conf/application.properties looks like:

camel.k.sources[0].location=file:/etc/camel/sources/i-source-000/camel-k-embedded-flow.yaml
camel.k.sources[0].name=camel-k-embedded-flow
camel.k.sources[0].language=yaml

When I deploy a more complex integration yaml containing 2 Kamelets, it looks like:

camel.k.sources[1].type=template
camel.k.sources[1].language=yaml
camel.k.sources[0].location=file:/etc/camel/sources/i-source-000/camel-k-embedded-flow.yaml
camel.k.sources[0].name=camel-k-embedded-flow
camel.k.sources[0].language=yaml
camel.k.sources[1].location=file:/etc/camel/sources/i-source-001/timed-crawler.yaml
camel.k.sources[1].name=timed-crawler

I am not sure if miss something, or it's a bug. After a discussion on Zulip chat with @lburgazzoli, he mentions there might be an issue with load templates. Similar problems arise with components like enhance, and I suspect it might be the same issue.

Mind you: I don't have a lot of Camel (K) experience, so I hope I formulated everything well.

@heiko-braun
Copy link

//cc @nicolaferraro

@heiko-braun
Copy link

I don't have a lot of Camel (K) experience, so I hope I formulated everything well.

@barmyard Perfect, thanks for the detailed description :)

@nicolaferraro nicolaferraro added this to the 1.4.0 milestone Mar 16, 2021
@nicolaferraro nicolaferraro modified the milestones: 1.4.0, 1.5.0 Apr 13, 2021
@nicolaferraro nicolaferraro modified the milestones: 1.5.0, 1.6.0 Jul 5, 2021
@squakez
Copy link
Contributor

squakez commented Aug 30, 2021

I've checked this problem and it was caused by the usage of wiretap which should be instead wire-tap in yaml language. If you try

      - wire-tap:
          uri: "log:wiretap"

you should have it fixed. Please, reopen if you face any other problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants