﻿using Glimpse.Web;
using System;

namespace Glimpse.Agent.Web
{
    public class AgentRuntime : IRequestRuntime
    {
        private readonly IMessagePublisher _messagePublisher;

        public AgentRuntime(IMessagePublisher messagePublisher)
        {
            _messagePublisher = messagePublisher;
        }

        public void Begin(IContext newContext)
        {
            var message = new BeginRequestMessage();

            // TODO: Full out message more

            _messagePublisher.PublishMessage(message);
        }

        public void End(IContext newContext)
        {
            var message = new EndRequestMessage();

            // TODO: Full out message more

            _messagePublisher.PublishMessage(message);
        }
    }
}
﻿using Glimpse.Web;
using System;

namespace Glimpse.Agent.Web
{
    public class AgentRuntime : IRequestRuntime
    {
        private readonly IMessageAgentBus _messageBus;

        public AgentRuntime(IMessageAgentBus messageBus)
        {
            _messageBus = messageBus;
        }

        public void Begin(IContext newContext)
        {
            var message = new BeginRequestMessage();

            // TODO: Full out message more

            _messageBus.SendMessage(message);
        }

        public void End(IContext newContext)
        {
            var message = new EndRequestMessage();

            // TODO: Full out message more

            _messageBus.SendMessage(message);
        }
    }
}
Switch over agent to using Agent bus
Switch over agent to using Agent bus

Instead of pushing to the publisher directly
