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

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

Closed
bjethwan opened this issue Jul 11, 2022 · 3 comments

Comments

@bjethwan
Copy link

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?

@oscerd
Copy link
Contributor

oscerd commented Jul 12, 2022

What you get in the body are binary data: https://docs.microsoft.com/en-us/java/api/com.azure.messaging.servicebus.servicebusreceivedmessage.getbody?view=azure-java-stable#com-azure-messaging-servicebus-servicebusreceivedmessage-getbody()

So the behavior is correct if you try to serialize it through json-serialize action

@oscerd
Copy link
Contributor

oscerd commented Jul 18, 2022

Feel free to re-open or ask again.

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

@oscerd Hi Andrea
But I do have the json-serialize-action defined between the source and sink. Is it not the correct way? Please check the yaml given in my original post

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