user2401395
user2401395

Reputation: 3

Service Broker External Activator doesn't deal with all messages in queue

I have setup external activator, which executes a simple application (as a startup) and all it does is run the following sql statement

WAITFOR(receive top(1) * from [dbo].[DBTriggersQueue]), TIMEOUT 5000;

I have a update trigger on a table, which adds messages to the queue.

My problem is if i run several update scripts(4 updates one after another) it adds the messages to the queue and my SBEA receives the event notification, however it only receives 1-2 event notifications (according to the EATrace Log) and therefore only 2 messages get dealt with by my simple app.

Does anyone know what could be causing the notifications from being sent or received by the SBEA after the initial 1/2?

It seems like something to do with time, because if I run each of my update scripts with few second delay then the event notification gets sent per update and messages dealt with.

Upvotes: 0

Views: 212

Answers (1)

Remus Rusanu
Remus Rusanu

Reputation: 294307

Activation is not a per-message trigger. When you're activated you're supposed to RECEIVE all messages. Once activated keep issuing RECEIVE statements and process the messages until RECEIVE returns an empty result set. Read more details at Understanding When Activation Occurs.

Upvotes: 1

Related Questions