예제 #1
0
        static void Main(string[] args)
        {
            var r    = new Random();
            var mbus = new NatsBus("Receiver-" /*+ r.Next(1000)*/);

            //mbus.SubscribeAsync<DoorOpenendMessage>(Callback);
            mbus.ReceiveAsync <DoorOpenendMessage>(Callback);

            Console.WriteLine("Hello World!");
        }
예제 #2
0
        static void Main(string[] args)
        {
            //var bus = new InmemoryMBus();
            //bus.Subscribe<DoorOpenendMessage>(Callback);
            //var v = new Vehicle(bus);

            //v.FrontDoorEvent += VOnFrontDoorEvent;

            //v.Open(new FrontDoor());

            var mbus = new NatsBus("Sender");

            mbus.OnDisconnected += (sender, handlerArgs) => { Console.WriteLine("Bloody hell! Disconnected!"); };


            //mbus.SubscribeAsync< DoorOpenendMessage>(Callback);

            for (int i = 0; i < 100; i++)
            {
                mbus.Send(new DoorOpenendMessage(DoorOpenendMessage.DoorType.Front, $"FHellon! {i}"));
                Console.WriteLine($"Publishing Message {i}");
                Thread.Sleep(1000);
            }
        }
 public ValuesController(NatsBus bus, IValuesRepository valuesRepository, ILog log)
 {
     this._bus = bus;
     this._valuesRepository = valuesRepository;
     this._log = log;
 }