private static void WaitForRunnableInstance(InstanceStore store, InstanceHandle ownerHandle) { try { store.WaitForEvents(ownerHandle, TimeSpan.MaxValue); } catch (Exception) { } }
private static void WaitForRunnableInstance() { bool foundWorkflow; do { foundWorkflow = InstanceStore.WaitForEvents(InstanceHandle, TimeSpan.MaxValue).Any( persistenceEvent => persistenceEvent == HasRunnableWorkflowEvent.Value); }while (!foundWorkflow); #if DEBUG Trace.WriteLine("Found registration workflow with expired timer"); #endif }
private static bool WaitForRunnableInstance(InstanceStore store, InstanceHandle handle, TimeSpan timeout) { try { var storeEvents = store.WaitForEvents(handle, timeout); foreach (var storeEvent in storeEvents) { if (storeEvent.Equals(HasRunnableWorkflowEvent.Value)) { return(true); } } return(false); } catch (TimeoutException) { return(false); } }
private static void WaitForRunnableInstance(InstanceStore store, InstanceHandle ownerHandle) { IEnumerable <InstancePersistenceEvent> events = store.WaitForEvents(ownerHandle, TimeSpan.MaxValue); bool foundRunnable = false; // Loop through the persistence events looking for the HasRunnableWorkflow event (in this sample, it corresponds with // the workflow instance whose timer has expired and is ready to be resumed by the host). foreach (InstancePersistenceEvent persistenceEvent in events) { if (persistenceEvent.Equals(HasRunnableWorkflowEvent.Value)) { foundRunnable = true; break; } } if (!foundRunnable) { throw new ApplicationException("Unexpected: No runnable instances found in the instance store"); } }