public void enable_and_disable_transport() { theSettings.StateFor("tcp").ShouldBe(TransportState.Enabled); theSettings.DisableTransport("tcp"); theSettings.StateFor("tcp").ShouldBe(TransportState.Disabled); theSettings.EnableTransport("tcp"); theSettings.StateFor("tcp").ShouldBe(TransportState.Enabled); }
public void StartListening(BusSettings settings) { if (settings.StateFor(Protocol) == TransportState.Disabled) { return; } var incoming = settings.Listeners.Where(x => x.Scheme == Protocol).ToArray(); assertNoDuplicatePorts(incoming); foreach (var uri in incoming) { var agent = new SocketListeningAgent(uri.Port, settings.Cancellation); var listener = uri.IsDurable() ? _persistence.BuildListener(agent, _workerQueue) : new LightweightListener(_workerQueue, _logger, agent); _listeners.Add(listener); listener.Start(); } if (incoming.Any()) { var uri = incoming.First(); var port = uri.Port; LocalReplyUri = uri.ToMachineUri(); } }
public async Task Activate(HandlerGraph handlers, CapabilityGraph capabilities, JasperRuntime runtime, ChannelGraph channels, LocalWorkerSender localWorker) { var capabilityCompilation = capabilities.Compile(handlers, _serialization, channels, runtime, _transports, _lookups); var transports = _transports.Where(x => _settings.StateFor(x.Protocol) != TransportState.Disabled) .ToArray(); _settings.Workers.Compile(handlers.Chains.Select(x => x.MessageType)); localWorker.Start(_persistence, _workerQueue); if (!_settings.DisableAllTransports) { await _settings.ApplyLookups(_lookups); channels.Start(_settings, transports, _lookups, capabilities); _delayedJobs.Start(_workerQueue); } runtime.Capabilities = await capabilityCompilation; if (runtime.Capabilities.Errors.Any() && _settings.ThrowOnValidationErrors) { throw new InvalidSubscriptionException(runtime.Capabilities.Errors); } }
private void organizeTransports(BusSettings settings, ITransport[] transports) { transports.Where(x => settings.StateFor(x.Protocol) != TransportState.Disabled) .Each(t => _transports.Add(t.Protocol, t)); // Super duper hokey if (_transports.ContainsKey("http") && !_transports.ContainsKey("https")) { _transports["https"] = _transports["http"]; } }
public async Task Activate(LocalWorkerSender localWorker, CapabilityGraph capabilities, JasperRuntime runtime, GenerationRules generation, PerfTimer timer) { timer.MarkStart("ServiceBusActivator"); _handlers.Compile(generation, runtime, timer); var capabilityCompilation = capabilities.Compile(_handlers, Serialization, _channels, runtime, _transports, Lookup); var transports = _transports.Where(x => _settings.StateFor(x.Protocol) != TransportState.Disabled) .ToArray(); timer.Record("WorkersGraph.Compile", () => { _settings.Workers.Compile(_handlers.Chains.Select(x => x.MessageType)); }); localWorker.Start(_persistence, Workers); if (!_settings.DisableAllTransports) { timer.MarkStart("ApplyLookups"); await _settings.ApplyLookups(Lookup); timer.MarkFinished("ApplyLookups"); timer.Record("ChannelGraph.Start", () => { _channels.As <ChannelGraph>().Start(_settings, transports, Lookup, capabilities, Logger, Workers); }); ScheduledJobs.Start(Workers); } runtime.Capabilities = await capabilityCompilation; if (runtime.Capabilities.Errors.Any() && _settings.ThrowOnValidationErrors) { throw new InvalidSubscriptionException(runtime.Capabilities.Errors); } timer.MarkFinished("ServiceBusActivator"); }