示例#1
0
 private static void WaitForRunnableInstance(InstanceStore store, InstanceHandle ownerHandle)
 {
     try
     {
         store.WaitForEvents(ownerHandle, TimeSpan.MaxValue);
     }
     catch (Exception)
     {
     }
 }
示例#2
0
        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
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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");
            }
        }