Esempio n. 1
0
        private async Task runAction <T>() where T : IMessagingAction
        {
            var persistor = _host.Get <SqlServerEnvelopePersistence>();

            foreach (var envelope in _envelopes)
            {
                if (envelope.Status == TransportConstants.Outgoing)
                {
                    await persistor.StoreOutgoing(envelope, envelope.OwnerId);
                }
                else
                {
                    await persistor.StoreIncoming(envelope);
                }
            }

            var agent = DurabilityAgent.ForHost(_host);

            var action = _host.Get <T>();
            await agent.Execute(action);
        }
Esempio n. 2
0
        private async Task runAction <T>() where T : IMessagingAction
        {
            using (var session = theStore.LightweightSession())
            {
                foreach (var envelope in _envelopes)
                {
                    if (envelope.Status == EnvelopeStatus.Outgoing)
                    {
                        session.StoreOutgoing(_settings, envelope, envelope.OwnerId);
                    }
                    else
                    {
                        session.StoreIncoming(_settings, envelope);
                    }
                }

                await session.SaveChangesAsync();
            }

            var agent = DurabilityAgent.ForHost(_host);

            var action = _host.Get <T>();
            await agent.Execute(action);
        }