• [织梦吧]唯一域名:www.dedecms8.com,织梦DedeCMS学习平台.

当前位置: > 编程与数据库 > net编程 >

WCF服务编程设计规范(6):队列服务、安全和服务总线

来源: www.dedecms8.com 编辑:织梦吧 时间:2012-06-27点击:

 WCF服务编程设计规范(6):队列服务、安全和服务总线。本节整理队列服务(Queue Servuce)、服务安全(Service Security)和服务总线(Service Bus)的设计规范。

Queued Services

队列服务

1. On the client, always verify that the queue (and a dead-letter queue, when applicable) is available before calling the queued service. Use QueuedServiceHelper.VerifyQueues() for this purpose.

在客户端,在调用队列服务以前,始终检查队列是否可用(如果可以的话,也包括确认死信队列)。使用QueuedServiceHelper.VerifyQueues()方法检查。

2. Always verify that the queue is available when hosting a queued service (this is done automatically by ServiceHost<T>).

当托管队列服务的时候始终检查队列是否可用(ServiceHost<T>会自动检测)

3. Except in isolated scenarios, avoid designing the same service to work both queued and non-queued.

除了某些单独的场景,避免避免在同一个服务里同时使用队列和非队列服务

4. The service should participate in the playback transaction.

服务应该参与到回放事务中

5. When participating in the playback transaction, avoid lengthy processing in the queued service.

当参与到回放事务里,避免队列服务里出现冗长的处理工作

6. Avoid sessionful queued services.

避免使用会话性队列服务

7. When using a singleton queued service, use a volatile resource manager to manage the singleton state.

当使用单例队列服务时,使用易失资源管理器去管理单例状态

 

8. When using a per-call queued service, explicitly configure the contract and the service to be per-call and sessionless:

当使用单调队列服务时,明确设置服务和契约的单调和非回话属性

[ServiceContract(SessionMode = SessionMode.NotAllowed)]
interface IMyContract
{...}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
class MyService : IMyContract
{...}

9. Always explicitly set contracts on a queued singleton to disallow sessions:

始终禁止在单例队列服务模式下使用会话

[ServiceContract(SessionMode = SessionMode.NotAllowed)]
interface IMyContract
{...}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
class MyService : IMyContract
{...}

10. The client should call a queued service inside a transaction.

客户端应该在一个事务内部调用队列服务

About D8

  • ©2014 织梦吧(d8) DedeCMS学习交流平台
  • 唯一网址 www.DedeCMS8.com 网站地图
  • 联系我们 1170734538@qq.com ,  QQ