예제 #1
0
        private void Process(CommandEnvelope commandEnvelope)
        {
            using (var session = _sessionFactory.OpenSession())
            {
                var executeAfterDate = session.Get <CommandRecord>(commandEnvelope.Sequence).ExecuteAfterDate;
                if (DateTime.UtcNow > executeAfterDate)
                {
                    using (var tx = session.BeginTransaction())
                    {
                        var host = _hostFactory.Create(session);
                        commandEnvelope.Payload.Execute(host);
                        _hostFactory.Release(host);
                        CommandQueue.MarkProcessed(commandEnvelope.Sequence, session);

                        tx.Commit();
                    }
                }
            }
        }
예제 #2
0
 public void EnqueueCommand(object command, DateTime executeAfter)
 {
     CommandQueue.Enqueue(command, _session, executeAfter);
 }