Azure / azure-event-hubs-java

☁️ Java client library for Azure Event Hubs
https://azure.microsoft.com/services/event-hubs
MIT License
51 stars 61 forks source link

Azure Stack Hub#Could not send messages. #472

Closed SDT-MinkyuKim closed 3 years ago

SDT-MinkyuKim commented 4 years ago

Actual Behavior

  1. I tried to send message to Event Hubs in my Azure Stack Hub. My Code printed that Message sent successfully, but nothing displayed on Azure Stack Hub Portal.

Expected Behavior

  1. Event hubs' metric shows that messages come in.

Versions

The following is the code I wrote to test.

public static void main(String[] args) throws EventHubException {
        final Gson gson = new GsonBuilder().create();
        final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(4);
        EventHubClient ehClient = null;

        try {
            ehClient = EventHubClient.createFromConnectionStringSync(
                    new ConnectionStringBuilder("---[Event Hub Connection String --deleted for security-- ]---")
                            .setEventHubName("---[Event Hub name I created.--deleted for security--]---")
                            .toString(),
                       executorService);

            System.out.println("EventHubName: " + ehClient.getEventHubName());

            for (int i = 0; i < 3; i++) {
                String payload = "Message " + Integer.toString(i);
                byte[] payloadBytes = gson.toJson(payload).getBytes(Charset.defaultCharset());
                EventData sendEvent = EventData.create(payloadBytes);
                ehClient.sendSync(sendEvent);
                System.out.println(payload + " sent.");
            }

            System.out.println(Instant.now() + ": Send Complete...");
            System.out.println("Press Enter to stop.");
            System.in.read();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            ehClient.closeSync();
            executorService.shutdown();
        }
    }
JamesBirdsall commented 4 years ago

Hello! This seems like an issue with the Event Hubs implementation on Stack, so I am trying to find someone on that team to help you.

JamesBirdsall commented 3 years ago

This was an issue with Event Hubs on Azure Stack, not related to the EH Java client.