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.

  2. Always verify that the queue is available when hosting a queued service (this is done automatically by 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.

  11. On the client side, do not store a queued service proxy in a member variable.

  12. Avoid relatively short values of TimeToLive, as they negate the justification for a queued service.

  13. Avoid nontransactional queues.

  14. When using a response queue, have the service participate in the playback transaction and queue the response in that transaction.

  15. Have the response service participate in the response playback transaction.

  16. Avoid lengthy processing in a queued response operation.

  17. With MSMQ 3.0, prefer a response service to a poison queue service dealing with failures of the service itself.

  18. With MSMQ 4.0, use ReceiveErrorHandling.Reject for poison messages unless you have advanced processing with ReceiveErrorHandling.Move. Avoid ReceiveErrorHandling.Fault and ReceiveErrorHandling.Drop.

  19. With MSMQ 4.0, consider the use of a response service to handle service playback failures.

  20. Unless dealing with a sessionful contract and service, never assume the order of queued calls.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.75.221