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

To-D doesn't work in a Kamelet #449

Closed
oscerd opened this issue Jul 27, 2021 · 10 comments
Closed

To-D doesn't work in a Kamelet #449

oscerd opened this issue Jul 27, 2021 · 10 comments

Comments

@oscerd
Copy link
Contributor

oscerd commented Jul 27, 2021

With 1.5.0 the parameter substitution won't work in a to-d, like for example azure-storage-blob source and dropbox source.
We have some workaround, like setting an exchange property and then work through headers, but I think we need to address the situation.

@lburgazzoli
Copy link
Contributor

apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: azure-storage-blob-source
spec:
  definition:
    title: "Azure Storage Blob Source"
    description: |-
      Consume Files from Azure Storage Blob.
    required:
      - period
      - accountName
      - containerName
      - accessKey
    type: object
    properties:
      period:
        title: Period between Polls
        description: The interval between fetches to the Azure Storage Container in milliseconds
        type: integer
        default: 10000
      accountName:
        title: Account Name
        description: The Azure Storage Blob account name.
        type: string
      containerName:
        title: Container Name
        description: The Azure Storage Blob container name.
        type: string
      accessKey:
        title: Access Key
        description: The Azure Storage Blob access Key.
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
  dependencies:
    - "camel:azure-storage-blob"
    - "camel:kamelet"
    - "camel:core"
    - "camel:jsonpath"
    - "camel:timer"
  flow:
    from:
      uri: "timer:azure-storage-blob-stream"
      parameters:
        period: "{{period}}"
      steps:
      - to:
          uri: "azure-storage-blob:{{accountName}}/{{containerName}}"
          parameters:
            operation: "listBlobs"
            accessKey: "{{accessKey}}"
      - split:
          jsonpath: "$.*"
          steps:
          - set-property:
              name: azureBlobName
              simple: ${body.name}
          - to-d: "azure-storage-blob:{{accountName}}/{{containerName}}?accessKey=RAW({{accessKey}})&operation=getBlob&blobName=${exchangeProperty.azureBlobName}"
          - to: "kamelet:sink"

@davsclaus I think the to-d here fails because when the real url is computed, the local properties are not more known.

@davsclaus
Copy link
Contributor

@lburgazzoli yeah toD and recipientList etc that compute dynamic endpoint uris would be affected. Can you create a JIRA ticket

@davsclaus
Copy link
Contributor

I created a JIRA
https://issues.apache.org/jira/browse/CAMEL-16823

@davsclaus
Copy link
Contributor

If you can use headers then that is often better as this avoids creating dynamic endpoints which has higher overhead than static endpoints.

@oscerd
Copy link
Contributor Author

oscerd commented Jul 28, 2021

For azure i solved in that way, there is still the Dropbox source kamelet and in that case the headers cannot be used because the component is not using the for producer operations

@davsclaus
Copy link
Contributor

Okay a source with a "from" endpoint is not dynamic so there is no problem there.

@lburgazzoli
Copy link
Contributor

wonder if the DefaultComponent should automatically resolve the placeholders when computing the remaining part of the uri that is used to invoke createEndpoint

@oscerd
Copy link
Contributor Author

oscerd commented Jul 28, 2021

Okay a source with a "from" endpoint is not dynamic so there is no problem there.

The source is done with a timer as from. Because there is no real consumer. So it's timer+producer. Like azure storage blob too

@davsclaus
Copy link
Contributor

Okay so its specific the toD EIP that via the uri checks if the component is a special toD optimized (send dynamic aware) and this is causing this problem.

The route template do create the endpoint with the resolved parameters from the template, so that is correct. So fixing this in toD and this should work afterwards.

@davsclaus
Copy link
Contributor

Fixed in Camel 3.12

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

No branches or pull requests

3 participants