我们有一个工作(主要是)Service Broker设置。一个问题是我们忘记在合同中添加消息类型(EndTransmission
),因此我创建了一个新合同并将其添加到两个服务中。
CREATE CONTRACT [http://bob.us/Locations/Contracts/VolatileData3]
([http://bob.us/Locations/MessageTypes/Resource/EndTransmission] SENT BY ANY)
ALTER SERVICE [//Locations/Here/Send/VolatileDataReceiveService]
(ADD CONTRACT [http://bob.us/Locations/Contracts/VolatileData3]) ;
ALTER SERVICE [//Locations/Here/Send/VolatileDataSendService]
(ADD CONTRACT [http://bob.us/Locations/Contracts/VolatileData3]) ;
我仍然收到EndTransmission不属于服务合同的错误。我还需要做其他事吗?我无法设置新的经纪人,因为我在可用性组中。
我想在一项服务上签订两份合同。据我所知,这是可以接受的。我知道在添加第二份合同时我没有收到错误。
答案 0 :(得分:1)
您的新合同应包含上一个合同中的所有消息,和新消息。您只需要将合同绑定到目标服务。
错误似乎表明你仍然在BEGIN DIALOG中使用旧合约。
举一个例子:说你有一份使用两种消息类型的合同:
CREATE CONTRACT [http://bob.us/Locations/Contracts/VolatileData1]
([http://bob.us/Locations/MessageTypes/Resource/Request] SENT BY INITIATOR,
[http://bob.us/Locations/MessageTypes/Resource/Response] SENT BY TARGET);
CREATE SERVICE [//Locations/Here/Send/VolatileDataReceiveService] ON [...]
([http://bob.us/Locations/Contracts/VolatileData1]) ;
现在您意识到需要添加EndTransmision消息类型。您将创建一个包含所有三种消息类型的新合同:
CREATE CONTRACT [http://bob.us/Locations/Contracts/VolatileData2]
([http://bob.us/Locations/MessageTypes/Resource/Request] SENT BY INITIATOR,
[http://bob.us/Locations/MessageTypes/Resource/Response] SENT BY TARGET,
[http://bob.us/Locations/MessageTypes/Resource/EndTransmission] SENT BY ANY);
ALTER SERVICE [//Locations/Here/Send/VolatileDataReceiveService]
(ADD CONTRACT [http://bob.us/Locations/Contracts/VolatileData2]) ;
现在使用新合约开始所有新对话框。