Section C.10. Queued Services


C.10. Queued Services

  1. Always verify that the queue (and a dead-letter queue when applicable) is available before calling the queued service. Use QueuedServiceHelper.VerifyQueue<T>( ) to verify.

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

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

  4. Do enable metadata exchange on a queued service.

  5. The service should participate in the playback transaction.

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

  7. Avoid sessionful queued services.

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

  9. When using a per-call queued service, do 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 {...} 

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

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

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

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

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

  14. Never use volatile queues.

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

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

  17. Avoid lengthy processing in a queued response operation.

  18. Prefer a response service to a poison queue service dealing with repeated failures of the service itself.

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




Programming WCF Services
Programming WCF Services
ISBN: 0596526997
EAN: 2147483647
Year: 2004
Pages: 148
Authors: Juval Lowy

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net