In this article, you will learn to create the target database and all Service Broker target objects that have no dependencies on the initiator database. Perform these steps from a copy of Management Studio that is running on the same computer as the target instance of the Database Engine.
-
Copy the following code and paste it into the Query Editor window. Then, run the code to create a Service Broker endpoint for this instance of the Database Engine. The Service Broker endpoint establishes the network address to which Service Broker messages are sent. The endpoint uses the Service Broker default TCP port 4022 to establish the remote instance of the Database Engine that will use a Windows Authentication connection to send messages.
Windows authentication works when both computers are in the same domain or in trusted domains. If the computers are not in trusted domains, use certificate security for the endpoints.
Copy code
USE master; GO IF EXISTS (SELECT * FROM master.sys.endpoints WHERE name = N'InstTargetEndpoint') DROP ENDPOINT InstTargetEndpoint; GO CREATE ENDPOINT InstTargetEndpoint STATE = STARTED AS TCP (LISTENER_PORT = 4022) FOR SERVICE_BROKER (AUTHENTICATION = WINDOWS); GO
-
Copy the following code and paste it into the query editor window. Change the password in the CREATE MASTER KEY statement. Then, run the code to create the target database for this tutorial. By default, new databases have the ENABLE_BROKER option set to ON. The code also creates a master key and user to support encryption and remote connections.
USE master; GO IF EXISTS (SELECT * FROM sys.databases WHERE name = N'InstTargetDB') DROP DATABASE InstTargetDB; GO CREATE DATABASE InstTargetDB; GO USE InstTargetDB; GO CREATE MASTER KEY ENCRYPTION BY PASSWORD = N''; GO CREATE USER TargetUser WITHOUT LOGIN; GO
-
Copy the following code and paste it into the Query Editor window. Change the file name specified in the BACKUP CERTIFICATE statement to reference a folder on your system. Then, run the code to create the target certificate used to encrypt messages. The folder you specify should have permissions set to allow access to the folder only to your Windows account and the Windows account used to run the Database Engine instance, but not to any other account. For Lesson 2, you must manually copy the InstTargetCertificate.cer file to a folder accessible from the initiator instance.
CREATE CERTIFICATE InstTargetCertificate AUTHORIZATION TargetUser WITH SUBJECT = 'Target Certificate', EXPIRY_DATE = N'12/31/2010'; BACKUP CERTIFICATE InstTargetCertificate TO FILE = N'C:\storedcerts\$ampleSSBCerts\InstTargetCertificate.cer'; GO
-
Copy the following code and paste it into the query editor window, then run the code to create a message type for the session. The message type name and properties specified here must be the same as the message type name and properties created in the next lesson in InstInitiatorDB .
CREATE MESSAGE TYPE [//BothDB/2InstSample/RequestMessage] VALIDATION = WELL_FORMED_XML; CREATE MESSAGE TYPE [//BothDB/2InstSample/ReplyMessage] VALIDATION = WELL_FORMED_XML; GO
-
Copy the following code and paste it into the query editor window. Then, run the code to create a convention for the session. The convention name and properties specified here must be the same as the convention name and properties created in the next lesson in InstInitiatorDB .
CREATE CONTRACT [//BothDB/2InstSample/SimpleContract] ([//BothDB/2InstSample/RequestMessage] SENT BY INITIATOR, [//BothDB/2InstSample/ReplyMessage] SENT BY TARGET ); GO
-
Copy the following code and paste it into the query editor window. Then, run the code to create the queue and service to use as the target. The CREATE SERVICE statement associates the service with the InstTargetQueue so that all messages sent to the service are received into the InstTargetQueue . CREATE SERVICE also specifies that only sessions that use the previously created //BothDB/2InstSample/SimpleContract can use the service as a target service.
Copy codeCREATE QUEUE InstTargetQueue; CREATE SERVICE [//TgtDB/2InstSample/TargetService] AUTHORIZATION TargetUser ON QUEUE InstTargetQueue ([//BothDB/2InstSample/SimpleContract]); GO
You have successfully created the database that you will use for this tutorial. Next, you will create InstInitiatorDB and configure it with the objects required to support the Service Broker session initiator endpoint.
Previous article:What is Multisim
Next article:Introduction to Data Collection, Data Collection Terminology
- Popular Resources
- Popular amplifiers
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Check in, welcome to communicate
- China's first batch of autonomous driving unmanned commercial licenses issued! Do you dare to sit in an unmanned car? ?
- GDB debugging and DSP
- The IO pin of MSP430 is set as input, but it receives the output signal of the Hall sensor, and the chip-side signal does not switch.
- [Serial] [Starlight Lightning STM32F407 Development Board] Chapter 10 Serial Communication Experiment
- Where do errors in vector network analyzers come from?
- How to use a wiring harness tester to measure small resistance? Here's a method
- Those who don't know about RF MEMS, please take a look. This is what the technology is like.
- General Design Considerations for Embedded Systems
- Download the NI white paper "Overcoming the Challenges of Production Test for Complex Devices Under Test" for free and get a chance to win prizes!