问题
I created a queue thus:
CREATE QUEUE log_line_queue
WITH RETENTION = ON, --can decrease performance
STATUS = ON,
ACTIVATION (
MAX_QUEUE_READERS = 1, --number of concurrent instances of sp_insert_log_line
PROCEDURE_NAME = sp_insert_log_line,
EXECUTE AS OWNER
);
What can I do quickly in SSMS to add an item to my queue using T-SQL?
回答1:
In SSMS select required database in Object Explorer. Then find Service Broker of this database, right click on it and select 'New Service Broker Application...' command. This will create template for you to start using Service Broker quickly. Also you'll see minimal recommended configuration needed to implement and run your own application.
As for using one queue - if this is your first experience with Service Broker why not to follow common practice at the beginning? After running several samples and/or your own prototypes you decide how much queues to use and you know how to do it.
来源:https://stackoverflow.com/questions/14631474/simply-add-a-message-to-a-sql-server-service-broker-queue-using-t-sql