/// <summary> /// Creates the completed. /// </summary> /// <param name="streamKey"></param> /// <param name="elapsed">The elapsed.</param> /// <param name="machineName">Name of the machine.</param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public static Marble CreateCompleted( string streamKey, TimeSpan elapsed, string machineName) { var msg = new Marble(streamKey, NotificationKind.OnCompleted, elapsed, machineName); return(msg); }
/// <summary> /// Creates the error. /// </summary> /// <param name="streamKey">The stream key.</param> /// <param name="ex">The ex.</param> /// <param name="elapsed">The elapsed.</param> /// <param name="machineName">Name of the machine.</param> /// <param name="formatter">The formatter.</param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public static Marble CreateError( string streamKey, Exception ex, TimeSpan elapsed, string machineName, Func <Exception, string> formatter = null) { formatter = formatter ?? DEFAULT_ERROR_FORMATTER; var msg = new Marble(streamKey, NotificationKind.OnError, elapsed, machineName); msg.Value = formatter(ex); return(msg); }
// TODO: Bnaya, 2015-10: #3, Enable custom serialization // consider using extension methods #region CreateNext /// <summary> /// Creates the specified name. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="streamKey">The stream key.</param> /// <param name="item">The item.</param> /// <param name="elapsed">The elapsed.</param> /// <param name="machineName">Name of the machine.</param> /// <param name="setting">The setting.</param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public static Marble CreateNext <T>( string streamKey, T item, TimeSpan elapsed, string machineName, JsonSerializerSettings setting = null) { setting = setting ?? Constants.JsonDefaultSetting; var msg = new Marble(streamKey, NotificationKind.OnNext, elapsed, machineName); msg.Value = JsonConvert.SerializeObject(item, setting); return(msg); }