Quantcast
Channel: SQL Service Broker forum
Viewing all articles
Browse latest Browse all 461

service broker activation store procedure don't run when send a message to queue

$
0
0

I want to build async triggers with service broker, and in trigger, we send message to queue, and there's a activated sp for that queue, but when send a message, the sp don't run. please help.

1.I already enable the broker, and set TRUSTWORTHY ON.

2.below is my queue info, I tried to use owner,'dbo',self,doesn't work.

CREATE QUEUE dbo.SPITargetQueue
WITH STATUS=ON,
ACTIVATION (STATUS = ON,
MAX_QUEUE_READERS = 1,
PROCEDURE_NAME = dbo.querySPI,  
EXECUTE AS owner)

the sp will only receive the message and insert into the another test table, I manually run it after send a message, it's ok.

3.below is meg from sys.dm_broker_queue_monitors and sys.service_queues table.
    select q.name,m.state,m.tasks_waiting,q.activation_procedure,q.is_activation_enabled,q.execute_as_principal_id
    from sys.dm_broker_queue_monitors m join sys.service_queues q
    on m.queue_id=q.object_id

    name                |state       |tasks_waiting |activation_procedure | is_activation_enabled |execute_as_principal_id
    SPITargetQueue |INACTIVE |0                   |[dbo].[querySPI]       | 1                             |-2


4.and there's nothing in sys.dm_broker_activated_tasks table.


Do I need to set up other db property?
my first time to use service broker and please help solve this, thanks in advance.

 

 


Viewing all articles
Browse latest Browse all 461

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>