Azure / azure-event-hubs-emulator-installer

This repository acts as a central hub for handling issues, collecting feedback, and facilitating discussions related to the Azure Event Hubs emulator.
https://learn.microsoft.com/azure/event-hubs/overview-emulator
MIT License
24 stars 8 forks source link

Connection refused when using EventHubsTransportType.AmqpWebSockets #32

Open jdiekhoff-copeland opened 4 weeks ago

jdiekhoff-copeland commented 4 weeks ago

Describe the bug Running containers in the same docker bridge network and attempting to connect via using EventHubsTransportType.AmqpWebSockets results in a connection refused.

To Reproduce

Sample compose:

services:
  my-service:
    image: "my-image:latest"
    environment:
      EventHub__ConnectionString: Endpoint=sb://eventhub;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;
    networks:
      - network
    depends_on:
      - eventhub
  eventhub:
    image: "mcr.microsoft.com/azure-messaging/eventhubs-emulator:1.2.4-preview-amd64"
    volumes:
      - "./config.json:/Eventhubs_Emulator/ConfigFiles/Config.json"
    environment:
      BLOB_SERVER: eventhub-azurite
      METADATA_SERVER: eventhub-azurite
      ACCEPT_EULA: ${EH_ACCEPT_EULA}
    depends_on:
      - eventhub-azurite
    networks:
      - network
  eventhub-azurite:
    image: "mcr.microsoft.com/azure-storage/azurite:latest"
    networks:
      - network

networks:
  network:

Expected behavior Container should be able to connect to the event hub.

Screenshots 2024-08-21_20-23-31

Logs log2024082200.txt

Desktop:

Image Platform-Architecture Used:

Docker Version:

Arguments && Environment variables to start Emulator:

Emulator Launch Method:

Additional context:

I am able to connect fine if I leave the TransportType to the default, but I don't see anything in the documentation for the emulator that AmqpWebSockets is unsupported.

Saglodha commented 3 weeks ago

Hi @jdiekhoff-copeland , thanks for bringing this to our attention. As of today, Event Hubs emulator only works with Default AMQP flow and AMQPWebsockets is not supported. We'll update our documentation to reflect this accordingly.

To understand the situation better, could you please share more details on your use case and why you'd prefer AMQPwebsockets over traditional AMQP?

jdiekhoff-copeland commented 3 weeks ago

@Saglodha good to know, I will update our code accordingly.

The use of AMQPwebsockets was being done for local development as a workaround. Prior to using the eventhub emulator, our development team was testing against Azure Eventhubs. We noticed when we were on VPN that the normal connection to EventHubs was not working, and we were getting socketexception 10054. We found this stackoverflow and by setting the TransportType to AMQPWebSockets allowed for normal operations.

Now that we are using the emulator, we do not have a use case for AMQPWebSockets since all traffic is local.