How do I find out if I'm using SBMP or AMQP protocol?

Ian Horner 20 Reputation points
2024-06-07T15:15:21.0433333+00:00

I got an email saying that support for SBMP protocol is going to end for the library WindowsAzure.ServiceBus in September 2026. I'm trying to check if my code uses this protocol, but I'm having trouble finding documentation on this. How do I find out what protocol I'm using? Where does this get configured?

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
572 questions
0 comments No comments
{count} votes

Accepted answer
  1. joseandresc 400 Reputation points Microsoft Employee
    2024-06-07T15:42:41.3366667+00:00

    Hi Ian, thanks for reaching out.

    If you are leveraging the WindowsAzure.ServiceBus libraries, by default it will use SBMP protocol unless explicitly changed. You can change it by modifying the transport type option https://learn.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.transporttype?view=azure-dotnet-legacy

    connectionStringBuilder.TransportType = TransportType.Amqp 
    

    See another example below

    using Microsoft.ServiceBus;
    using Microsoft.ServiceBus.Messaging;
    
    // Create the connection string builder
    var connectionStringBuilder = new ServiceBusConnectionStringBuilder("your_connection_string");
    
    // Check the transport type
    TransportType transportType = connectionStringBuilder.TransportType;
    
    if (transportType == TransportType.NetMessaging)
    {
        Console.WriteLine("Using SBMP (Service Bus Messaging Protocol).");
    }
    else if (transportType == TransportType.Amqp)
    {
        Console.WriteLine("Using AMQP (Advanced Message Queuing Protocol).");
    }
    else
    {
        Console.WriteLine("Unknown transport type.");
    }
    
    // Optionally, set the transport type if needed
    connectionStringBuilder.TransportType = TransportType.NetMessaging;
    
    // Create a QueueClient with the specified transport type
    QueueClient queueClient = QueueClient.CreateFromConnectionString(connectionStringBuilder.ToString());
    
    
    

    We do recommend migrating to the latest SDKs for Service Bus, as the legacy ones are deprecated and do not receive updates, newest SDK can only use the AMQP protocol and receive constant improvements throughout the year.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful