SQL SERVER – Change the Port of Service Broker Configuration

Just two days ago, I wrote a small note about SQL SERVER – Introduction to Service Broker.

Yesterday I wrote an article where Service Broker throws error due to it is using the same port as another application SQL Server  SQL Server – Fix – Error: 9692 The _MSG protocol transport cannot listen on port because it is in use by another process. One of the options was to configure Service Broker to a different port than other application is using. I got a couple of requests to write how doing it.

I am writing two scripts where the first End Point is created with specific port and required authentication and another script where End Point is dropped. This way Service Broker can be configured on different port.

Script 1: Create Service Broker End Point

USE master;
GO
CREATE ENDPOINT BrokerEndpoint
STATE = STARTED
AS TCP ( LISTENER_PORT = 5000)
FOR SERVICE_BROKER ( AUTHENTICATION = WINDOWS );
GO

Script 2 : Drop Service Broker End Point

If any user knows how to just change the port without creating and dropping Service Broker End Point, please suggest your method.

USE master ;
GO
DROP ENDPOINT BrokerEndpoint ;
GO

It is designed around the basic functions of sending and receiving messages. Each message forms part of a conversation. Each conversation is a reliable, persistent communication channel. Each message and conversation has a specific type that it enforces to help developers write reliable applications. This framework provides a simple Transact-SQL interface for sending and receiving messages combined with a set of strong guarantees for message delivery and processing. It guarantees that a program receives each message in a conversation exactly once in the order in which the message was sent, not the order in which the message entered the queue.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Menu
Exit mobile version