添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I have a spring boot app using camel to connect to Azure event hub.
I can publish events to Azure event hub but when I try to consume it fails with the following error.

2022-10-13 18:30:40 WARN o.a.c.c.a.e.EventHubsConsumer - Error processing exchange. Exchange[]. Caused by: [java.lang.IllegalArgumentException - Illegal base64 character 20]
java.lang.IllegalArgumentException: Illegal base64 character 20
at java.util.Base64$Decoder.decode0(Base64.java:714)
at java.util.Base64$Decoder.decode(Base64.java:526)
at java.util.Base64$Decoder.decode(Base64.java:549)
at com.azure.storage.common.implementation.StorageImplUtils.computeHMac256(StorageImplUtils.java:203)
at com.azure.storage.common.StorageSharedKeyCredential.generateAuthorizationHeader(StorageSharedKeyCredential.java:129)
at com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy.process(StorageSharedKeyCredentialPolicy.java:38)
at com.azure.core.http.HttpPipelineNextPolicy.process(HttpPipelineNextPolicy.java:46)
at com.azure.storage.common.policy.MetadataValidationPolicy.process(MetadataValidationPolicy.java:48)
at com.azure.core.http.HttpPipelineNextPolicy.process(HttpPipelineNextPolicy.java:46)
at com.azure.core.http.policy.AddDatePolicy.lambda$process$0(AddDatePolicy.java:29)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoDelaySubscription.accept(MonoDelaySubscription.java:53)
at reactor.core.publisher.MonoDelaySubscription.accept(MonoDelaySubscription.java:34)
at reactor.core.publisher.FluxDelaySubscription$DelaySubscriptionOtherSubscriber.onNext(FluxDelaySubscription.java:131)
at reactor.core.publisher.MonoDelay$MonoDelayRunnable.propagateDelay(MonoDelay.java:271)
at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:286)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

I can see the storage access key has + character and this character is replaced with space which causes this exception.
For example:
Before: AOwXNuCr6RLNnOWr0V0P1Qn2XZTLhDcBCZiWSiGNAtuigJorkv5UJLpHq6N9c43Ga+thjY2un/t6+AStJ1U2vQ==
After: AOwXNuCr6RLNnOWr0V0P1Qn2XZTLhDcBCZiWSiGNAtuigJorkv5UJLpHq6N9c43Ga thjY2un/t6 AStJ1U2vQ==

I tried to replace character with %2B but it didn't work. Is it a bug with Camel library for Azure or Azure itself?

I'm using camel-azure-eventhubs-starter version 3.14.5.

Thanks

Hello @Renan Berenger ,

Welcome to the MS Q&A platform.

Please correct me if my understanding is wrong. You have an app that connects to the Azure event hub using the event hub connection string and publishes events to the Azure event hub. While consuming the events via the camel library, you see the error message.

Illegal base64 character 20 means that the received value contained an invalid character not present in the Base64 alphabet. 20 is a space because the error message uses hex format.

The issue seems like with the Camel library during the conversion of Base64.

I hope this helps.

Hi, yes I did. Thanks for the answer.
I was able to make it work using custom bean or kafka component instead of event hub camel component so you are probably right.

Thanks.