Skip to content

[BUG] - Spring boot cannot connect to service bus emulator running on docker #46659

@kgoedert

Description

@kgoedert

Describe the bug
Spring boot cannot connect to service bus emulator running on docker in a linux machine.

Exception or Stack Trace
Connection attempt:[200] to: amqps://192.168.15.18:-1 failed

To Reproduce
Run the service bus in the emulator on docker in linux
Try to configure the spring boot application connection to the service bus using the application.yml file
The version of the dependency is <spring-cloud-azure.version>5.23.0</spring-cloud-azure.version>

Code Snippet

spring:  
  jms:
    servicebus:
      connection-string: "Endpoint=sb://192.168.15.18;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true"
      pricing-tier: standard
      namespace: sbemulatorns
      enabled: true
services:
  emulator:
    container_name: "servicebus-emulator"
    image: mcr.microsoft.com/azure-messaging/servicebus-emulator:latest
    pull_policy: always
    volumes:
      - "${CONFIG_PATH}:/ServiceBus_Emulator/ConfigFiles/Config.json"
    ports:
      - "5672:5672"
      - "5671:5671"
      - "5300:5300"
    environment:
      SQL_SERVER: mssql
      MSSQL_SA_PASSWORD: "${MSSQL_SA_PASSWORD}"  # Password should be same as what is set for SQL Server Linux 
      ACCEPT_EULA: ${ACCEPT_EULA}
      SQL_WAIT_INTERVAL: ${SQL_WAIT_INTERVAL} # Optional: Time in seconds to wait for SQL to be ready (default is 15 seconds)
      AZURE_CLOUD_TYPE: LOCAL
      AZURE_CLIENT_TELEMETRY_DISABLED: "true"

Expected behavior
On startup the application should be able to connect to the service bus

Setup (please complete the following information):

  • OS: Linux
  • Library/Libraries: <spring-cloud-azure.version>5.23.0</spring-cloud-azure.version>
  • Java version: 21
  • Frameworks: spring boot

Additional Information:

I tried adding the port number 5672 to my connection-string but it did not work. I also create a simple python code to send and receive messages to the same container and it was successful.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.azure-springAll azure-spring related issuescustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions