0

I am reading Programming WCF Services 3rd Ed. by Juval Lowy. In the chapter "Queued Services" which covers NetMsmqBinding, On page 473, he says "... you should keep the service's processing of the queued call relatively short, or risk aborting the playback transaction. An important observation here is that it is wrong to equate queued calls with lengthy asynchronous calls."

1) What is a short call? 2) What is the best practice for long running operations; send send them off to the ThreadPool?

This article ran into the same problem in practice: WCF & MSMQ & TransactionScope long process

I have looked and looked, and I cannot find any best practices regarding this matter on the internet.

3) Does this rule apply if I have no transaction?

Community
  • 1
  • 1
Phillip Scott Givens
  • 5,256
  • 4
  • 32
  • 54

1 Answers1

0

1) By default a short process with a transaction is something that takes less than 10 minutes (default transaction timeout) 2) Can be, but if you do that you will lose the transactional behavior (if the server goes down the message will be lost) 3) Yes. By default the transaction scope has a default timeout that will abort your transaction.

The good news is that you can override that timeout on machine.config file: http://blogs.inkeysolutions.com/2012/01/managing-timeouts-while-using.html

adpmatos
  • 69
  • 7
  • Thank you for responding. I find your first two answers useful. The third question asks about working without a transaction. Is the transaction the only limitting factor? Is there documentation on the subject? – Phillip Scott Givens Sep 04 '13 at 16:44
  • Yes, it is. If you do not use a transaction to process the message you do not have that problem anymore (maybe you just have to configure the receiveTimeout,... see: http://msdn.microsoft.com/en-us/library/hh924831.aspx) But, in the other hand, if you do not use a transaction if an error occurs or if the machine is powered off (for some reason) the message will be lost. At this point you have to find out how critical is to lost a message. About documentation on the subject I found a cool explanation in this book: http://www.amazon.com/Programming-WCF-Services-Mastering-AppFabric/dp/0596805489. – adpmatos Sep 07 '13 at 12:27
  • Did you just refer me back to the book for which the question was generated? Could you point me to the cool explanation? It did not seem to be in my copy and thus the SO query. – Phillip Scott Givens Sep 10 '13 at 15:48
  • I don't know any article online that talks about that. But basicly on that book (I have the first version) the author talks about the playback transaction. If you do not define a transaction scope within your operation you are not on a context of a transaction and no transaction timeout will be applied. But, if your operation will take some time to run possibly you'll need to configure the properties openTimeout, closeTimeout, sendTimeout and receiveTimeout on your binding element (see: http://msdn.microsoft.com/en-us/library/hh924831.aspx) – adpmatos Sep 11 '13 at 15:38
  • If you do not define a transaction scope within your operation ([OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]) the playback transaction will end at the moment the message reaches the service. So you will no longer have the operation aborted by a transaction timeout. But in the other hand, you will lose a message if an error ocurres inside the service. Give me a call if need any help testing this. – adpmatos Sep 11 '13 at 15:42