title: Service Fabric reliable queue long operation
body: <p>I'm trying to understand some best practices for service fabric.</p>
  
  <p>If I have a queue that is added to by a web service or some other mechanism and a back end task to process that queue what is the best approach to handle long running operations in the background.</p>
  
  <ol>
  <li>Use TryPeekAsync in one transaction, process and then if successful use TryDequeueAsync to finally dequeue. </li>
  <li>Use TryDequeueAsync to remove an item, put it into a dictionary and then remove from the dictionary when complete. On startup of the service, check the
  dictionary for anything pending before the queue.</li>
  </ol>
  
  <p>Both ways feel slightly wrong, but I can't work out if there is a better way.</p>