SQL Server Service Borker 1
1、消息类型定义:
消息类型,是信息交换的模板、create message type message_type_name validattion = well_formed_xml;
2、约定定义:
约定,指示任务使用的消息 create contract contract_name (message_type_name sent by initiator |target | all [....]);
3、队列定义:
队列是信息的集合: create queue queue_name with status = on;
4、服务定义:
服务定义端口用来把消息绑定到一个或多个约定上 create service service_name on queue queue_name(contract_name_list);
例子:
create database bookstore;
create database bookdistribution;
----时间 执行者 目的
----2014-10-30 蒋乐 创建两个数据库用于测试 service broker!
go
use bookstore;
alter database bookstore
set enable_broker;
alter database bookstore
set trustworthy on;
create master key
encryption by password ='123456';
----时间 执行者 目的
----2012-10-30 蒋乐 配制数据库的 3(enable_broker\trustworthy\master key) 个选项使它支持 service borker
go
use bookdistribution;
alter database bookdistribution
set enable_broker;
alter database bookdistribution
set trustworthy on;
create master key
encryption by password = '123456';
----时间 执行者 目的
----2012-10-30 蒋乐 配制数据库的 3(enable_broker\trustworthy\master key) 个选项使它支持 service borker
go
use bookstore;
create message type [send_to_distribution]
validation = well_formed_xml;
create message type [send_to_distribution_received]
validation = well_formed_xml;
create contract [send_to_distribution_contract](
[send_to_distribution] sent by initiator,
[send_to_distribution_received] sent by target);
----时间 执行者 目的
----2012-10-30 蒋乐 定义消息类型与约定、(注意在两个相互通信的数据库中
--要有一样的消息类型与约定才可以通信。
go
use bookdistribution;
create message type [send_to_distribution]
validation = well_formed_xml;
create message type [send_to_distribution_received]
validation = well_formed_xml;
create contract [send_to_distribution_contract](
[send_to_distribution] sent by initiator,
[send_to_distribution_received] sent by target);
----时间 执行者 目的
----2012-10-30 蒋乐 定义消息类型与约定。
go
use bookstore;
create queue [send_to_bookdistribution_queue]
with
status = on;
----时间 执行者 目的
----2012-10-30 蒋乐 定义队列
go
use bookdistribution;
create queue [send_to_bookdistribution_queueBookDistribution]
with
status = on;
----时间 执行者 目的
----2012-10-30 蒋乐 定义队列
go
use bookstore;
create service [send_to_distribution_service_bookstore]
on queue send_to_bookdistribution_queue(send_to_distribution_contract);
----时间 执行者 目的
----2012-10-30 蒋乐 定义服务
go
use bookdistribution
create service [send_to_distribution_service_bookdistribution]
on queue send_to_bookdistribution_queueBookDistribution(send_to_distribution_contract);
----时间 执行者 目的
----2012-10-30 蒋乐 定义服务
go
use bookstore;
declare @handle uniqueidentifier;
declare @message xml;
begin dialog conversation @handle
from service send_to_distribution_service_bookstore
to service 'send_to_distribution_service_bookdistribution' -- ! _ ! -- :因为它定义在别的数据库中、所以不可以用名字。要用字符串。
on contract send_to_distribution_contract;
set @message = '<Person>11436101</Person>';
send on conversation @handle message type send_to_distribution
(@message);
----时间 执行者 目的
----2012-10-30 蒋乐 发送一个异步的消息
go
use bookdistribution;
select * from dbo.send_to_bookdistribution_queueBookDistribution;
----时间 执行者 目的
----2012-10-30 蒋乐 查看发送过来的消息
go

SQL Server Service Borker 1的更多相关文章
- The SQL Server Service Broker for the current database is not enabled
把一个数据恢复至另一个服务器上,出现了一个异常: The SQL Server Service Broker for the current database is not enabled, and ...
- SQL Server Service Broker创建单个数据库会话
概述 SQL Server Service Broker 用来创建用于交换消息的会话.消息在目标和发起方这两个端点之间进行交换.消息用于传输数据和触发消息收到时的处理过程.目标和发起方既可以在同一数据 ...
- SQL Server Service Broker创建单个数据库会话(消息队列)
概述 SQL Server Service Broker 用来创建用于交换消息的会话.消息在目标和发起方这两个端点之间进行交换.消息用于传输数据和触发消息收到时的处理过程.目标和发起方既可以在同一数据 ...
- 在Windows Server 2008 R2 Server中,连接其他服务器的数据库遇到“未启用当前数据库的 SQL Server Service Broker,因此查询通知不受支持。如果希望使用通知,请为此数据库启用 Service Broker ”
项目代码和数据库部署在不同的Windows Server 2008 R2 Server中,错误日志显示如下: "未启用当前数据库的 SQL Server Service Broker,因此查 ...
- SQL Server Service Broker(简称SSB)资料
SQL server Service Broker (下面简称SSB) 是SQL server 里面比较独特的一个功能.它可帮助开发人员构建异步的松散耦合应用程序.SSB的一些功能和好处包括有: 数据 ...
- SQL Server Service Broker 简单例子 (转)
SQL Server Service Broker服务体系结构 消息类型 — 定义应用程序间交换的消息的名称.还可以选择是否验证消息.约定 — 指定给定会话中的消息方向和消息类型.队列 — 存储消息. ...
- sql server Service Broker 相关查询
sql server Service Broker 相关查询 -- 查看传输队列中的消息 --如果尝试从队列中移除时,列将表明哪里出现了问题 select * from sys.transmissio ...
- Reusing dialogs with a dialog pool--一个sql server service broker例子
一个sql server service broker例子 ----------------------------------- USE master GO -------------------- ...
- SQL问题:未启用当前数据库的 SQL Server Service Broker
数据库分离后,附加回到数据库,然后在程序中打开调用数据库的页面,出现如下问题:“未启用当前数据库的 SQL Server Service Broker,因此查询通知不受支持.如果希望使用通知,请为此数 ...
随机推荐
- CSS实例:水平居中和垂直居中的多种解决方案
1.单行垂直居中 文字在层中垂直居中vertical-align 属性是做不到的.我们这里有个比较巧妙的方法就是:设置height的高度与line-height的高度相同! Example Sourc ...
- BestCoder Round #75 1001 - King's Cake
Problem Description It is the king's birthday before the military parade . The ministers prepared a ...
- 编写jquery插件
一.类级别($.extend) 类级别你可以理解为拓展jquery类,最明显的例子是$.ajax(...),相当于静态方法. 开发扩展其方法时使用$.extend方法,即jQuery.extend(o ...
- jquery ajax提交及请求
jQuery.ajax({ url: dataURL, success: function(results) { var parsedJson = jQuery.parseJSON(results); ...
- python---连接MySQL第四页
python缓存结果集式的cursor可以用来提高性能. 例子: #!conding:utf-8 from mysql.connector import errorcode import mysql. ...
- 怎查看linux系统的位数
# uname -a x86_64则说明你是64位内核, 跑的是64位的系统. i386, i686说明你是32位的内核, 跑的是32位的系统
- 重新关联bat文件的打开方式为系统默认方式
为什么“BAT”扩展名的默认打开方式:显示出来的居然是“%1”这么一个怪异的东东,具体在什么位置的? c:\windowssystem32\command.com修复bat关联,打开command.c ...
- 翻书的效果:FMX.TSwipeTransitionEffect Animation
This example shows how to use a TSwipeTransitionEffect transition and a TPathAnimation to simulate t ...
- 搭建本地Ubuntu 镜像服务器
一.需求分析 最近公司软件Team 有个需求是这样的:能不能在局域网搭建一个Ubuntu 镜像服务器, 这样作的好处是可以节省Ubuntu某些常用工具的安装时间. 二.部署过程 2.1 测试环境 目前 ...
- #include <strstream>
std::ostrstream MYOUT(str, sizeof(str)); 拼接字符串 #include <iostream> #include <strstream> ...