internal void InternalStart(int numberOfWorkers) { if (started) { throw new InvalidOperationException(string.Format(@"Bus has already been started - cannot start bus twice! Not that it actually matters, I mean we _could_ just ignore subsequent calls to Start() if we wanted to - but if you're calling Start() multiple times it's most likely a sign that something is wrong, i.e. you might be running you app initialization code more than once, etc.")); } if (receiveMessages is OneWayClientGag) { log.Info("Rebus {0} will be started in one-way client mode", rebusId); numberOfWorkers = 0; busMode = BusMode.OneWayClientMode; } InitializeServicesThatMustBeInitialized(); log.Info("Initializing bus with {0} workers", numberOfWorkers); SetNumberOfWorkers(numberOfWorkers); started = true; log.Info("Bus started"); }
void InternalStart(int numberOfWorkers) { if (started) { throw new InvalidOperationException(string.Format(@"Bus has already been started - cannot start bus twice! Not that it actually matters, I mean we _could_ just ignore subsequent calls to Start() if we wanted to - but if you're calling Start() multiple times it's most likely a sign that something is wrong, i.e. you might be running you app initialization code more than once, etc.")); } if (receiveMessages.GetType().Name == "OneWayClientGag") { log.Warn("Bus will be started in the experiment one-way client mode - setting number of workers to 0 (original value was {0}...)", numberOfWorkers); numberOfWorkers = 0; busMode = BusMode.OneWayClientMode; } log.Info("Initializing bus with {0} workers", numberOfWorkers); SetNumberOfWorkers(numberOfWorkers); started = true; log.Info("Bus started"); }
void EnsureBusModeIsNot(BusMode busModeToAvoid, string message, params object[] objs) { if (busMode != busModeToAvoid) { return; } throw new InvalidOperationException(string.Format(message, objs)); }