Pages

Wednesday, 25 June 2014

SQL Server: Service Broker application

In a Service Broker conversation, a contract defines the types of messages allowed and the conversation participants that can send these messages. In this scenario, DBA/Developer created a message type named//NuTex.com/ Research/SurveyData. DBA/Developer can then use the CREATE CONTRACT statement to create the contract to be used in conversations. The syntax of the CREATE CONTRACT statement is as follows:
CREATE CONTRACT contract_name
[AUTHORIZATION owner_name]({{message_type | [DEFAULT]}SENT BY {INITIATOR |TARGET | ANY} [,...n]);

In this scenario, the Research database is the initiator and receives messages from the Prod database. To accomplish this, DBA/Developer must indicate that the conversation initiator can send messages by specifying either SENT BY INITIATOR or SENT BY ANY in the CREATE CONTRACT statement for the message type.DBA/Developer should not use the statement that includes the SENT BY TARGET clause because this statement will generate an error. Specifying the SENT BY TARGET clause indicates that only the target in the conversation can send messages of the specified message type. Each contract must contain at least one message specifying SENT BY INITIATOR or SENT BY ANY, or an error occurs. DBA/Developer should not use the statement that specifies SurveyData as the message type because this statement will generate a syntax error. In this scenario, the name of the message type is //NuTex.com/Research/ SurveyData. DBA/Developer should not use the statement that specifies [DEFAULT] as the message type because the [DEFAULT] message type has validation set to NONE, indicating the data is not validated. In this scenario, the data is in XML format and requires the validation as specified in the message type DBA/Developer created. When DBA/Developer create a message type, DBA/Developer can specify one of the following types of validation:

EMPTY: Indicates that the message body will be NULL.
NONE: Indicates that validation will not be performed. This type of validation is used for binary data.
WELL_FORMED_XML: Indicates that the message body will contain well-formed XML data.
VALID_XML WITH SCHEMA COLLECTION schema_collection_name: Indicates that the message body will contain XML data that will be validated against a predefined XML schema in the specified schema collection.
 

No comments:

Post a Comment