public AccidentRecordService(IAccidentRecordRepository accidentRecordRepository, IAccidentTypeRepository accidentTypeRepository, ICauseOfAccidentRepository causeOfAccidentRepository, IJurisdictionRepository jurisdictionRepository, IUserForAuditingRepository userForAuditingRepository, ICountriesRepository countriesRepository, IEmployeeRepository employeeRepository, ISiteRepository siteRepository, IDocumentTypeRepository documentTypeRepository, IInjuryRepository injuryRepository, IBodyPartRepository bodyPartRepository, IPeninsulaLog log, IBus bus) { _accidentRecordRepository = accidentRecordRepository; _accidentTypeRepository = accidentTypeRepository; _causeOfAccidentRepository = causeOfAccidentRepository; _jurisdictionRepository = jurisdictionRepository; _userForAuditingRepository = userForAuditingRepository; _countriesRepository = countriesRepository; _employeeRepository = employeeRepository; _siteRepository = siteRepository; _documentTypeRepository = documentTypeRepository; _log = log; _injuryRepository = injuryRepository; _bodyPartRepository = bodyPartRepository; _bus = bus; }
protected override void OnStart(string[] args) { BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("EndpointName"); busConfiguration.EnableInstallers(); bus = Bus.Create(busConfiguration).Start(); }
protected override void OnStart(string[] args) { try { container = new Container(x => x.AddRegistry<DependencyRegistry>()); var myDocumentStore = new DocumentStore { ConnectionStringName = "EpiFlowDB" }; var busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("EpiFlow.Messages"); busConfiguration.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(container)); busConfiguration.UseSerialization<JsonSerializer>(); busConfiguration.UsePersistence<RavenDBPersistence>() .UseDocumentStoreForSubscriptions(myDocumentStore) .UseDocumentStoreForSagas(myDocumentStore) .UseDocumentStoreForTimeouts(myDocumentStore); busConfiguration.UseTransport<RabbitMQTransport>(); busConfiguration.DefineCriticalErrorAction(OnCriticalError); busConfiguration.Transactions().DisableDistributedTransactions(); if (Environment.UserInteractive && Debugger.IsAttached) { busConfiguration.EnableInstallers(); } var startableBus = Bus.Create(busConfiguration); bus = startableBus.Start(); } catch (Exception exception) { OnCriticalError("Failed to start the bus.", exception); } }
public BreakpointsViewModel(IBus bus) : base(bus) { Contract.Requires<ArgumentNullException>(bus != null); this.Title = "Breakpoints"; }
static void SendOrder(IBus bus) { Console.WriteLine("Press enter to send a message"); Console.WriteLine("Press any key to exit"); while (true) { ConsoleKeyInfo key = Console.ReadKey(); Console.WriteLine(); if (key.Key != ConsoleKey.Enter) { return; } Guid id = Guid.NewGuid(); PlaceOrder placeOrder = new PlaceOrder { Product = "New shoes", Id = id }; bus.Send("Samples.StepByStep.Server", placeOrder); Console.WriteLine("Sent a new PlaceOrder message with id: {0}", id.ToString("N")); } }
/// <summary> /// Starts a <see cref="ServiceHost" /> for each found service. Defaults to <see cref="BasicHttpBinding" /> if /// no user specified binding is found /// </summary> public void Startup(Unicast.UnicastBus bus) { Bus = bus; var conventions = bus.Builder.Build<Conventions>(); var components = bus.Builder.Build<IConfigureComponents>(); foreach (var serviceType in bus.Settings.GetAvailableTypes().Where(t => !t.IsAbstract && IsWcfService(t, conventions))) { var host = new WcfServiceHost(serviceType); Binding binding = new BasicHttpBinding(); if (components.HasComponent<Binding>()) { binding = bus.Builder.Build<Binding>(); } host.AddDefaultEndpoint(GetContractType(serviceType), binding , String.Empty); hosts.Add(host); logger.Debug("Going to host the WCF service: " + serviceType.AssemblyQualifiedName); host.Open(); } }
public void SetUp() { testSender = MockRepository.GenerateStub<ISendMessages>(); messagePersister = new InMemoryPersistence(); httpChannel = new HttpChannel(messagePersister) { ListenUrl = "http://localhost:8092/Gateway/", ReturnAddress = "Gateway.Tests.Input" }; httpChannel.MessageReceived += httpChannel_MessageReceived; httpChannel.Start(); bus = Configure.With() .DefaultBuilder() .XmlSerializer() .FileShareDataBus("./databus") .InMemoryFaultManagement() .UnicastBus() .MsmqTransport() .CreateBus() .Start(); }
public void SetUp() { testSender = MockRepository.GenerateStub<ISendMessages>(); messagePersister = new InMemoryPersistence(); dataBusForTheReceivingSide = new FileShareDataBus(DATABUS_DIRECTORY); HttpChannelReceiver = new HttpChannelReceiver(messagePersister) { ListenUrl = "http://localhost:8092/Gateway/", DataBus = dataBusForTheReceivingSide }; HttpChannelReceiver.MessageReceived += httpChannel_MessageReceived; HttpChannelReceiver.Start(); bus = Configure.With() .DefaultBuilder() .XmlSerializer() .FileShareDataBus(DATABUS_DIRECTORY_FOR_THE_TEST_ENDPOINT) .InMemoryFaultManagement() .UnicastBus() .MsmqTransport() .CreateBus() .Start(); }
protected override void SetUp() { var logger = new ListLoggerFactory(detailed: true); // start the external timeout manager Configure.With(Using(new BuiltinHandlerActivator())) .Logging(l => l.Use(logger)) .Transport(t => t.UseMsmq(_queueNameTimeoutManager)) .Start(); _gotTheMessage = new ManualResetEvent(false); // start the client var client = Using(new BuiltinHandlerActivator()); client.Handle<string>(async str => _gotTheMessage.Set()); Configure.With(client) .Logging(l => l.Use(logger)) .Transport(t => t.UseMsmq(_queueName)) .Options(o => o.UseExternalTimeoutManager(_queueNameTimeoutManager)) .Start(); _bus = client.Bus; }
void InterfaceMessage(IBus bus) { #region InterfacePublish bus.Publish<IMyEvent>(m => { m.SomeProperty = "Hello world"; }); #endregion }
public void SetUp() { container = new Container(); container.RegisterAsEasyNetQContainerFactory(); bus = new MockBuilder().Bus; }
void Shutdown(IBus bus) { #region Hosting-Shutdown UnicastBus busImpl = (UnicastBus)bus; busImpl.Dispose(); #endregion }
public DocumentSearchViewModel(IBus bus, IEventAggregator eventAggregator) { if (bus == null) throw new ArgumentNullException("bus"); if (eventAggregator == null) throw new ArgumentNullException("eventAggregator"); _Bus = bus; _EventAggregator = eventAggregator; }
protected override void Given() { sr = Substitute.For<SourceRepoDriver>(); sr.GetLatestRevision().Returns(new RevisionInfo { Revision = "456" }); bus = Substitute.For<IBus>(); rc = new Domain.RevisionChecker(bus, url => sr); }
public void SetupMessaging(IBus coreInputBus) { coreInputBus.Subscribe<ProjectionCoreServiceMessage.Start>(_projectionCoreService); coreInputBus.Subscribe<ProjectionCoreServiceMessage.Stop>(_projectionCoreService); coreInputBus.Subscribe<ProjectionCoreServiceMessage.Tick>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.CreatePrepared>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.Dispose>(_projectionCoreService); coreInputBus.Subscribe<ProjectionSubscriptionManagement.Subscribe>(_projectionCoreService); coreInputBus.Subscribe<ProjectionSubscriptionManagement.Unsubscribe>(_projectionCoreService); coreInputBus.Subscribe<ProjectionSubscriptionManagement.Pause>(_projectionCoreService); coreInputBus.Subscribe<ProjectionSubscriptionManagement.Resume>(_projectionCoreService); coreInputBus.Subscribe<ProjectionCoreServiceMessage.CommittedEventDistributed>(_projectionCoreService); coreInputBus.Subscribe<ProjectionCoreServiceMessage.EventReaderIdle>(_projectionCoreService); coreInputBus.Subscribe<ProjectionCoreServiceMessage.EventReaderEof>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.Start>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.LoadStopped>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.Stop>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.Kill>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.GetState>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.GetDebugState>(_projectionCoreService); coreInputBus.Subscribe<CoreProjectionManagementMessage.UpdateStatistics>(_projectionCoreService); coreInputBus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_projectionCoreService); coreInputBus.Subscribe<ClientMessage.WriteEventsCompleted>(_projectionCoreService); //NOTE: message forwarding is set up outside (for Read/Write events) }
protected void Application_Start() { DocumentStore = new DocumentStore { DefaultDatabase = "Polyglot.UI.Orders", Url = "http://localhost:8080" }; DocumentStore.Initialize(); AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); Bus = Configure .With() .DefaultBuilder() .XmlSerializer() .MsmqTransport() .UnicastBus() .SendOnly(); }
public static void InitializeWith(this IEnumerable<ISaga> sagas, IBus bus) { foreach (var saga in sagas) { saga.Initialize(bus); } }
public void Setup() { _bus = MockRepository.GenerateStub<IBus>(); _productRenamedEventHandler = new ProductRenamedEventHandler(_bus); _productId = Guid.NewGuid(); }
public SchedulerService(IBus bus, IRawByteBus rawByteBus, ILog log, IScheduleRepository scheduleRepository) { this.bus = bus; this.scheduleRepository = scheduleRepository; this.rawByteBus = rawByteBus; this.log = log; }
protected override void SetUp() { using (var transport = new RabbitMqTransport(ConnectionString, _receiverQueueName, new NullLoggerFactory())) { transport.PurgeInputQueue(); } _receiver = new BuiltinHandlerActivator(); Using(_receiver); Configure.With(_receiver) .Logging(l => l.Console(LogLevel.Info)) .Transport(t => t.UseRabbitMq(ConnectionString, _receiverQueueName).Prefetch(1)) .Options(o => { o.SetNumberOfWorkers(1); o.SetMaxParallelism(1); }) .Start(); _sender = Configure.With(new BuiltinHandlerActivator()) .Logging(l => l.Console(LogLevel.Info)) .Transport(t => t.UseRabbitMqAsOneWayClient(ConnectionString)) .Routing(r => r.TypeBased().MapFallback(_receiverQueueName)) .Start(); Using(_sender); }
public NotificationService(IBus bus, ILogger logger, ILogEventBuilder eventBuilder) { _repository = new NotificationRepository(); _notificationPlayerRepository = new NotificationPlayerRepository(); _notificationRepository = new NotificationRepository(); //_publisher = new RabbitMqPublisher() //{ // MessageLookups = new List<MessageConfig>() // { // new MessageConfig() // { // ExchangeName = "PB.Events", // MessageType = typeof (NotificationCreated), // RoutingKey = "" // } // } //}; _bus = bus; _logger = logger; _eventBuilder = eventBuilder; _publisher = new RabbitMqPublisher(ConfigurationManager.AppSettings["Queue.Uri"]) { MessageLookups = new List<MessageConfig>() { new MessageConfig() { ExchangeName = "PB.Events", MessageType = typeof (NotificationCreated), RoutingKey = "" } } }; }
public static void Main() { BusG.Init (); Application.Init (); tv = new TextView (); ScrolledWindow sw = new ScrolledWindow (); sw.Add (tv); Button btn = new Button ("Click me"); btn.Clicked += OnClick; Button btnq = new Button ("Click me (thread)"); btnq.Clicked += OnClickQuit; VBox vb = new VBox (false, 2); vb.PackStart (sw, true, true, 0); vb.PackStart (btn, false, true, 0); vb.PackStart (btnq, false, true, 0); Window win = new Window ("D-Bus#"); win.SetDefaultSize (640, 480); win.Add (vb); win.Destroyed += delegate {Application.Quit ();}; win.ShowAll (); bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus")); Application.Run (); }
public AppointmentController( IBus bus, IAppointmentService appointmentService) { _bus = bus; _appointmentService = appointmentService; }
public SchedulerService(IBus bus, IEasyNetQLogger log, IScheduleRepository scheduleRepository, ISchedulerServiceConfiguration configuration) { this.bus = bus; this.log = log; this.scheduleRepository = scheduleRepository; this.configuration = configuration; }
public static void Init() { if (Bus != null) return; lock (SyncLock) { if (Bus != null) return; var cfg = new BusConfiguration(); cfg.EndpointName(MethodBase.GetCurrentMethod().DeclaringType.Namespace); cfg.UseTransport<MsmqTransport>(); cfg.UsePersistence<InMemoryPersistence>(); cfg.EnableInstallers(); cfg.UseSerialization<JsonSerializer>(); cfg.Conventions() .DefiningMessagesAs(t => t.Namespace != null && t.Namespace.EndsWith(".Messages")) .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith(".Commands")) .DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith(".Events")); Bus = NServiceBus.Bus.Create(cfg).Start(); } }
public MessageBusReplySessionChannel( BufferManager bufferManager, MessageEncoderFactory encoderFactory, ChannelManagerBase parent, EndpointAddress localAddress, IBus bus) : base(bufferManager, encoderFactory, parent, localAddress, bus) { }
protected void SetupQuoteClient() { if (QuoteClientEnabled) { Bus = RabbitHutch.CreateBus(QuoteClientConnectionString); string instrumentSymbol = Instrument.Symbol.ToUpperInvariant(); CurrentQuoteClientSubscription = string.Format( "{0}.{1}.{2}", EnvironmentManager.GetNormalizedMachineName(), ProjectName, instrumentSymbol) .ToUpperInvariant() .Replace("-", "") .Replace("_", ""); LoggingUtility.WriteInfoFormat(this, "ENABLING quote client with sub id: {0}", CurrentQuoteClientSubscription); Bus.Subscribe<OnBarOpenMessage>(CurrentQuoteClientSubscription, HandleOnBarOpenFromBus, x => x.WithTopic(instrumentSymbol)); Bus.Subscribe<OnBarMessage>(CurrentQuoteClientSubscription, HandleOnBarFromBus, x => x.WithTopic(instrumentSymbol)); Bus.Subscribe<OnQuoteMessage>(CurrentQuoteClientSubscription, HandleOnQuoteFromBus, x => x.WithTopic(instrumentSymbol)); NumberOfQuotes = 0; QuoteClientStartAt = DateTime.Now; } else { LoggingUtility.WriteInfo(this, "Quote client is NOT ENABLED"); } }
static void Main(string[] args) { var ip = Ask("Please enter server IP[:port]: "); var user = Ask("Please enter your nick name: "); using (_bus = RabbitHutch.CreateBus("host=" + ip, x => x.Register<IEasyNetQLogger>(_ => new EmptyLogger()))) { SendJoinedMessage(user); Console.WriteLine("You will be joined to chat soon. If you will want to leave just enter message 'exit'"); SubscribeToMessages(user); while (true) { Console.Write("> "); var msg = Console.ReadLine(); if (msg.Equals("exit", StringComparison.InvariantCultureIgnoreCase)) { SendExitMessage(user); break; } SendMessage(_bus, user, msg); } } }
public MessageBusInputChannel( BufferManager bufferManager, MessageEncoderFactory encoder, ChannelManagerBase parent, EndpointAddress localAddress, IBus bus) : base(bufferManager, encoder, parent) { _localAddress = localAddress; _bus = bus; _aLock = new object(); _tryReceiveDelegate = (TimeSpan timeout, out Message message) => { message = null; try { var requestMessage = _bus.Receive(true, null); if (requestMessage != null) { message = GetWcfMessageFromString(requestMessage.Content); OnAfterTryReceive(requestMessage); } } catch (Exception ex) { throw new CommunicationException(ex.Message, ex); } return true; }; _receiveDelegate = (TimeSpan timeout) => { var requestMessage = _bus.Receive(false, ChannelID); return GetWcfMessageFromString(requestMessage.Content); }; }
public MessageStuffer(Type messageType) { _messageType = messageType; AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve); _bus = CreateBus(); AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(AssemblyResolve); }
public VirtualMachineStateChangedEventHandler(IBus bus) { _bus = bus; }
public BusClientFactoryContext(IBus bus, RequestTimeout defaultTimeout = default) { _bus = bus; DefaultTimeout = defaultTimeout.HasValue ? defaultTimeout : RequestTimeout.Default; }
public LogicalInstruction(byte opCode, IExecutionUnit eu, IBus bus) : base(opCode, eu, bus) { }
public ListenerService(int listenerId) { this.listenerId = listenerId; bus = Depot.Connect("localhost/workflow"); }
public TrainingSessionsService(ExercisesDbContext context, IBus publisher) : base(context) { this.context = context; this.publisher = publisher; }
public ISubscriptionFailureStrategy BuildFaultStrategy(IBus bus) { return(failureStrategyBuilder(bus)); }
void InterfaceMessage(IBus bus) { #region InterfacePublish bus.Publish <IMyEvent>(m => { m.SomeProperty = "Hello world"; }); #endregion }
public MySaga(ManualResetEvent done, IBus bus) { _done = done; _bus = bus; }
public HomeController(IBus bus) { _bus = bus; }
public FuncionarioCommandHandler(IUnitOfWork uow, IBus bus, IDomainNotificationHandler <DomainNotification> notification, IFuncionarioRepository funcionarioRepository) : base(uow, bus, notification) { _bus = bus; _funcionarioRepository = funcionarioRepository; }
protected CommandProcessor(IBus bus, IServiceScopeFactory serviceScopeFactory) : base(serviceScopeFactory) { this.bus = bus; }
public InstanceDisposer(IBus bus) { this.bus = bus; }
public MessageSender(IBus bus, ILogger<MessageSender> logger) { _bus = bus; _logger = logger; }
public PhotographerAppService(IMapper mapper, IBus bus, IPhotographerRepository repository) : base(mapper, bus) { _mapper = mapper; _repository = repository; }
protected override void ConnectObservers(IBus bus) { _activityMonitor = bus.CreateBusActivityMonitor(TimeSpan.FromMilliseconds(500)); }
public void SetUp() { bus = RabbitHutch.CreateBus("host=localhost"); }
public RabbitMQEventBus(string host, string username, string password) { _bus = RabbitHutch.CreateBus($"host={host};username={username};password={password}"); }
public DefaultScheduler(IBus bus, IScheduledTaskStorage scheduledTaskStorage) { this.bus = bus; this.scheduledTaskStorage = scheduledTaskStorage; }
public static void WithWrapping(Cpu cpu, IBus bus) { cpu.AddressLatchLow += cpu.CpuState.X; }
public CreateSmallThumbnail(IBus bus) { this.bus = bus; }
public void TestCleanup() { _messageRepository = null; _inMemomoryBus = null; }
public static void WithWrapping(Cpu cpu, IBus bus) { cpu.EffectiveAddressLatchLow += cpu.CpuState.Y; }
public CommandHandler(IUnitOfWork uow, IBus bus, IDomainNotificationHandler <DomainNotification> notifications) { _uow = uow; _bus = bus; _notifications = notifications; }
public ScheduleMyTasks(IBus bus, Schedule schedule) { this.bus = bus; this.schedule = schedule; }
public async Task StopFaulted(IBus bus, Exception exception) { Console.WriteLine(string.Concat(_logger, ": Bus exception at shut-down: ", exception.Message , " for bus ", bus.Address)); await Task.FromResult(0); }
public void TestInit() { _messageRepository = new MessageRepository(); _inMemomoryBus = new InMemoryBus(); }
public async Task PostStop(IBus bus) { Console.WriteLine(string.Concat(_logger, ": Bus has been stopped with address ", bus.Address)); await Task.FromResult(0); }
public SomeAwesomeViewModel(IBus bus) { this.bus = bus; }
public async Task PostStart(IBus bus, Task busReady) { Console.WriteLine(string.Concat(_logger, ": Bus has been started with address ", bus.Address)); await busReady; }
public async Task PreStop(IBus bus) { Console.WriteLine(string.Concat(_logger, ": Bus is about to stop with address ", bus.Address)); await Task.FromResult(0); }