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

Reopen of #962 - ISSUE WITH KAMELET azure-servicebus-source output is message length instead of message #980

Closed
bjethwan opened this issue Jul 22, 2022 · 7 comments

Comments

@bjethwan
Copy link

ISSUE WITH KAMELET azure-servicebus-source output is message length instead of message

I had below KameletBinding working with Timer source but with Azure ServiceBus.
I was getting a type conversion error
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: com.azure.core.util.BinaryData to the required type: java.io.InputStream

Hence, I added a JSON Serializer in between

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: aws-s3-streaming-upload-sink-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: azure-servicebus-source
    properties:
      connectionString: Endpoint=<<>>/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<<>>
      topicOrQueueName: <<>>
      serviceBusReceiveMode: RECEIVE_AND_DELETE
  steps:
  - ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: json-serialize-action
  sink:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: aws-s3-streaming-upload-sink
    properties:
      bucketNameOrArn: arn:aws:s3:::<<>>
      keyName: timer-source
      region: ap-south-1
      accessKey: <<>>
      secretKey: <<>>
      batchMessageNumber: 5

Now the PROBLEM is that instead of capturing data it's capturing length of the message
{"length":54}{"length":54}{"length":54}{"length":54}{"length":54}

How to fix this?
Do I need to configure the azure-servicebus-source Kamelet to make it output String/JSON? Is it reasonable to configure the Kamelet or should I copy and configure that one?

@bjethwan
Copy link
Author

@oscerd
Hi Andrea - I have reopened the issue.
Unless I update the existing azure-servicebus-source to emit string messages.
KameletBinding doesn't provide a way to correctly convert the Byte stream to String.
As you can see that when I try to use json-serialize-action, instead of the actual message I am getting message length.

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2022

@oscerd oscerd closed this as completed Jul 25, 2022
@bjethwan
Copy link
Author

bjethwan commented Jul 25, 2022

oscerd
@oscerd oscerd
I agree that it's binary.
The question is how to get to String or JSON?
The json serializer kamelet is emitting json with length of the message.

For once kindly read through my message completely once.

@bjethwan
Copy link
Author

@oscerd
Why not let our discussion finish before you close the ticket? I can't understand the rush.

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2022

Because it was enough to re-open the old ticket, instead of opening a new one.

@oscerd oscerd reopened this Jul 25, 2022
@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2022

One problem would be you need to call the toBytes() on the binaryData. We could do that, in the Kamelet for the moment and with a new Camel release in the component.

@oscerd
Copy link
Contributor

oscerd commented Jul 27, 2022

This should be fixed with #983

@oscerd oscerd closed this as completed Jul 27, 2022
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

2 participants