Lesson 2: Creating the Target Conversation Objects

In this lesson, you will learn to build all the objects that enable a database to be the target of a conversation from another database.

Switch to the TargetDB database

  • Copy and paste the following code into a Query Editor window. Then, run it to switch context to the TargetDB database.

    USE TargetDB;
    GO
    

Create the message types

  • Copy and paste the following code into a Query Editor window. Then, run it to create the message types for the conversation. The message type names and properties that you specify must be identical to the ones that you will create in the InitiatorDB in the next lesson.

    CREATE MESSAGE TYPE [//BothDB/2DBSample/RequestMessage]
           VALIDATION = WELL_FORMED_XML;
    CREATE MESSAGE TYPE [//BothDB/2DBSample/ReplyMessage]
           VALIDATION = WELL_FORMED_XML;
    GO
    

Create the contract

  • Copy and paste the following code into a Query Editor window. Then, run it to create the contract for the conversation. The contract name and properties that you specify must be identical to the contract you will create in the InitiatorDB in the next lesson.

    CREATE CONTRACT [//BothDB/2DBSample/SimpleContract]
          ([//BothDB/2DBSample/RequestMessage]
             SENT BY INITIATOR,
           [//BothDB/2DBSample/ReplyMessage]
             SENT BY TARGET
          );
    GO
    

Create the target queue and service

  • Copy and paste the following code into a Query Editor window. Then, run it to create the queue and service that is used for the target. The CREATE SERVICE statement associates the service with the TargetQueue2DB so that all messages that are sent to the service will be received into the TargetQueue2DB. The CREATE SERVICE also specifies that only conversations that use the //BothDB/2DBSample/SimpleContract that you created earlier can use the service as a target service.

    CREATE QUEUE TargetQueue2DB;
    
    CREATE SERVICE [//TgtDB/2DBSample/TargetService]
           ON QUEUE TargetQueue2DB
           ([//BothDB/2DBSample/SimpleContract]);
    GO
    

You have successfully configured TargetDB to support a conversation between it and the InitiatorDB. Next, you will configure the InitiatorDB to initiate a conversation to the TargetDB. See Lesson 3: Creating the Initiator Conversation Objects.

Community Additions

ADD
Show: