Exemplo n.º 1
0
        public IChannel[] Start(IHandlerPipeline pipeline, BusSettings settings, OutgoingChannels channels)
        {
            _pipeline = pipeline;

            foreach (var messageType in _handlers.Chains.Select(x => x.MessageType).Where(x => x.CanBeCastTo <ClientMessage>()))
            {
                JsonSerialization.RegisterType(messageType.ToMessageAlias(), messageType);
            }

            _retries = channels.DefaultRetryChannel;

            return(new IChannel[] { new OutgoingWebSocketChannel(this) });
        }
Exemplo n.º 2
0
        public IChannel[] Start(IHandlerPipeline pipeline, BusSettings settings, OutgoingChannels channels)
        {
            _pipeline = pipeline;

            foreach (var address in settings.KnownSubscribers.Where(x => x.Uri.Scheme == Protocol))
            {
                Channels[address.Uri] = new StubChannel(address.Uri, _replyUri, pipeline, address);
            }

            foreach (var node in settings.Listeners.Where(x => x.Uri.Scheme == Protocol))
            {
                Channels.FillDefault(node.Uri);
            }



            return(Channels.GetAll().OfType <IChannel>().ToArray());
        }
Exemplo n.º 3
0
        public IChannel[] Start(IHandlerPipeline pipeline, BusSettings settings, OutgoingChannels channels)
        {
            if (_settings.State == TransportState.Disabled)
            {
                return(new IChannel[0]);
            }



            var provider = buildQueueProvider(channels);

            _sender.Start(this);

            _queues = new QueueCollection(Logger, provider, pipeline, _cancellation.Token);

            var queueNames = _settings.AllQueueNames();

            Persistence.Initialize(queueNames);

            foreach (var queue in _settings)
            {
                _queues.AddQueue(queue.Name, queue.Parallelization);
            }

            if (_settings.Port.HasValue)
            {
                _replyUri = $"{Protocol}://{settings.MachineName}:{_settings.Port}/{TransportConstants.Replies}"
                            .ToUri();


                _listener = new ListeningAgent(_queues, _settings.Port.Value, Protocol, _cancellation.Token);
                _listener.Start();
            }

            Persistence.RecoverOutgoingMessages(enqueue, _cancellation.Token);
            Persistence.RecoverPersistedMessages(queueNames, env => _queues.Enqueue(env.Queue, env), _cancellation.Token);

            return(settings.KnownSubscribers.Where(x => x.Uri.Scheme == Protocol)
                   .Select(x => new Channel(x, this)).OfType <IChannel>().ToArray());
        }
Exemplo n.º 4
0
 protected override IQueueProvider buildQueueProvider(OutgoingChannels channels)
 {
     return(new DurableQueueProvider(Persistence));
 }
Exemplo n.º 5
0
 protected abstract IQueueProvider buildQueueProvider(OutgoingChannels channels);
Exemplo n.º 6
0
 protected override IQueueProvider buildQueueProvider(OutgoingChannels channels)
 {
     return(new LightweightQueueProvider(() => channels[TransportConstants.RetryUri]));
 }
Exemplo n.º 7
0
 public IChannel[] Start(IHandlerPipeline pipeline, BusSettings settings, OutgoingChannels channels)
 {
     _settings     = settings.Loopback;
     _retryChannel = new Lazy <IChannel>(() => channels.DefaultRetryChannel);
     return(startListeners(pipeline, settings).ToArray());
 }
Exemplo n.º 8
0
 public IChannel[] Start(IHandlerPipeline pipeline, BusSettings settings, OutgoingChannels channels)
 {
     return(new IChannel[0]);
 }