static void Main(string[] args) { Console.WriteLine("Welcome to ApiBridge Service Console!"); Initialize(); // wait to initialize Thread.Sleep(5000); Console.WriteLine("Ready..."); while (true) { Comment myComment = new Comment(); myComment.Text = "My Comment: " + Console.ReadLine(); CommentEvent commentEvent = new CommentEvent(); commentEvent.Comment = myComment; BusConfiguration.Instance.Bus.PublishAsync<CommentEvent>(commentEvent, (result) => { Console.WriteLine("Sent:" + result.IsSuccess); }); } }
/// <summary> /// Syndicates the comment event. /// </summary> /// <param name="comment">The comment.</param> void PublicCommentEvent(Comment comment) { try { CommentEvent newCommentEvent = new CommentEvent(); newCommentEvent.Comment = comment; BaseController.ServiceBus.PublishAsync<CommentEvent>(newCommentEvent, (result) => { }); } catch { } }
public void Save(Comment comment) { session.Store(comment); session.SaveChanges(); }