Ejemplo n.º 1
0
        public InMemoryHost(IInMemoryHostConfiguration hostConfiguration, IInMemoryHostTopology hostTopology)
            : base(hostConfiguration, hostTopology)
        {
            _hostConfiguration = hostConfiguration;

            _messageFabric = new MessageFabric(hostConfiguration.TransportConcurrencyLimit);
        }
Ejemplo n.º 2
0
        public GrpcHostNode(IMessageFabric messageFabric, NodeContext context)
            : base(messageFabric, context)
        {
            _hostTopology = new HostNodeTopology();

            SetReady();
        }
Ejemplo n.º 3
0
        public RemoteNodeTopology(IGrpcNode node, IMessageFabric messageFabric)
        {
            _node          = node;
            _messageFabric = messageFabric;

            _entries     = new Dictionary <long, TopologyEntry>();
            _receiverMap = new Dictionary <ReceiverKey, long>();
        }
Ejemplo n.º 4
0
        public InMemoryHost(IInMemoryHostConfiguration hostConfiguration, IInMemoryHostTopology hostTopology)
            : base(hostConfiguration, hostTopology)
        {
            _hostConfiguration = hostConfiguration;

            _messageFabric = new MessageFabric(hostConfiguration.TransportConcurrencyLimit);

            var cache = new GreenCache <InMemorySendTransport>(hostConfiguration.SendTransportCacheSettings);

            _index = cache.AddIndex("exchangeName", x => x.ExchangeName);
        }
Ejemplo n.º 5
0
        public InMemoryHost(IInMemoryHostConfiguration hostConfiguration, int concurrencyLimit)
            : base(hostConfiguration)
        {
            _hostConfiguration = hostConfiguration;

            _messageFabric = new MessageFabric(concurrencyLimit);

            var cacheSettings = new CacheSettings(10000, TimeSpan.FromMinutes(1), TimeSpan.FromHours(24));

            var cache = new GreenCache <InMemorySendTransport>(cacheSettings);

            _index = cache.AddIndex("exchangeName", x => x.ExchangeName);
        }
Ejemplo n.º 6
0
        public InMemoryHost(int concurrencyLimit, IHostTopology topology, Uri baseAddress = null)
        {
            Topology = topology;
            _baseUri = baseAddress ?? new Uri("loopback://localhost/");

            _messageFabric = new MessageFabric(concurrencyLimit);

            _receiveEndpoints = new ReceiveEndpointCollection();

            var cache = new GreenCache <InMemorySendTransport>(10000, TimeSpan.FromMinutes(1), TimeSpan.FromHours(24), () => DateTime.UtcNow);

            _index = cache.AddIndex("exchangeName", x => x.ExchangeName);
        }
Ejemplo n.º 7
0
        public InMemoryHost(IInMemoryHostConfiguration hostConfiguration, int concurrencyLimit, IHostTopology topology, Uri baseAddress = null)
        {
            _hostConfiguration = hostConfiguration;
            Topology           = topology;
            Address            = baseAddress ?? new Uri("loopback://localhost/");

            _messageFabric = new MessageFabric(concurrencyLimit);

            _receiveEndpoints = new ReceiveEndpointCollection();
            Add(_receiveEndpoints);

            var cacheSettings = new CacheSettings(10000, TimeSpan.FromMinutes(1), TimeSpan.FromHours(24));

            var cache = new GreenCache <InMemorySendTransport>(cacheSettings);

            _index = cache.AddIndex("exchangeName", x => x.ExchangeName);
        }
Ejemplo n.º 8
0
        public GrpcNode(IMessageFabric messageFabric, NodeContext context)
        {
            _messageFabric = messageFabric;
            _context       = context;

            _remoteTopology = new RemoteNodeTopology(this, messageFabric);

            var outputOptions = new UnboundedChannelOptions
            {
                SingleWriter = false,
                SingleReader = true,
                AllowSynchronousContinuations = true
            };

            _channel = System.Threading.Channels.Channel.CreateUnbounded <TransportMessage>(outputOptions);

            Writer = _channel.Writer;
        }
Ejemplo n.º 9
0
        public GrpcTransportProvider(IGrpcHostConfiguration hostConfiguration, IGrpcTopologyConfiguration topologyConfiguration)
        {
            _hostConfiguration     = hostConfiguration;
            _topologyConfiguration = topologyConfiguration;

            _messageFabric = new MessageFabric();

            _nodeCollection = new NodeCollection(this, _messageFabric);
            _clients        = new List <IGrpcClient>();

            var transport = new GrpcTransportService(this, _hostConfiguration, _nodeCollection);

            _server = new Server(GetChannelOptions())
            {
                Services = { TransportService.BindService(transport) },
                Ports    = { new ServerPort(hostConfiguration.BaseAddress.Host, hostConfiguration.BaseAddress.Port, ServerCredentials.Insecure) }
            };

            var serverPort = _server.Ports.First();

            HostAddress = new UriBuilder(_hostConfiguration.BaseAddress)
            {
                Host = serverPort.Host,
                Port = serverPort.BoundPort
            }.Uri;

            HostNodeContext = new HostNodeContext(HostAddress);

            _hostNode = new GrpcHostNode(_messageFabric, HostNodeContext);

            var observer = new NodeMessageFabricObserver(_nodeCollection, _hostNode);

            _messageFabric.ConnectMessageFabricObserver(observer);

            _startupTask = new Lazy <Task>(() => Task.Run(() => Startup()));
        }
Ejemplo n.º 10
0
 public InMemoryConsumeTopologyBuilder(IMessageFabric messageFabric)
 {
     _messageFabric = messageFabric;
 }
Ejemplo n.º 11
0
 public PublishEndpointTopologyBuilder(IMessageFabric messageFabric, Options options = Options.MaintainHierarchy)
 {
     _messageFabric = messageFabric;
     _options       = options;
 }
Ejemplo n.º 12
0
 public NodeCollection(ISupervisor supervisor, IMessageFabric messageFabric)
 {
     _supervisor    = supervisor;
     _messageFabric = messageFabric;
     _nodes         = new ConcurrentDictionary <Uri, IGrpcNode>();
 }
Ejemplo n.º 13
0
 public GrpcPublishTopologyBuilder(NodeContext context, IMessageFabric messageFabric)
 {
     _context       = context;
     _messageFabric = messageFabric;
 }
Ejemplo n.º 14
0
 public GrpcConsumeTopologyBuilder(NodeContext context, IMessageFabric fabric)
 {
     _context = context;
     _fabric  = fabric;
 }