Azure-Samples / azure-spring-boot-samples

Spring Cloud Azure Samples
MIT License
173 stars 231 forks source link

[QUERY] How to produce events to Azure eventhub using Springboot #658

Open santafek opened 1 year ago

santafek commented 1 year ago

Query/Question

I am trying to produce events to Azure eventhub using Springboot, i have followed the below mentioned doc for creating Springboot application https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-cloud-stream-binder-java-app-azure-event-hub But i am getting below mentioned error ```shell o.s.cloud.stream.binding.BindingService: Failed to create producer binding;retrying in 30 seconds org.springframework.cloud.stream.binder.BinderException: Exception thrown while building outbound endpoint caused by java.lang.IllegalArgumentException: Parameter resourceGroupName is required and cannot be null. ``` ***Why is this not a Bug or a feature Request?*** **Setup (please complete the following information if applicable):** - OS: mac - IDE: IntelliJ community edition - Sample Path:

Information Checklist

yiliuTo commented 1 year ago

Hi @santafek , thanks for reaching us. Could you try the sample which is similar with the doc https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-cloud-stream-binder-java-app-azure-event-hub to see if you can run it successfully?

And if this still cannot help, would you like to share your pom.xml and configuration?

santafek commented 1 year ago

Hi @yiliuTo, Thanks for your update. I have tried the samples (spring-cloud-azure-starter-eventhubs/eventhubs-client/), i have followed the exact steps in read me doc. but i am getting the error error.docx Could you please help me in reolving the issues. Thank you.

yiliuTo commented 1 year ago

Hi @santafek , could you check whether you have run these two commands before your run the sample? which is az login and az account set --subscription <your-subscription-id>.

The error logs say

com.azure.spring.sample.eventhubs.client.EventHubClientApplication.main(EventHubClientApplication.java:38) ~[classes/:na]
Caused by: com.azure.identity.CredentialUnavailableException: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/java/identity/environmentcredential/troubleshoot
Managed Identity authentication is not available.
SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
IntelliJ Authentication not available. Please log in with Azure Tools for IntelliJ plugin in the IDE.
AzureCliCredential authentication unavailable. Please run 'az login' to set up account. To further mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/java/identity/azclicredential/troubleshoot
Unable to execute PowerShell. Please make sure that it is installed in your systemTo mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azure-identity-java-default-azure-credential-troubleshoot

Our sample as well as the doc you mentioned by default leverage the credential from the application envionment to establish the connection. So when it cannot find any available credential from all the environments, the authentication fails. That's what the exception tells.