enable service broker on existing database in Alwayson availability group

Jiong AN 146 Reputation points
2021-07-19T02:09:21.033+00:00

I need to enable the service broker on a database which is already in an availability group. From the ms office page: https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/service-broker-with-always-on-availability-groups-sql-server?view=sql-server-2016.
step 1 shows: Ensure that the availability group possesses a listener.
There is already a listener in my AG before the service broker setup. My question is 'Do the service broker need a separate listener to be setup just for its own? or using the existing listener is ok'.

step 2: Ensure that the Service Broker endpoint exists and is correctly configured.
CREATE ENDPOINT [SSBEndpoint]
STATE = STARTED
AS TCP (LISTENER_PORT = 4022, LISTENER_IP = ALL )
FOR SERVICE_BROKER (AUTHENTICATION = WINDOWS)

My service broker app is going to use a specified login username which granted as db_owner under the database. In this case, should (AUTHENTICATION = WINDOWS) looks like something like (AUTHENTICATION = <username>)?correct me wrong or not.

to create routing in msdb, the document shows an example code
CREATE ROUTE [RouteToTargetService] WITH
SERVICE_NAME = 'ISBNLookupRequestService',
ADDRESS = 'TCP://MyAgListener:4022';

does the 'MyAgListener' refers to my old listener? or i need to create a separate listener just for service broker and 'TCP://MyAgListener:4022' should refer to my new service broker listener which needs to created.

I am a bit confused. Could you please so kind to clarify.

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Seeya Xi-MSFT 16,586 Reputation points
    2021-07-19T08:22:26.453+00:00

    Hi @Jiong AN ,

    Do the service broker need a separate listener to be setup just for its own? or using the existing listener is ok

    This part has an explanation.
    According to this page, you can Create an Additional Listener for an Availability Group or configure your application.

    In this case, should (AUTHENTICATION = WINDOWS) looks like something like (AUTHENTICATION = <username>)?

    This is not standardized. If you use a specified login username, please refer to this blog, which has a sample code about Endpoint Type.

    does the 'MyAgListener' refers to my old listener?

    It means your listener in the question 1.

    Best regards,
    Seeya


    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.