I'm new to Service Broker
Message Type
CREATE MESSAGE TYPE [http://ssb.csharp.at/SSB_Book/c03/RequestMessage]
VALIDATION = WELL_FORMED_XML
GO
CREATE MESSAGE TYPE [http://ssb.csharp.at/SSB_Book/c03/ResponseMessage]
VALIDATION = WELL_FORMED_XML
GO
Contract
CREATE CONTRACT [http://ssb.csharp.at/SSB_Book/c03/HelloWorldContract]
(
[http://ssb.csharp.at/SSB_Book/c03/RequestMessage] SENT BY INITIATOR,
[http://ssb.csharp.at/SSB_Book/c03/ResponseMessage] SENT BY TARGET
)
GO
Queue
CREATE QUEUE InitiatorQueue
WITH ACTIVATION
(
STATUS = ON,
PROCEDURE_NAME = [ProcessResponseMessage],
MAX_QUEUE_READERS = 1,
EXECUTE AS SELF
)
CREATE QUEUE TargetQueue
WITH ACTIVATION
(
STATUS = ON,
PROCEDURE_NAME = [ProcessRequestMessage],
MAX_QUEUE_READERS = 1,
EXECUTE AS SELF
)
Service
CREATE SERVICE InitiatorService
ON QUEUE InitiatorQueue
(
[http://ssb.csharp.at/SSB_Book/c03/HelloWorldContract]
)
GO
CREATE SERVICE TargetService
ON QUEUE TargetQueue
(
[http://ssb.csharp.at/SSB_Book/c03/HelloWorldContract]
)
GO
Codes above are the example.
The question is I want to response the message to another queue(ErrorQueue for example) instead of InitiatorQueue. I've did research on Google but I can't find any resources that related to my question.
I've some idea but don't know if it's working:
- Add another message type into Contract:
[http://ssb.csharp.at/SSB_Book/c03/ErrorMessage] SENT BY INITIATOR
But I don't know whether to set it as INITIATOR, TARGET or ANY - Create another Contract for it, if this is the solution please provide an example.
Thanks