Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Service Broker / April 2006

Tip: Looking for answers? Try searching our database.

How to recieve and remove from queue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard - 20 Apr 2006 00:41 GMT
Can someone explain the basics of how a message is put onto a queue, read
from that queue, and removed from that queue, when there is not a second SSB
instance?  For example, a client requests information, an application queues
the request in the database, another application reads the request and
processes it, and then removes the queue.

The "from" and "to" service is a little confusing when there isn't a second
SSB.

Thanks,
Richard
Kent Tegels - 20 Apr 2006 04:48 GMT
Hello Richard,

> Can someone explain the basics of how a message is put onto a queue,
> read from that queue, and removed from that queue, when there is not a
> second SSB instance?  For example, a client requests information, an
> application queues the request in the database, another application
> reads the request and processes it, and then removes the queue.

1. Messages always go into a Queue with the SEND statement. The SEND statement
targets a Service which is responsible for reading the Message from the Queue.
Is some ways, a Service is a bit of indirection for a Queue.

2. When a message arrives, Service Broker inserts the Message into the Queue
and looks to see if needs to start any instances of a Service Program (typically
a stored procedure) that responsible for reading the Message from the Queue.
That process is known as activation.

3. The Service Program normally begins a transaction, asks the Queue for
the next available Conversation Group ID and then reads the next available
Message for that conversation group using the RECEIVE statement. If and when
that transaction commits, it removes the message from the Queue (the removal
is actually done by the receive, but that's covered by the transaction in
case of failure.)

In the case where you just have a single Queue and Service Program, you SEND
the Message TO the same Service that the Message is FROM. You need to say
that a Message is from a Service since that service receives error and other
system Messages from Service Broker that will probably need to be processed.

Helpful?

Thanks!
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.