Thanks,
Gi
You'd need to send separate messages (one for each party) in separate
conversations for this to happen. Or have the first reader store the
information is a state table to be read by other "readers". It would
probably be "cleaner" to have separate queues/services and have the sender
send a message to each service. Or two have a service who's job it is to
"multiplex" messages. At this point in time, service broker has no built-in
way to broadcast a message to multiple recipients. If I'm understanding
correctly, this most corresponds to the concept of monologs which was not
implemented in service broker in SQL Server 2005/2008.
Here's an article that shows how to simulate monologs with broker:
http://www.codeproject.com/KB/reporting-services/SimulatingMonologConverse.aspx?display=Print.
There is a company named TwoConnect (http://www.twoconnect.com) that had an
implementation of monologs in broker once, but I don't currently see it on
their web site.
Hope this helps,
Bob Beauchemin
SQLskills
"GiJeet" <gij...@yahoo.com> wrote in message
news:11068af3-ed02-4ae3...@n21g2000vba.googlegroups.com...
Thanks.
Just to clarify. I have several stores that take loan applications
and all send to a single loan approval site, a single approval site is
responsible for several stores. So it’s a M:1 situation. That is, 10
stores will send to 1 approval site. Then another 10 stores to
another single approval site, etc.. I want the messages from the
stores to queue up in the approval site’s queue but I don’t want to
create 10 queues just for this single approval site if I don’t have
to. Why should this single approval site have to check 10 queues
right?
This seems the opposite of a multicast where a single store can SEND
to multiple queues. I want a single queue to RECEIVE from multiple
sites (queues). Is this possible in SQL2005?
TIA
Gi
--
Hope this helps.
Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/
"GiJeet" <gij...@yahoo.com> wrote in message
news:a68f0dfd-dc79-4f99...@h5g2000yqh.googlegroups.com...
I'm sorry but you kinda lost me on this.
As I said before, I need one Target to be able to receive messages
from multiple Initiators. How to set this up, if possible?
With all the different objects: contracts, services, queues, etc. I’m
not sure how to set this type of architecture up.
I ordered the book from Amazon but by the time it gets to me and I
read it…the project will be basically over… :)
A single target service can have multiple concurrent conversations going on
with different initiators. Each conversation will have a different
conversation_handle. You'll probably need a state table to track the
different states of the loan applications in progress.
Below is a slightly beefed up DDL example from the earler thread. I'm
running short on time now but I'll try to proved more detail on the
conversation flow later.
CREATE MESSAGE TYPE LoanApplicationInformation
VALIDATION = WELL_FORMED_XML;
CREATE MESSAGE TYPE LoanApplicationResponse
VALIDATION = WELL_FORMED_XML;
CREATE CONTRACT LoanApplcation
AUTHORIZATION dbo
( LoanApplicationInformation SENT BY INITIATOR,
LoanApplicationResponse SENT BY TARGET );
CREATE QUEUE dbo.LoanTakerQueue;
CREATE SERVICE LoanTakerService
AUTHORIZATION dbo
ON QUEUE dbo.LoanTakerQueue
(LoanApplcation);
CREATE QUEUE dbo.LoanReviewerQueue;
CREATE SERVICE LoanReviewerService
AUTHORIZATION dbo
ON QUEUE dbo.LoanReviewerQueue
(LoanApplcation);
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/
"GiJeet" <gij...@yahoo.com> wrote in message
news:c665b816-8f9e-41fd...@v15g2000vbb.googlegroups.com...
The example below shows a conversation flow between 2 stores and a single
target. In a real world implementation, a state table would probably be
used to track the in-progress loan applications for each store, including
the conversation handle that each store will need to recieve only its
messagess.
CREATE MESSAGE TYPE LoanApplicationInformation
VALIDATION = WELL_FORMED_XML;
CREATE MESSAGE TYPE LoanApplicationResponse
VALIDATION = WELL_FORMED_XML;
CREATE CONTRACT LoanApplication
AUTHORIZATION dbo
( LoanApplicationInformation SENT BY INITIATOR,
LoanApplicationResponse SENT BY TARGET );
CREATE QUEUE dbo.LoanTakerQueue;
CREATE SERVICE LoanTakerService
AUTHORIZATION dbo
ON QUEUE dbo.LoanTakerQueue
(LoanApplication);
CREATE QUEUE dbo.LoanReviewerQueue;
CREATE SERVICE LoanReviewerService
AUTHORIZATION dbo
ON QUEUE dbo.LoanReviewerQueue
(LoanApplication);
GO
--store 0001 starts conversation and sends initial loan information
DECLARE @conversation_handle uniqueidentifier, @StateInformation xml
BEGIN DIALOG CONVERSATION @conversation_handle
FROM SERVICE LoanTakerService
TO SERVICE 'LoanReviewerService'
ON CONTRACT LoanApplication
WITH ENCRYPTION = OFF;
SELECT @conversation_handle AS conversation_handle;
SEND ON CONVERSATION @conversation_handle
MESSAGE TYPE LoanApplicationInformation
('<LoanApplicationInformation>
<InitiatingStoreID>0001</InitiatingStoreID>
<ApplicantName>John Doe</ApplicantName>
<LoanAmount>500</LoanAmount>
</LoanApplicationInformation>');
GO
--store 0002 starts conversation and sends initial loan information
DECLARE @conversation_handle uniqueidentifier, @StateInformation xml
BEGIN DIALOG CONVERSATION @conversation_handle
FROM SERVICE LoanTakerService
TO SERVICE 'LoanReviewerService'
ON CONTRACT LoanApplication
WITH ENCRYPTION = OFF;
SELECT @conversation_handle AS conversation_handle;
SEND ON CONVERSATION @conversation_handle
MESSAGE TYPE LoanApplicationInformation
('<LoanApplicationInformation>
<InitiatingStoreID>0002</InitiatingStoreID>
<ApplicantName>Jane Smith</ApplicantName>
<ApplicantAddress>123 Test Name</ApplicantAddress>
<LoanAmount>500</LoanAmount>
</LoanApplicationInformation>');
GO
--Reviewer: get loan application from store 0001 and requests more
information
DECLARE @message_body XML,
@message_type_name nvarchar(256),
@conversation_handle uniqueidentifier;
RECEIVE
@message_body = CAST(message_body AS XML),
@message_type_name = message_type_name,
@conversation_handle = conversation_handle
FROM dbo.LoanReviewerQueue;
SELECT @message_body message_body,
@conversation_handle,
@message_type_name;
SEND ON CONVERSATION @conversation_handle
MESSAGE TYPE LoanApplicationResponse
('<LoanApplicationResponse>
<Status>Need Applicant Address</Status>
</LoanApplicationResponse>');
GO
--Reviewer: get loan application sent from store 0002 and approves
application
DECLARE @message_body XML,
@message_type_name nvarchar(256),
@conversation_handle uniqueidentifier;
RECEIVE
@message_body = CAST(message_body AS XML),
@message_type_name = message_type_name,
@conversation_handle = conversation_handle
FROM dbo.LoanReviewerQueue;
SELECT @message_body message_body,
@conversation_handle,
@message_type_name;
SEND ON CONVERSATION @conversation_handle
MESSAGE TYPE LoanApplicationResponse
('<LoanApplicationResponse>
<Status>Approved</Status>
</LoanApplicationResponse>');
END CONVERSATION @conversation_handle;
GO
--store 0001 gets request from more info and responds with address info
DECLARE @message_body XML,
@message_type_name nvarchar(256),
@conversation_handle uniqueidentifier;
--note @conversation_handle value in WHERE clause is same as initial SEND
RECEIVE
@message_body = CAST(message_body AS XML),
@message_type_name = message_type_name
FROM dbo.LoanTakerQueue
WHERE conversation_handle = @conversation_handle;
SELECT @message_body message_body,
@conversation_handle,
@message_type_name;
SEND ON CONVERSATION @conversation_handle
MESSAGE TYPE LoanApplicationInformation
('<LoanApplicationInformation>
<ApplicantAddress>123 Main Street</ApplicantAddress>
</LoanApplicationInformation>');
GO
--store 0002 gets approved status and end dialog message and ends
conversation
DECLARE @message_body XML,
@message_type_name nvarchar(256),
@conversation_handle uniqueidentifier;
--note @conversation_handle value in WHERE clause is same as initial SEND
RECEIVE
@message_body = CAST(message_body AS XML),
@message_type_name = message_type_name
FROM dbo.LoanTakerQueue
WHERE conversation_handle = @conversation_handle;
SELECT @message_body message_body,
@conversation_handle,
@message_type_name;
END CONVERSATION @conversation_handle;
GO
--Reviewer: get additional information from store 0001, sends rejected
status and ends conversation
DECLARE @message_body XML,
@message_type_name nvarchar(256),
@conversation_handle uniqueidentifier;
RECEIVE
@message_body = CAST(message_body AS XML),
@message_type_name = message_type_name,
@conversation_handle = conversation_handle
FROM dbo.LoanReviewerQueue;
SELECT @message_body message_body,
@conversation_handle,
@message_type_name;
SEND ON CONVERSATION @conversation_handle
MESSAGE TYPE LoanApplicationResponse
('<LoanApplicationResponse>
<Status>Rejected</Status>
</LoanApplicationResponse>');
END CONVERSATION @conversation_handle
GO
--store 0002 gets rejected status, end dialog message and ends conversation
DECLARE @message_body XML,
@message_type_name nvarchar(256),
@conversation_handle uniqueidentifier;
--note @conversation_handle value in WHERE clause is same as initial SEND
RECEIVE
@message_body = CAST(message_body AS XML),
@message_type_name = message_type_name
FROM dbo.LoanTakerQueue
WHERE conversation_handle = @conversation_handle;
SELECT @message_body message_body,
@conversation_handle,
@message_type_name;
END CONVERSATION @conversation_handle;
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/
"GiJeet" <gij...@yahoo.com> wrote in message
news:c665b816-8f9e-41fd...@v15g2000vbb.googlegroups.com...