public IList<IDisposable> Start() { List<IDisposable> servers = new List<IDisposable>(); //Initialize startup object var startup = new Startup(); string baseAddress = null; //baseAddress = "http://localhost:9000/"; //Uncomment this line to also listen via HTTP on localhost:9000 //Start WebAPI OWIN host servers.Add(WebApp.Start(url: baseAddress, startup: startup.Configuration)); //Start RestBus Subscriber/host var amqpUrl = ConfigurationManager.AppSettings["rabbitmqserver"]; //AMQP URI for RabbitMQ server var serviceName = "test"; //Uniquely identifies this service var msgMapper = new BasicMessageMapper(amqpUrl, serviceName); var subscriber = new RestBusSubscriber(msgMapper); var host = new RestBusHost(subscriber, startup.Config); host.Start(); Console.WriteLine("Server started ... Ctrl-C to quit."); servers.Add(host); return servers; }
static void Main() { //Initialize startup object var startup = new Startup(); string baseAddress = null; //baseAddress = "http://localhost:9000/"; //Uncomment this line to also listen on localhost:9000 //Start WebAPI OWIN host using (WebApp.Start(url: baseAddress, startup: startup.Configuration)) { //Start RestBus Subscriber/host var amqpUrl = ConfigurationManager.AppSettings["ServerUri"]; //AMQP URI for RabbitMQ server var serviceName = "speedtest"; //Uniquely identifies this service var msgMapper = new BasicMessageMapper(amqpUrl, serviceName); var subscriber = new RestBusSubscriber(msgMapper); using (var host = new RestBusHost(subscriber, startup.Config)) { host.Start(); Console.WriteLine("Server started ... Ctrl-C to quit."); Console.ReadLine(); } } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //*** Start RestBus subscriber/host **// var amqpUrl = "amqp://localhost:5672"; //AMQP URL for RabbitMQ installation var serviceName = "samba"; //Uniquely identifies this service var msgMapper = new BasicMessageMapper(amqpUrl, serviceName); var subscriber = new RestBusSubscriber(msgMapper); restbusHost = new RestBusHost(subscriber, GlobalConfiguration.Configuration); restbusHost.Start(); //****// }