internal void Start() { //Create a proxy to the event service EndpointAddress remoteAddress = new EndpointAddress(Config.Communincation.ServiceURI); NetNamedPipeBinding netNamedPipeBinding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); IChannelFactory<IEventService> channelFactory = new ChannelFactory<IEventService>(netNamedPipeBinding, remoteAddress); IEventService eventService = channelFactory.CreateChannel(remoteAddress); //Signal ready and wait for other threads to join. _syncStartBarrier.SignalAndWait(); EventSource eventSource = new EventSource() { ID = Guid.NewGuid(), Name = string.Format("Publisher:{0}", _Id) }; Console.WriteLine("{0} Running...", eventSource); Event @event = new Event() { Source = eventSource, Info = String.Format("EVENT PUBLISHED AT[{0}]", DateTime.Now.ToLongTimeString()), RecordedAt = DateTime.Now }; Byte[] bytes = ProtoBufSerializer.Serialize<Event>(@event); //Start publishing events for (Int64 i = 0; i < _iterations; i++) { eventService.Handle(bytes); } channelFactory.Close(); }
static void Main(string[] args) { using (var advancedBus = RabbitHutch.CreateBus("host=localhost").Advanced) { var exchange = advancedBus.ExchangeDeclare("events", ExchangeType.Topic); var queue = advancedBus.QueueDeclare("clientQueueName"); // TODO: Generate unique name for clients or we might get races for events var binding = advancedBus.Bind(exchange, queue, "Have.Auth.*"); advancedBus.Consume(queue, (x) => x .Add<Event>((message, info) => { Console.WriteLine("Got AuthResponse on Have.Auth, success: {0}", message.Body.Content.Success); }) ); // Send request to get authentication var authReq = new AuthenticationRequest() {Username = "******", Password = "******"}; var requestEvent = new Event(); requestEvent.Type = Event.EventType.request; requestEvent.Content = authReq; var requestMessage = new Message<Event>(requestEvent); Console.WriteLine("Press enter to send message"); while (true) { Console.ReadLine(); advancedBus.Publish(exchange, "Need.Auth.v1", false, false, requestMessage); } } }
private static void SendAuthResponse(IAdvancedBus advancedBus, IExchange exchange) { // Send auth success // TODO: Check the actual authentication stuff var responseEvent = new Event(); responseEvent.Type = Event.EventType.response; var response = new AuthenticationResponse(); response.Success = true; responseEvent.Content = response; var responseMessage = new Message<Event>(responseEvent); advancedBus.Publish(exchange, "Have.Auth.v1", false, false, responseMessage); }
protected override void OnNavigatedTo(NavigationEventArgs e) { Object obj = e.Parameter; Event = (Event)obj; UsernameBlock.Text = Event.User.UserName; DateCreateBlock.Text = Event.DateCreate.ToString(); DescriptionBlock.Text = Event.ShortDescription; LocationCaptionBlock.Text = Event.ShortLocationCaption; EventDateBlock.Text = Event.EventDate.ToString(); update(); }
private void Pushpin_Tap(object sender, RoutedEventArgs e) { Common.Event elem = (Common.Event)((Image)e.OriginalSource).DataContext; if (elem.misVisible == Visibility.Visible) { elem.misVisible = Visibility.Collapsed; } else { elem.misVisible = Visibility.Visible; } var index = eEvents.IndexOf(elem); eEvents.Remove(elem); eEvents.Insert(index, elem); }
public void Post(Event ev) { queue.Enqueue(ev); }
public static void LogEventCalls <T>(this Common.Event <T> e, string message) { e.Subscribe(f => Debug.Log(message)); }