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

[BUG] The base level event-hub-name property should be overridden when sub-level event-hub-name property configured #43593

Open
3 tasks
haoozhang opened this issue Dec 25, 2024 · 2 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@haoozhang
Copy link

haoozhang commented Dec 25, 2024

Describe the bug

When using the spring-cloud-azure-starter-eventhubs dependency, if I specify the properties in the application.yaml as follows, I think the expected result is that the event-hub-name in the producer and consumer section will override the base event-hub-name, that is, the application will eventually use the aaaa event hub, not bbbb.

spring:
  cloud:
    azure:
      eventhubs:
        namespace: evhns-sample
        event-hub-name: bbbb
        consumer:
          consumer-group: $Default
          event-hub-name: aaaa
        producer:
          event-hub-name: aaaa

But for the following code,

    @Autowired
    private EventHubConsumerClient consumerClient;

    @Autowired
    private EventHubProducerClient producerClient;
    
    @Override
    public void run(String... args) throws Exception {
        LOGGER.info("Sending message using Event Hub producer client. ==> {}", producerClient.getEventHubName());
        producerClient.send(Arrays.asList(new EventData("Test event")));
        LOGGER.info("Sent message to Event Hub.");
        producerClient.close();

        TimeUnit.SECONDS.sleep(3);
        LOGGER.info("Receiving message using Event Hub consumer client. ==> {}", consumerClient.getEventHubName());
        String PARTITION_ID = "0";
        IterableStream<PartitionEvent> partitionEvents = consumerClient.receiveFromPartition(PARTITION_ID, 1,
            EventPosition.earliest());
        Iterator<PartitionEvent> iterator = partitionEvents.stream().iterator();
        if (iterator.hasNext()) {
            PartitionEvent pe = iterator.next();
            LOGGER.info("Received message: {}", pe.getData().getBodyAsString());
        } else {
            LOGGER.error("Failed to receive message.");
        }
    }

The application logs show that it still use bbbb, not the aaaa, which is inconsistent as above expectation.

Sending message using Event Hub producer client. ==> bbbb
....
Receiving message using Event Hub consumer client. ==> bbbb

Exception or Stack Trace
No exception, just inconsistent behavior.

To Reproduce
Steps to reproduce the behavior:

Run this repo code: https://github.com/haoozhang/spring-cloud-azure-starter-eventhubs-sample

Code Snippet
Add the code snippet that causes the issue.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: [e.g. iOS]
  • IDE: [e.g. IntelliJ] IDEA
  • Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)] spring-cloud-azure-starter-eventhubs 5.18.0
  • Java version: [e.g. 8] 17
  • App Server/Environment: [e.g. Tomcat, WildFly, Azure Function, Apache Spark, Databricks, IDE plugin or anything special]
  • Frameworks: [e.g. Spring Boot, Micronaut, Quarkus, etc]

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

  • verbose dependency tree (mvn dependency:tree -Dverbose)
  • exception message, full stack trace, and any available logs

Additional context
Add any other context about the problem here.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
Copy link

@anuchandy @conniey @lmolkova

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 25, 2024
Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

4 participants