SQLServer实战经验分享--ServiceBroker安全配置和使用示例
2009-02-12 10:23:49 来源:WEB开发网定义消息类型
CREATEMESSAGETYPE[http://Samples/SQL/ServiceBroker/msgOperation]
VALIDATION=VALID_XMLWITHSCHEMACOLLECTION
[http://Samples/SQL/ServiceBroker/msgOperationSchema];
定义消息契约
CREATECONTRACT[http://Samples/SQL/ServiceBroker/msgOperationContract]
(
[http://Samples/SQL/ServiceBroker/msgOperation]
SENTBYINITIATOR
);
初始方
定义队列
CREATEQUEUEmsgOperationInitQueue
WITH
STATUS=ON,
RETENTION=OFF
GO
定义初始服务
CREATESERVICE[http://Samples/SQL/ServiceBroker/msgOperationInitService]
ONQUEUEmsgOperationInitQueue
([http://Samples/SQL/ServiceBroker/msgOperationContract]);
GO
定义初始存储过程
CREATEPROCEDUREdbo.usp_msgOperation_SET
@msgIdint,
@msgContentnvarchar(2000)
AS
declare@message_bodyasxml([http://Samples/SQL/ServiceBroker/msgOperationSchema]);
declare@dialogasuniqueidentifier;
--填充消息体
SET@message_body='<msgOperation>
<msgId>'+cast(@msgIdasvarchar)+'</msgId>
<msgContent>'+@msgContent+'</msgContent>
</msgOperation>';
BEGINDIALOG@dialog
FROMSERVICE[http://Samples/SQL/ServiceBroker/msgOperationInitService]
TOSERVICE'http://Samples/SQL/ServiceBroker/msgOperationProcessService'
ONCONTRACT[http://Samples/SQL/ServiceBroker/msgOperationContract];
--WITHENCRYPTION=OFF,LIFETIME=3600;
--发送消息
SENDONCONVERSATION@dialog
MESSAGETYPE[http://Samples/SQL/ServiceBroker/msgOperation](@message_body);
ENDCONVERSATION@dialog;
GO
- ››sqlserver安装和简单的使用
- ››SqlServer触发器、存储过程和函数
- ››SQLServer建立交叉表查询
- ››SqlServer强制断开数据库连接的方法
- ››SQLServer 2005 海量数据解决方案
- ››SQLServer 2008数据库查看死锁、堵塞的SQL语句
- ››SqlServer 插入多条数据
- ››SQLServer 2008 R2导出的SQL文件中没有数据
- ››SQLSERVER通过游标查询两个数据表共有字段名组合成...
- ››sqlserver2008实现拼音首字母和随机n位数的生成
- ››SQLServer与Java数据类型对应表
- ››实战:企业使用交换机VLAN路由配置
更多精彩
赞助商链接