public void Initialize(string serviceId) { var service = this.consulService.GetServiceInfo(serviceId).First(); this.busConnectionDetails = new BusConnectionDetails(service.Address); this.bus = this.busFactory.BootstrapService(this.busConnectionDetails); this.serviceDetails = service; this.contractInitializationService.Initialize(serviceDetails); }
public MessageReciever(IBusFactory busFactory, IJsonTranslationService translationService) { this.translationService = translationService; var connectionDetails = new BusConnectionDetails("localhost"); var syncRecieve = SubscriberDetails.Create<SyncronousMessageRequest, SyncronousMessageResponse>(SyncRecieve); var asyncRecieve = SubscriberDetails.Create<AsyncronousMessageRequest>(AsyncRecieve); busFactory.BootstrapService(connectionDetails, syncRecieve, asyncRecieve ); }
public CustomerServiceReciever(IBusFactory busFactory, IJsonTranslationService translationService) { this.translationService = translationService; var connectionDetails = new BusConnectionDetails("localhost"); var getCustomerDetails = SubscriberDetails.Create<CustomerIdentifier, Customer>(GetCustomer); var testDetails = SubscriberDetails.Create<string, string>(Test); var addCustomerDetails = SubscriberDetails.Create<Customer>(AddCustomer); busFactory.BootstrapService(connectionDetails, getCustomerDetails, addCustomerDetails, testDetails); }
/// <summary> /// Using a connection streing and Subscription details this method will create and register a EasyNetQ /// bus and register the services describer in the Subscriber Details. /// </summary> /// <param name="connectionDetails"> The connection details of the service</param> /// <param name="subscriptions"> The details for the subscriptions.</param> /// <returns></returns> public IBus BootstrapService(BusConnectionDetails connectionDetails, params SubscriberDetails[] subscriptions) { IBus bus; if (!this.manager.Exists(connectionDetails.Host)) { bus = RabbitHutch.CreateBus(connectionDetails.GetConnectionString()); this.manager.Add(connectionDetails.Host, bus); } else { bus = this.manager.Get(connectionDetails.Host); } foreach (var subscription in subscriptions) { AddSubscription(bus, subscription); } return bus; }