public void alertTest() { AlertClient.SetOpation(new AlertOpation { AppId = "chejiatiantianbao", Service = "service399", Url = "http://172.20.12.58:9093/api/v1/alerts" }); Exception ex = null; try { var a = 0; var d = 1 / a; } catch (Exception e) { ex = e; } Task.Run(async() => { for (int i = 0; i < 5; i++) { bool ss = await AlertClient.SendAlertAsync("²âÊÔ±¨´í1", "²ÎÊý:" + i.ToString(), null, ex); Assert.IsTrue(ss); } // Actual test code here. }).GetAwaiter().GetResult(); }
static void Main(string[] args) { AlertClient.SetOpation(new AlertOpation { AppId = "chejiatiantianbao", Service = "service3991", Url = "http://172.20.12.58:9093/api/v1/alerts" }); Task.Run(async() => { await AlertClient.SendAlertAsync("测试报错1", "参数", null, new Exception("错误1")); }).GetAwaiter().GetResult(); }
static void Main(string[] args) { Console.WriteLine(string.Format("connecting to: ws://{0}:{1}", ConfigurationManager.AppSettings["host"], ConfigurationManager.AppSettings["port"])); switch (ConfigurationManager.AppSettings["client_type"]) { case "0": using (DataClient client = new DataClient(ConfigurationManager.AppSettings["host"], int.Parse(ConfigurationManager.AppSettings["port"]), ConfigurationManager.AppSettings["accesskey"], ConfigurationManager.AppSettings["accesssecret"])) { try { client.subscribe(ConfigurationManager.AppSettings["subid"], ConfigurationManager.AppSettings["consumergroup"]); foreach (var message in client.GetMessages()) { Console.WriteLine(string.Format("got message on client, key: {0}, partition: {1}, offset: {2}, value: {3}", message.key, message.partition, message.offset, message.value)); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } break; case "1": using (AlertClient client = new AlertClient(ConfigurationManager.AppSettings["host"], int.Parse(ConfigurationManager.AppSettings["port"]), ConfigurationManager.AppSettings["accesskey"], ConfigurationManager.AppSettings["accesssecret"])) { try { client.subscribe(ConfigurationManager.AppSettings["subid"], ConfigurationManager.AppSettings["consumergroup"]); foreach (var message in client.GetMessages()) { Console.WriteLine(string.Format("got message on client, key: {0}, partition: {1}, offset: {2}, value: {3}", message.key, message.partition, message.offset, message.value)); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } break; case "3": using (OfflineClient client = new OfflineClient(ConfigurationManager.AppSettings["host"], int.Parse(ConfigurationManager.AppSettings["port"]), ConfigurationManager.AppSettings["accesskey"], ConfigurationManager.AppSettings["accesssecret"])) { try { client.subscribe(ConfigurationManager.AppSettings["subid"], ConfigurationManager.AppSettings["consumergroup"]); foreach (var message in client.GetMessages()) { Console.WriteLine(string.Format("got message on client, key: {0}, partition: {1}, offset: {2}, value: {3}", message.key, message.partition, message.offset, message.value)); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } break; default: break; } Console.WriteLine("Client exited...."); Console.ReadLine(); }
public static void Start() { if (started) { return; } started = true; Navigator.Start(new NavigationManager(multithreaded: true)); Finder.Start(new FinderManager()); Constructor.Start(new ConstructorManager()); OperationClient.Start(new OperationManager()); AuthClient.Start( types: true, property: true, queries: true, permissions: true, operations: true, defaultPasswordExpiresLogic: false); Navigator.EntitySettings <UserEntity>().OverrideView += (usr, ctrl) => { ctrl.Child <EntityLine>("Role").After(new ValueLine().Set(Common.RouteProperty, "[UserEmployeeMixin].AllowLogin")); ctrl.Child <EntityLine>("Role").After(new EntityLine().Set(Common.RouteProperty, "[UserEmployeeMixin].Employee")); return(ctrl); }; LinksClient.Start(widget: true, contextualMenu: true); ProcessClient.Start(package: true, packageOperation: true); SchedulerClient.Start(); FilePathClient.Start(); ExcelClient.Start(toExcel: true, excelReport: false); UserQueryClient.Start(); ChartClient.Start(); DashboardClient.Start(); HelpClient.Start(); ExceptionClient.Start(); NoteClient.Start(typeof(UserEntity), /*Note*/ typeof(OrderEntity)); AlertClient.Start(typeof(UserEntity), /*Alert*/ typeof(OrderEntity)); SMSClient.Start(); ProfilerClient.Start(); OmniboxClient.Start(); OmniboxClient.Register(new SpecialOmniboxProvider()); OmniboxClient.Register(new EntityOmniboxProvider()); OmniboxClient.Register(new DynamicQueryOmniboxProvider()); OmniboxClient.Register(new UserQueryOmniboxProvider()); OmniboxClient.Register(new ChartOmniboxProvider()); OmniboxClient.Register(new UserChartOmniboxProvider()); OmniboxClient.Register(new DashboardOmniboxProvider()); SouthwindClient.Start(); DisconnectedClient.Start(); Navigator.Initialize(); }
private void WebStart() { Navigator.Start(new NavigationManager("haradwaithwinds")); Finder.Start(new FinderManager()); Constructor.Start(new ConstructorManager(), new ClientConstructorManager()); OperationClient.Start(new OperationManager(), true); AuthClient.Start( types: true, property: true, queries: true, resetPassword: true, passwordExpiration: false, singleSignOnMessage: false); Navigator.EntitySettings <UserEntity>().CreateViewOverrides() .AfterLine((UserEntity u) => u.Role, (html, tc) => html.ValueLine(tc, u => u.Mixin <UserEmployeeMixin>().AllowLogin)) .AfterLine((UserEntity u) => u.Role, (html, tc) => html.EntityLine(tc, u => u.Mixin <UserEmployeeMixin>().Employee)); AuthAdminClient.Start( types: true, properties: true, queries: true, operations: true, permissions: true); MailingClient.Start( smtpConfig: true, newsletter: false, pop3Config: false, emailReport: false, quickLinkFrom: null); SMSClient.Start(); SessionLogClient.Start(); ExceptionClient.Start(); UserQueriesClient.Start(); FilesClient.Start( file: true, embeddedFile: true, filePath: false, embeddedFilePath: true); MapClient.Start(); ChartClient.Start(); ExcelClient.Start( toExcelPlain: true, excelReport: false, excelAttachment: false); WordClient.Start(); DashboardClient.Start(); DisconnectedClient.Start(); ProcessClient.Start( packages: true, packageOperations: true); TranslationClient.Start(new AlreadyTranslatedTranslator(new BingTranslator()), translatorUser: true, translationReplacement: false, instanceTranslator: true); SchedulerClient.Start(simpleTask: true); NoteClient.Start(typeof(UserEntity), /*Note*/ typeof(OrderEntity)); AlertClient.Start(typeof(UserEntity), /*Alert*/ typeof(OrderEntity)); LinksClient.Start(widget: true, contextualItems: true); ViewLogClient.Start(); DiffLogClient.Start(); HelpClient.Start("Images", "http://localhost:7654/"); SouthwindClient.Start(); CacheClient.Start(); ProfilerClient.Start(); ScriptHtmlHelper.Manager.MainAssembly = typeof(SouthwindClient).Assembly; SignumControllerFactory.MainAssembly = typeof(SouthwindClient).Assembly; SignumControllerFactory.EveryController().AddFilters(ctx => ctx.FilterInfo.AuthorizationFilters.OfType <AuthenticationRequiredAttribute>().Any() ? null : new AuthenticationRequiredAttribute()); SignumControllerFactory.EveryController().AddFilters(new SignumExceptionHandlerAttribute()); SignumControllerFactory.EveryController().AddFilters(new ProfilerFilterAttribute()); SignumControllerFactory.RegisterAvoidValidate(); Navigator.Initialize(); OmniboxClient.Start(); OmniboxClient.Register(new SpecialOmniboxProvider()); OmniboxClient.Register(new EntityOmniboxProvider()); OmniboxClient.Register(new DynamicQueryOmniboxProvider()); OmniboxClient.Register(new UserQueryOmniboxProvider()); OmniboxClient.Register(new ChartOmniboxProvider()); OmniboxClient.Register(new UserChartOmniboxProvider()); OmniboxClient.Register(new DashboardOmniboxProvider()); OmniboxClient.Register(new HelpOmniboxProvider()); OmniboxClient.Register(new MapOmniboxProvider()); } //WebStart