question

JiongAN-1498 avatar image
0 Votes"
JiongAN-1498 asked SeeyaXi-msft commented

enable service broker on existing database in Alwayson availability group

I need to enable the service broker on a database which is already in an availability group. From the ms office page: https://docs.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-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SeeyaXi-msft avatar image
0 Votes"
SeeyaXi-msft answered SeeyaXi-msft commented

Hi @JiongAN-1498,

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.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for quick response.

In Alwayson, the standard AG listener is using port 1433 and service broker by default is using port 4022. would that means you need to create a new listener on port 4022 just for service broker instead of using the AG listener? if new service broker listener on port 4022 is required,
does the 'MyAgListener' refers to my old AG listener or the listener for the service broker?

please clarify. thanks.

0 Votes 0 ·

Hi @JiongAN-1498

would that means you need to create a new listener on port 4022 just for service broker instead of using the AG listener?

No, this does not conflict. 4022 is the default listening port of the service broker Endpoint while AG listener port is 1433. Typically, each availability group requires only one listener.
Unless some customer scenarios require multiple listeners for one availability group, you can use only one listener.

does the 'MyAgListener' refers to my old AG listener or the listener for the service broker?

It means your AG Listener. Yes, if you don’t need to create multiple listeners.
0 Votes 0 ·