camel-kamelets icon indicating copy to clipboard operation
camel-kamelets copied to clipboard

Create Couchbase Source Kamelet

Open oscerd opened this issue 4 years ago • 4 comments

oscerd avatar Oct 13 '21 10:10 oscerd

This is failing with

Consumer Consumer[couchbase://http://localhost:8091?bucket=beer-sample&password=xxxxxx] failed polling endpoint: couchbase://http://localhost:8091?bucket=beer-sample&password=xxxxxx. Will try again at next poll. Caused by: [com.couchbase.client.core.error.DecodingFailureException - Deserialization of content into target class com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode failed; encoded = ["21st_amendment_brewery_cafe"]]: com.couchbase.client.core.error.DecodingFailureException: Deserialization of content into target class com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode failed; encoded = ["21st_amendment_brewery_cafe"]
	at com.couchbase.client.java.codec.JacksonJsonSerializer.deserialize(JacksonJsonSerializer.java:137)
	at com.couchbase.client.java.view.ViewRow.lambda$decode$0(ViewRow.java:126)
	at java.base/java.util.Optional.map(Optional.java:265)
	at com.couchbase.client.java.view.ViewRow.decode(ViewRow.java:122)
	at com.couchbase.client.java.view.ViewRow.keyAs(ViewRow.java:77)
	at org.apache.camel.component.couchbase.CouchbaseConsumer.poll(CouchbaseConsumer.java:121)
	at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:190)
	at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:107)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: (byte[])"["21st_amendment_brewery_cafe"]"; line: 1, column: 1]
	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
	at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1764)
	at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:400)
	at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1209)
	at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:274)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4593)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3609)
	at com.couchbase.client.java.codec.JacksonJsonSerializer.deserialize(JacksonJsonSerializer.java:134)

This seems to happen with kamelet only.

oscerd avatar Nov 09 '21 15:11 oscerd

Blocked by https://github.com/apache/camel-quarkus/issues/3283

oscerd avatar Nov 10 '21 11:11 oscerd

The kamelet at the moment

apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: couchbase-source
  annotations:
    camel.apache.org/kamelet.support.level: "Preview"
    camel.apache.org/catalog.version: "main-SNAPSHOT"
    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMCIgd2lkdGg9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMkQ3MkI4IiBkPSJNNzQuMTc0IDMxLjgwN2w3LjQzNyA1LjM2N3YtNy42MDJsLTcuNDgtOC43NjV2MTAuOTU3bC4wNDMuMDE1eiIvPjxwYXRoIGZpbGw9IiM1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Mi4yMjItLjI0NXYtMS44MThsLTUuMjE2IDIuODA1LTE0LjM0NSAzLjI5NXYuMDA0SDM5LjUwNnYtLjAwNGwtMTQuMzQ4LTMuMjk1LS4wMjUtLjA1MS4wNy4wMzdWNTEuOTY1bDE0LjMwMy41N3YuMDE0SDU5LjgyOHYtLjAxNGwxNC4zMDMtLjU3IDcuNDgtLjY1Ni0yLjIyMi0uMDMydi0zLjE5NnoiLz48L3N2Zz4="
    camel.apache.org/provider: "Apache Software Foundation"
    camel.apache.org/kamelet.group: "Couchbase"
  labels:
    camel.apache.org/kamelet.type: "source"
spec:
  definition:
    title: "Couchbase Source"
    description: |-
      Receive entries from couchbase.
    required:
      - protocol
      - hostname
      - bucket
    type: object
    properties:
      protocol:
        title: Protocol
        description: The protocol to use
        type: string
      hostname:
        title: Hostname
        description: The hostname to use
        type: string
      port:
        title: Port
        description: The port to use
        type: int
        default: 8091
      bucket:
        title: Bucket
        description: The bucket to use
        type: string
      username:
        title: Username
        description: Username to connect to Couchbase.
        type: string
        x-descriptors:
        - urn:camel:group:credentials
      password:
        title: Password
        description: Password to connect to Couchbase.
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
        - urn:camel:group:credentials
  types:
    out:
      mediaType: application/json
  dependencies:
  - "camel:jackson"
  - "camel:couchbase"
  - "camel:kamelet"
  flow:
    from:
      uri: "couchbase:{{protocol}}://{{hostname}}:{{port}}"
      parameters:
        bucket: "{{bucket}}"
        username: "{{?username}}"
        password: "{{?password}}"
      steps:
      - marshal:
          json: {}
      - to: "kamelet:sink"

oscerd avatar Nov 10 '21 11:11 oscerd

So, the problem is that couchbase client is shading jackson deps. This mean we need to remove any jackson dependency in the kamelet but also avoid to import jackson dependency from Quarkus dependency. Quarkus core is importing jackson databind, so this cannot work as Kamelet for the moment.

oscerd avatar Nov 12 '21 09:11 oscerd