use Maintenance
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'P@ssw0rd'
ALTER DATABASE [Maintenance] SET TRUSTWORTHY ON


CREATE Queue [Maintenance Queue]

CREATE SERVICE Maintenance ON QUEUE [Maintenance Queue]

DROP ENDPOINT [Maintenance Endpoint]


CREATE ENDPOINT [Maintenance Endpoint]
AS TCP (
LISTENER_PORT = 4025
)
FOR SERVICE_BROKER
( AUTHENTICATION = WINDOWS)

select * from msdb.sys.routes

select * from [Maintenance Queue]

CREATE CERTIFICATE MaintenaceCertificate WITH SUBJECT = 'Maintenance'

BACKUP CERTIFICATE MaintenaceCertificate TO FILE = 
'C:\Maintenance\Maintenance.crt'
