The modern Azure Service Bus Java messaging client uses AMQP. Its builder requires AMQP_WEB_SOCKETS when a proxy is configured.

With azure-messaging-servicebus 7.18.0, construct the sender as follows:

var address = new java.net.Proxy(
    java.net.Proxy.Type.HTTP,
    new java.net.InetSocketAddress("proxy.example", 8080));

var proxy = new com.azure.core.amqp.ProxyOptions(
    com.azure.core.amqp.ProxyAuthenticationType.BASIC,
    address, proxyUser, proxyPassword);

var sender = new com.azure.messaging.servicebus.ServiceBusClientBuilder()
    .connectionString(serviceBusConnectionString)
    .transportType(com.azure.core.amqp.AmqpTransportType.AMQP_WEB_SOCKETS)
    .proxyOptions(proxy)
    .sender()
    .queueName(queueName)
    .buildClient();

The account variables authenticate to a proxy accepting Basic. The connection string and queue name still identify the Service Bus resource. Keep the resulting sender for its intended lifetime and close it when the application finishes with it.

Use com.azure.core.amqp.ProxyOptions here. Azure's HTTP stack has another similarly named proxy-options class; it is not the type this builder accepts.

This configures the messaging connection. An application using an independently created identity credential may also need to configure that credential's token HTTP transport.

Old Azure SDK 0.9 examples refer to another client generation. Do not infer that its configuration constants or general HTTP properties describe the modern AMQP builder.

Mikanda mikatakata