admin管理员组

文章数量:1122832

I'm trying to work with service bus emulator , with my java 21 spring boot project .

as a reference I followed this link: MS Azure service bus article

at first I'm trying to start the service bus in a docker and create a simple main to send and receive i manage to get the docker up and running : 1 issue i have is that the custom config i edit is not read but the docker when it start and i get the default config. (the config is in the same folder as the docker.yml)

this is my docker yml :

name: microsoft-azure-servicebus-emulator
services:
  emulator:
    container_name: "servicebus-emulator"
    image: mcr.microsoft/azure-messaging/servicebus-emulator:latest
    volumes:
      - "Config.json"
    ports:
      - "5672:5672" # AMQP port
      - "9354:9354" # Management port
    environment:
      SQL_SERVER: sqledge
      MSSQL_SA_PASSWORD: Adm1n!@2123
      ACCEPT_EULA: Y
    depends_on:
      - sqledge
    networks:
      sb-emulator:
        aliases:
          - "sb-emulator"
  sqledge:
    container_name: "sqledge"
    image: "mcr.microsoft/azure-sql-edge:latest"
    networks:
      sb-emulator:
        aliases:
          - "sqledge"
    environment:
      ACCEPT_EULA: Y
      MSSQL_SA_PASSWORD: Adm1n!@2123
networks:
  sb-emulator: 

and this is my simple code :

   public static void main(String[] args) {
    String CONNECTION_STRING ="Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;";
    ServiceBusAdministrationClient serviceBusAdministrationClient = new ServiceBusAdministrationClientBuilder()
            .connectionString(CONNECTION_STRING).buildClient();
    boolean subscriptionExists = serviceBusAdministrationClient.getSubscriptionExists("topic.1", "subscription.1");
    System.out.println("Subscription exists: " + subscriptionExists);

and when i try to run it i keep getting the following error :

Exception in thread "main" java.io.UncheckedIOException: ioty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/[0:0:0:0:0:0:0:1]:443

can u help me understand what is the issue ? Thank you all, Oded

本文标签: azureservicebusazure Service Bus EmulatorStack Overflow