Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758
{"id":857,"date":"2014-06-12T02:00:26","date_gmt":"2014-06-12T05:00:26","guid":{"rendered":"http:\/\/www.feltex.com.br\/felix\/?p=857"},"modified":"2014-07-31T13:52:56","modified_gmt":"2014-07-31T16:52:56","slug":"agendador-tarefas-quartz","status":"publish","type":"post","link":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/","title":{"rendered":"Agendador de Tarefas Quartz"},"content":{"rendered":"

Agendador de Tarefas Quartz<\/H1><\/p>\n

Ol\u00e1 Amigos,<\/p>\n

Hoje faremos um agendador de Tarefas Quartz Framework. Um agendador de tarefas \u00e9 um processo que ser\u00e1 executado em uma determinada data e hor\u00e1rio espec\u00edfico. Esse momento de execu\u00e7\u00e3o pode ser c\u00edclico, ou seja, h\u00e1 uma repeti\u00e7\u00e3o (di\u00e1ria, semanal, mensal, anual) ou em intervalos menores como (segundos, minutos ou horas).
\n Utilizaremos a vers\u00e3o 2.2.
\n\"timer-icon\"<\/a>
\n<\/p>\n

Para iniciar fa\u00e7a o download dos arquivos no site oficial. Esses s\u00e3o os arquivos necess\u00e1rio que voc\u00ea deve adicionar no class path da aplica\u00e7\u00e3o.<\/p>\n

\r\n c3p0-0.9.1.1.jar\r\n log4j-1.2.16.jar\r\n quartz-2.2.1.jar\r\n quartz-jobs-2.2.1.jar\r\n slf4j-api-1.6.6.jar\r\n slf4j-log4j12-1.6.6.jar\r\n<\/pre>\n

No c\u00f3digo abaixo criaremos a classe que conter\u00e1 a regra de neg\u00f3cio que vai ser agendada para execu\u00e7\u00e3o.<\/p>\n

\r\npackage br.com.feltex.quartz;\r\n\r\nimport org.quartz.Job;\r\nimport org.quartz.JobExecutionContext;\r\nimport org.quartz.JobExecutionException;\r\n\r\npublic class AtualizaCadastroJOB implements Job {\r\n\r\n\r\n     \/\/Aqui fica o c\u00f3digo que ser\u00e1 executado pelo agendamento.\r\n     \/\/ Caso ocorra um erro de execu\u00e7\u00e3o uma exce\u00e7\u00e3o ser\u00e1 lan\u00e7ada. \r\n\tpublic void execute(JobExecutionContext context)\r\n\t\t\tthrows JobExecutionException {\r\n\t\tSystem.out.println(\"Cadastro atualizado com sucesso!\");\t\t\r\n\t}\r\n}\r\n<\/pre>\n

Em seguida criaremos a classe que dispara o JOB. Fiz coment\u00e1rio em cada linha para que fique bem claro o que est\u00e1 sendo feito.<\/p>\n

\r\npackage br.com.feltex.quartz;\r\n\r\nimport org.quartz.JobBuilder;\r\nimport org.quartz.JobDetail;\r\nimport org.quartz.Scheduler;\r\nimport org.quartz.SimpleScheduleBuilder;\r\nimport org.quartz.Trigger;\r\nimport org.quartz.TriggerBuilder;\r\nimport org.quartz.impl.StdSchedulerFactory;\r\n\r\n\/\/ Classe que dispara o JOB\r\npublic class AgendaTrigger {\r\n\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\ttry {\r\n\t\t\t\/\/ Registrando a classe que execur\u00e1 meus m\u00e9todos de neg\u00f3cio\r\n\t\t\tJobDetail job = JobBuilder.newJob(AtualizaCadastroJOB.class)\r\n\t\t\t\t\t.withIdentity(\"nomeMeuJOB\", \"grupoCadastro\").build();\r\n\r\n\t\t\t\/\/ Criado um objeto de intervalo de repeti\u00e7\u00e3o\r\n\t\t\t\/\/ No nosso caso ser\u00e1 de 2 segundos\r\n\t\t\tSimpleScheduleBuilder intervalo = SimpleScheduleBuilder\r\n\t\t\t\t\t.simpleSchedule().withIntervalInSeconds(2).repeatForever();\r\n\r\n\t\t\t\/\/ Criado um disparador\r\n\t\t\tTrigger trigger = TriggerBuilder.newTrigger()\r\n\t\t\t\t\t.withIdentity(\"nomeDisparador\", \"grupoCadastro\")\r\n\t\t\t\t\t.withSchedule(intervalo).build();\r\n\r\n\t\t\t\r\n\t\t\t\/\/ Finalmente \u00e9 criado um objeto de agendamento\r\n\t\t\t\/\/ que recebe o JOB e o disparador!\r\n\t\t\tScheduler scheduler = new StdSchedulerFactory().getScheduler();\r\n\t\t\tscheduler.start();\r\n\t\t\tscheduler.scheduleJob(job, trigger);\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n

Pronto. Basta executar a classe “AgendaTrigger” que voc\u00ea ver\u00e1 a execu\u00e7\u00e3o a cada 2 segundos.
\nVeja um exemplo de sa\u00edda:<\/p>\n

\r\nCadastro atualizado com sucesso!\r\nCadastro atualizado com sucesso!\r\nCadastro atualizado com sucesso!\r\nCadastro atualizado com sucesso!\r\nCadastro atualizado com sucesso!\r\n<\/pre>\n

Links relacionados<\/H2>
\n
Site oficial Quartz<\/a><\/p>\n

Gostou do post? Agrade\u00e7a o autor compartilhando nas redes sociais. Clique nos links abaixo:<\/b><\/H2><\/p>\n","protected":false},"excerpt":{"rendered":"

Agendador de Tarefas Quartz Ol\u00e1 Amigos, Hoje faremos um agendador de Tarefas Quartz Framework. Um agendador de tarefas \u00e9 um processo que ser\u00e1 executado em uma determinada data e hor\u00e1rio espec\u00edfico. Esse momento de execu\u00e7\u00e3o pode ser c\u00edclico, ou seja, …<\/p>\n

Agendador de Tarefas Quartz<\/span> Read More »<\/a><\/p>\n

<\/p>\n","protected":false},"author":1,"featured_media":860,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[1,4,2],"tags":[],"yoast_head":"\nAgendador de Tarefas Quartz<\/title>\n<meta name=\"description\" content=\"Vamos construir um Agendador de Tarefas Quartz framework.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Agendador de Tarefas Quartz\" \/>\n<meta property=\"og:description\" content=\"Vamos construir um Agendador de Tarefas Quartz framework.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/\" \/>\n<meta property=\"og:site_name\" content=\"Aprenda Java\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/feltex.br\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-12T05:00:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-07-31T16:52:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/06\/timer-icon.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andr\u00e9 F\u00e9lix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/\",\"name\":\"Aprenda Java\",\"description\":\"Cursos de java, SQL e Engenharia de Software\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#primaryimage\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/06\/timer-icon.png\",\"contentUrl\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/06\/timer-icon.png\",\"width\":512,\"height\":512,\"caption\":\"Agendador de Tarefas Quartz\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#webpage\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/\",\"name\":\"Agendador de Tarefas Quartz\",\"isPartOf\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#primaryimage\"},\"datePublished\":\"2014-06-12T05:00:26+00:00\",\"dateModified\":\"2014-07-31T16:52:56+00:00\",\"author\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\"},\"description\":\"Vamos construir um Agendador de Tarefas Quartz framework.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Agendador de Tarefas Quartz\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\",\"name\":\"Andr\\u00e9 F\\u00e9lix\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#personlogo\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"caption\":\"Andr\\u00e9 F\\u00e9lix\"},\"sameAs\":[\"http:\/\/www.feltex.com.br\"],\"url\":\"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Agendador de Tarefas Quartz","description":"Vamos construir um Agendador de Tarefas Quartz framework.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/","og_locale":"pt_BR","og_type":"article","og_title":"Agendador de Tarefas Quartz","og_description":"Vamos construir um Agendador de Tarefas Quartz framework.","og_url":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/","og_site_name":"Aprenda Java","article_publisher":"https:\/\/www.facebook.com\/feltex.br","article_published_time":"2014-06-12T05:00:26+00:00","article_modified_time":"2014-07-31T16:52:56+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/06\/timer-icon.png","type":"image\/png"}],"twitter_misc":{"Escrito por":"Andr\u00e9 F\u00e9lix","Est. tempo de leitura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.feltex.com.br\/felix\/#website","url":"https:\/\/www.feltex.com.br\/felix\/","name":"Aprenda Java","description":"Cursos de java, SQL e Engenharia de Software","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-BR"},{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#primaryimage","inLanguage":"pt-BR","url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/06\/timer-icon.png","contentUrl":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/06\/timer-icon.png","width":512,"height":512,"caption":"Agendador de Tarefas Quartz"},{"@type":"WebPage","@id":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#webpage","url":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/","name":"Agendador de Tarefas Quartz","isPartOf":{"@id":"https:\/\/www.feltex.com.br\/felix\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#primaryimage"},"datePublished":"2014-06-12T05:00:26+00:00","dateModified":"2014-07-31T16:52:56+00:00","author":{"@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069"},"description":"Vamos construir um Agendador de Tarefas Quartz framework.","breadcrumb":{"@id":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.feltex.com.br\/felix\/agendador-tarefas-quartz\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Agendador de Tarefas Quartz"}]},{"@type":"Person","@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069","name":"Andr\u00e9 F\u00e9lix","image":{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/#personlogo","inLanguage":"pt-BR","url":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","caption":"Andr\u00e9 F\u00e9lix"},"sameAs":["http:\/\/www.feltex.com.br"],"url":"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/"}]}},"_links":{"self":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/857"}],"collection":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/comments?post=857"}],"version-history":[{"count":12,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/857\/revisions"}],"predecessor-version":[{"id":1010,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/857\/revisions\/1010"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media\/860"}],"wp:attachment":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media?parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/categories?post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/tags?post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}