Hi,

Does anyone have experience using the producerAsyncClient in camel
eventhubs? I've been trying to implement this producer instead of using
connectionstring directly in the camel uri.

My uri looks like this:

"azure-eventhubs:mynamespace/myeventhub?producerAsyncClient=#producerAsyncClient"

(I also tried using it without mynamespace/myeventhub with the same result)
and the code for the producer like this:

<https://camel.zulipchat.com/#narrow/stream/257302-camel-quarkus/topic/problem.20using.20eventhubs.20extension.20with.20producerAsyncClient/near/363754808>

private static final String SERVICE_URI_POSTFIX = "servicebus.windows.net";

    EventHubProducerAsyncClient eventHubProducerAsyncClient = new
EventHubClientBuilder()
            .credential(getCredential())
            .fullyQualifiedNamespace(eventhubProperties.eventhubNameSpace()
+ "." + SERVICE_URI_POSTFIX)
            .eventHubName(eventhubProperties.eventhubName())
            .buildAsyncProducerClient();
    context.getRegistry().bind("producerAsyncClient",
eventHubProducerAsyncClient);

private ClientSecretCredential getCredential() {
    return new ClientSecretCredentialBuilder()
            .clientId(eventhubProperties.azureClientId())
            .clientSecret(eventhubProperties.azureClientSecret())
            .tenantId(eventhubProperties.azureTenantId())
            .build();
}

But the problem I face is that when sending a message it returns this error:

2023-06-05 15:35:28,067 ERROR [rea.cor.pub.Operators]
(reactor-executor-4) Operator called default onErrorDropped:
reactor.core.Exceptions$ErrorCallbackNotImplemented:
com.azure.core.amqp.exception.AmqpException: errorContext[NAMESPACE:
null.servicebus.windows.net. ERROR CONTEXT: N/A]
Caused by: com.azure.core.amqp.exception.AmqpException:
errorContext[NAMESPACE: null.servicebus.windows.net. ERROR CONTEXT:
N/A]

It seems the namespace is null when sending.

Reply via email to