You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/10/09 06:19:46 UTC

[GitHub] [shardingsphere-elasticjob] gzdzss opened a new pull request #1550: Refactor Dingtalk and Wechat error handler

gzdzss opened a new pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550


   Fixes #1516.
   
   Changes proposed in this pull request:
   Use java properties to config error handler's configuration
   - [ ] error-handler-email.yaml
   - [x] error-handler-wechat.yaml
   - [x] error-handler-dingtalk.yaml
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] gzdzss commented on a change in pull request #1550: Refactor Dingtalk and Wechat error handler

Posted by GitBox <gi...@apache.org>.
gzdzss commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r502215276



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-dingtalk/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       JobErrorHandlerFactory is needed because it is in the general module

##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-wechat/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       JobErrorHandlerFactory is needed because it is in the general module




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r503622106



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandler.java
##########
@@ -95,28 +96,35 @@ private String createErrorContext(final String jobName, final Throwable cause) {
         return String.format("Job '%s' exception occur in job processing, caused by %s", jobName, writer.toString());
     }
     
-    private Message createMessage(final String content) throws MessagingException {
-        MimeMessage result = new MimeMessage(session);
-        result.setFrom(new InternetAddress(config.getFrom()));
-        result.setSubject(config.getSubject());
+    private Message createMessage(final String content, final EmailConfiguration emailConfiguration) throws MessagingException {
+        MimeMessage result = new MimeMessage(createSession(emailConfiguration));

Review comment:
       Consider using `Optional.ofNullable(session).orElseGet(() -> createSession(emailConfiguration))` to prevent invoking synchronized method everytime. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1550: Refactor Dingtalk and Wechat error handler

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r502213635



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-dingtalk/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       Is it necessary to introduce general into dingtalk module?

##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-wechat/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       Is it necessary to introduce general into wechat module?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r503648045



##########
File path: examples/elasticjob-example-lite-spring/src/main/resources/META-INF/applicationContext.xml
##########
@@ -65,4 +65,50 @@
             <!--<prop key="script.command.line">${script.scriptCommandLine}</prop>-->
         <!--</props>-->
     <!--</elasticjob:job>-->
+
+    <bean id="occurErrorNoticeDingtlakJob" class="org.apache.shardingsphere.elasticjob.lite.example.job.simple.JavaOccurErrorJob" />
+
+    <elasticjob:job id="${occurErrorNoticeDingtlakJob.id}" job-ref="occurErrorNoticeDingtlakJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace"
+                    sharding-total-count="${occurErrorNoticeDingtlakJob.shardingTotalCount}" cron="${occurErrorNoticeDingtlakJob.cron}" sharding-item-parameters="${occurErrorNoticeDingtlakJob.shardingItemParameters}" monitor-execution="${occurErrorNoticeDingtlakJob.monitorExecution}" failover="${occurErrorNoticeDingtlakJob.failover}" description="${occurErrorNoticeDingtlakJob.description}"
+                    job-error-handler-type="${occurErrorNoticeDingtlakJob.jobErrorHandlerType}"
+                    disabled="${occurErrorNoticeDingtlakJob.disabled}" overwrite="${occurErrorNoticeDingtlakJob.overwrite}" >
+        <props>
+            <prop key="dingtalk.webhook">https://oapi.dingtalk.com/robot/send?access_token=42eead064e81ce81fc6af2c107fbe10a4339a3d40a7db8abf5b34d8261527a3f</prop>
+            <prop key="dingtalk.keyword">keyword</prop>
+            <prop key="dingtalk.secret">SEC0b0a6b13b6823b95737dd83491c23adee5d8a7a649899a12217e038eddc84ff4</prop>
+            <prop key="dingtalk.connectTimeout">3000</prop>
+            <prop key="dingtalk.readTimeout">5000</prop>
+        </props>
+    </elasticjob:job>
+
+    <bean id="occurErrorNoticeWechatJob" class="org.apache.shardingsphere.elasticjob.lite.example.job.simple.JavaOccurErrorJob" />
+
+    <elasticjob:job id="${occurErrorNoticeWechatJob.id}" job-ref="occurErrorNoticeWechatJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace"
+                    sharding-total-count="${occurErrorNoticeWechatJob.shardingTotalCount}" cron="${occurErrorNoticeWechatJob.cron}" sharding-item-parameters="${occurErrorNoticeWechatJob.shardingItemParameters}" monitor-execution="${occurErrorNoticeWechatJob.monitorExecution}" failover="${occurErrorNoticeWechatJob.failover}" description="${occurErrorNoticeWechatJob.description}"
+                    job-error-handler-type="${occurErrorNoticeWechatJob.jobErrorHandlerType}"
+                    disabled="${occurErrorNoticeWechatJob.disabled}" overwrite="${occurErrorNoticeWechatJob.overwrite}" >
+        <props>
+            <prop key="wechat.webhook">https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5308e20a-2900-484b-a332-b5bb701ade04</prop>
+            <prop key="wechat.connectTimeout">3000</prop>
+            <prop key="wechat.readTimeout">5000</prop>
+        </props>
+    </elasticjob:job>
+
+<!--    <bean id="occurErrorNoticeEmailJob" class="org.apache.shardingsphere.elasticjob.lite.example.job.simple.JavaOccurErrorJob" />-->
+
+<!--    <elasticjob:job id="${occurErrorNoticeEmailJob.id}" job-ref="occurErrorNoticeEmailJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace"-->
+<!--                    sharding-total-count="${occurErrorNoticeEmailJob.shardingTotalCount}" cron="${occurErrorNoticeEmailJob.cron}" sharding-item-parameters="${occurErrorNoticeEmailJob.shardingItemParameters}" monitor-execution="${occurErrorNoticeEmailJob.monitorExecution}" failover="${occurErrorNoticeEmailJob.failover}" description="${occurErrorNoticeEmailJob.description}"-->
+<!--                    job-error-handler-type="${occurErrorNoticeEmailJob.jobErrorHandlerType}"-->
+<!--                    disabled="${occurErrorNoticeEmailJob.disabled}" overwrite="${occurErrorNoticeEmailJob.overwrite}" >-->
+<!--        <props>-->
+<!--            <prop key="email.host">host</prop>-->
+<!--            <prop key="email.username">username</prop>-->
+<!--            <prop key="email.password">passowrd</prop>-->
+<!--            <prop key="email.port">465</prop>-->
+<!--            <prop key="email.useSsl">true</prop>-->
+<!--            <prop key="email.protocol">smtp</prop>-->
+<!--            <prop key="email.form">from@xxx.com</prop>-->

Review comment:
       email.form -> email.from




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r503620141



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandler.java
##########
@@ -95,28 +96,35 @@ private String createErrorContext(final String jobName, final Throwable cause) {
         return String.format("Job '%s' exception occur in job processing, caused by %s", jobName, writer.toString());
     }
     
-    private Message createMessage(final String content) throws MessagingException {
-        MimeMessage result = new MimeMessage(session);
-        result.setFrom(new InternetAddress(config.getFrom()));
-        result.setSubject(config.getSubject());
+    private Message createMessage(final String content, final EmailConfiguration emailConfiguration) throws MessagingException {
+        MimeMessage result = new MimeMessage(createSession(emailConfiguration));
+        result.setFrom(new InternetAddress(emailConfiguration.getFrom()));
+        result.setSubject(emailConfiguration.getSubject());
         result.setSentDate(new Date());
         Multipart multipart = new MimeMultipart();
         BodyPart mailBody = new MimeBodyPart();
         mailBody.setContent(content, "text/html; charset=utf-8");
         multipart.addBodyPart(mailBody);
         result.setContent(multipart);
-        if (StringUtils.isNotBlank(config.getTo())) {
-            result.addRecipient(Message.RecipientType.TO, new InternetAddress(config.getTo()));
+        String to = emailConfiguration.getTo();
+        if (StringUtils.isNotBlank(to)) {
+            String[] tos = to.split(",");
+            for (String t : tos) {
+                result.addRecipient(Message.RecipientType.TO, new InternetAddress(t));
+            }
+        }
+        if (StringUtils.isNotBlank(emailConfiguration.getCc())) {
+            result.addRecipient(Message.RecipientType.CC, new InternetAddress(emailConfiguration.getCc()));
         }
-        if (StringUtils.isNotBlank(config.getCc())) {
-            result.addRecipient(Message.RecipientType.CC, new InternetAddress(config.getCc()));
+        if (StringUtils.isNotBlank(emailConfiguration.getBcc())) {
+            result.addRecipient(Message.RecipientType.BCC, new InternetAddress(emailConfiguration.getBcc()));
         }
         result.saveChanges();
         return result;
     }
     
-    private void sendMessage(final Message message) throws MessagingException {
-        try (Transport transport = session.getTransport()) {
+    private void sendMessage(final Message message, final EmailConfiguration emailConfiguration) throws MessagingException {
+        try (Transport transport = createSession(emailConfiguration).getTransport()) {

Review comment:
       Consider using `Optional.ofNullable(session).orElseGet(() -> createSession(emailConfiguration))`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] codecov-io commented on pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#issuecomment-706100018


   # [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=h1) Report
   > Merging [#1550](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere-elasticjob/commit/11532014e40561ea4bb46e93a2592e5b072a6f8c?el=desc) will **increase** coverage by `0.16%`.
   > The diff coverage is `90.54%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/graphs/tree.svg?width=650&height=150&src=pr&token=8ZMVc4Yo4Z)](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1550      +/-   ##
   ============================================
   + Coverage     85.30%   85.47%   +0.16%     
   - Complexity      102      103       +1     
   ============================================
     Files           247      247              
     Lines          5676     5686      +10     
     Branches        890      887       -3     
   ============================================
   + Hits           4842     4860      +18     
   + Misses          524      517       -7     
   + Partials        310      309       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...b/error/handler/general/IgnoreJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9JZ25vcmVKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...ob/error/handler/general/ThrowJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9UaHJvd0pvYkVycm9ySGFuZGxlci5qYXZh) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...cjob/error/handler/email/EmailJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `80.00% <75.00%> (+2.91%)` | `1.00 <0.00> (+1.00)` | |
   | [.../error/handler/dingtalk/DingtalkConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...rror/handler/dingtalk/DingtalkJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `93.10% <100.00%> (-0.12%)` | `0.00 <0.00> (ø)` | |
   | [...ticjob/error/handler/email/EmailConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (+1.00)` | |
   | [...cjob/error/handler/general/LogJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9Mb2dKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (ø)` | |
   | [...cjob/error/handler/wechat/WechatConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci13ZWNoYXQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvZXJyb3IvaGFuZGxlci93ZWNoYXQvV2VjaGF0Q29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (+66.66%)` | `0.00 <0.00> (ø)` | |
   | [...ob/error/handler/wechat/WechatJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci13ZWNoYXQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvZXJyb3IvaGFuZGxlci93ZWNoYXQvV2VjaGF0Sm9iRXJyb3JIYW5kbGVyLmphdmE=) | `97.72% <100.00%> (+5.89%)` | `0.00 <0.00> (ø)` | |
   | [...sphere/elasticjob/executor/ElasticJobExecutor.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1leGVjdXRvci9lbGFzdGljam9iLWV4ZWN1dG9yLWtlcm5lbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9leGVjdXRvci9FbGFzdGljSm9iRXhlY3V0b3IuamF2YQ==) | `91.11% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=footer). Last update [1153201...2d767a6](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r503646005



##########
File path: examples/elasticjob-example-lite-springboot/src/main/resources/application.yml
##########
@@ -31,5 +31,48 @@ elasticjob:
       shardingTotalCount: 9
       props:
         script.command.line: "echo Manual SCRIPT Job: "
+    occurErrorNoticeDingtlakJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeDingtlakJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: DINGTALK
+      props:
+        dingtalk:
+          webhook: https://oapi.dingtalk.com/robot/send?access_token=42eead064e81ce81fc6af2c107fbe10a4339a3d40a7db8abf5b34d8261527a3f
+          keyword: keyword
+          secret: SEC0b0a6b13b6823b95737dd83491c23adee5d8a7a649899a12217e038eddc84ff4
+          connectTimeout: 3000
+          readTimeout: 5000
+    occurErrorNoticeWechatJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeWechatJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: WECHAT
+      props:
+        wechat:
+          webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5308e20a-2900-484b-a332-b5bb701ade04
+          connectTimeout: 3000
+          readTimeout: 5000
+#    occurErrorNoticeEmailJob:
+#      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeEmailJob
+#      overwrite: true
+#      cron: 0/5 * * * * ?
+#      shardingTotalCount: 3
+#      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+#      jobErrorHandlerType: EMAIL
+#      props:
+#        email:
+#          host: host
+#          username: username
+#          password: password
+#          port: 465
+#          useSsl: true
+#          protocol: smtp
+#          form: from@xxx.com
+#          to: eail1@xxx.com,email2@xxx.com

Review comment:
       eail1 -> email1




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] gzdzss commented on a change in pull request #1550: Refactor Dingtalk and Wechat error handler

Posted by GitBox <gi...@apache.org>.
gzdzss commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r502215276



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-dingtalk/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       JobErrorHandlerFactory is needed because it is in the general module

##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-wechat/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       JobErrorHandlerFactory is needed because it is in the general module




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] xbkaishui commented on pull request #1550: Refactor Dingtalk and Wechat error handler

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#issuecomment-706003942


   The english name of Enterprise wechat name is  wecom, suggest change wechat to wecom


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] codecov-io edited a comment on pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#issuecomment-706100018


   # [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=h1) Report
   > Merging [#1550](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere-elasticjob/commit/11532014e40561ea4bb46e93a2592e5b072a6f8c?el=desc) will **decrease** coverage by `0.00%`.
   > The diff coverage is `88.88%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/graphs/tree.svg?width=650&height=150&src=pr&token=8ZMVc4Yo4Z)](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1550      +/-   ##
   ============================================
   - Coverage     85.30%   85.29%   -0.01%     
   - Complexity      102      103       +1     
   ============================================
     Files           247      250       +3     
     Lines          5676     5700      +24     
     Branches        890      887       -3     
   ============================================
   + Hits           4842     4862      +20     
   + Misses          524      523       -1     
   - Partials        310      315       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...elasticjob/error/handler/email/EmailConstants.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsQ29uc3RhbnRzLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...b/error/handler/general/IgnoreJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9JZ25vcmVKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...ob/error/handler/general/ThrowJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9UaHJvd0pvYkVycm9ySGFuZGxlci5qYXZh) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...cjob/error/handler/dingtalk/DingtalkConstants.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrQ29uc3RhbnRzLmphdmE=) | `66.66% <66.66%> (ø)` | `0.00 <0.00> (?)` | |
   | [...asticjob/error/handler/wechat/WechatConstants.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci13ZWNoYXQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvZXJyb3IvaGFuZGxlci93ZWNoYXQvV2VjaGF0Q29uc3RhbnRzLmphdmE=) | `66.66% <66.66%> (ø)` | `0.00 <0.00> (?)` | |
   | [...cjob/error/handler/email/EmailJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `81.81% <78.57%> (+4.73%)` | `1.00 <0.00> (+1.00)` | |
   | [.../error/handler/dingtalk/DingtalkConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...rror/handler/dingtalk/DingtalkJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `93.10% <100.00%> (-0.12%)` | `0.00 <0.00> (ø)` | |
   | [...ticjob/error/handler/email/EmailConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (+1.00)` | |
   | [...cjob/error/handler/general/LogJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9Mb2dKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (ø)` | |
   | ... and [17 more](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=footer). Last update [1153201...c2dd909](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- merged pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
Technoboy- merged pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] codecov-io edited a comment on pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#issuecomment-706100018


   # [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=h1) Report
   > Merging [#1550](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere-elasticjob/commit/11532014e40561ea4bb46e93a2592e5b072a6f8c?el=desc) will **decrease** coverage by `0.06%`.
   > The diff coverage is `88.88%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/graphs/tree.svg?width=650&height=150&src=pr&token=8ZMVc4Yo4Z)](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1550      +/-   ##
   ============================================
   - Coverage     85.30%   85.24%   -0.07%     
   - Complexity      102      103       +1     
   ============================================
     Files           247      250       +3     
     Lines          5676     5700      +24     
     Branches        890      887       -3     
   ============================================
   + Hits           4842     4859      +17     
     Misses          524      524              
   - Partials        310      317       +7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...elasticjob/error/handler/email/EmailConstants.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsQ29uc3RhbnRzLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...b/error/handler/general/IgnoreJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9JZ25vcmVKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...ob/error/handler/general/ThrowJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9UaHJvd0pvYkVycm9ySGFuZGxlci5qYXZh) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...cjob/error/handler/dingtalk/DingtalkConstants.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrQ29uc3RhbnRzLmphdmE=) | `66.66% <66.66%> (ø)` | `0.00 <0.00> (?)` | |
   | [...asticjob/error/handler/wechat/WechatConstants.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci13ZWNoYXQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvZXJyb3IvaGFuZGxlci93ZWNoYXQvV2VjaGF0Q29uc3RhbnRzLmphdmE=) | `66.66% <66.66%> (ø)` | `0.00 <0.00> (?)` | |
   | [...cjob/error/handler/email/EmailJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `81.81% <78.57%> (+4.73%)` | `1.00 <0.00> (+1.00)` | |
   | [.../error/handler/dingtalk/DingtalkConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...rror/handler/dingtalk/DingtalkJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `93.10% <100.00%> (-0.12%)` | `0.00 <0.00> (ø)` | |
   | [...ticjob/error/handler/email/EmailConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (+1.00)` | |
   | [...cjob/error/handler/general/LogJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9Mb2dKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (ø)` | |
   | ... and [18 more](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=footer). Last update [1153201...c2dd909](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r503647207



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-dingtalk/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/dingtalk/DingtalkConfiguration.java
##########
@@ -33,4 +35,17 @@
     private final Integer connectTimeout;
     
     private final Integer readTimeout;
+    
+    /**
+     * Get dingtalk config.
+     *
+     * @param props props
+     * @return dingtalk config.
+     */
+    public static DingtalkConfiguration getByProps(final Properties props) {

Review comment:
       dingtalk.webhook,dingtalk.keyword and dingtalk.xxx.
   It' better to use a constant field for this. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] xbkaishui commented on pull request #1550: Refactor Dingtalk and Wechat error handler

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#issuecomment-706003942


   The english name of Enterprise wechat name is  wecom, suggest change wechat to wecom


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] terrymanu commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r503252824



##########
File path: examples/elasticjob-example-lite-springboot/src/main/resources/application.yml
##########
@@ -31,5 +31,48 @@ elasticjob:
       shardingTotalCount: 9
       props:
         script.command.line: "echo Manual SCRIPT Job: "
+    occurErrorNoticeDingtlakJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeDingtlakJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: DINGTALK
+      props:
+        dingtalk:
+          webhook: https://oapi.dingtalk.com/robot/send?access_token=42eead064e81ce81fc6af2c107fbe10a4339a3d40a7db8abf5b34d8261527a3f
+          keyword: keyword
+          secret: SEC0b0a6b13b6823b95737dd83491c23adee5d8a7a649899a12217e038eddc84ff4
+          connectTimeout: 3000
+          readTimeout: 5000
+    occurErrorNoticeWechatJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeWechatJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: WECHAT
+      props:
+        wechat:
+          webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5308e20a-2900-484b-a332-b5bb701ade04
+          connectTimeout: 3000
+          readTimeout: 5000
+#    occurErrorNoticeEmailJob:
+#      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeEmailJob
+#      overwrite: true
+#      cron: 0/5 * * * * ?
+#      shardingTotalCount: 3
+#      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+#      jobErrorHandlerType: EMAIL
+#      props:
+#        email:
+#          host: smtp.163.com

Review comment:
       Please do not use real smtp server, just mask them

##########
File path: examples/elasticjob-example-lite-springboot/src/main/resources/application.yml
##########
@@ -31,5 +31,48 @@ elasticjob:
       shardingTotalCount: 9
       props:
         script.command.line: "echo Manual SCRIPT Job: "
+    occurErrorNoticeDingtlakJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeDingtlakJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: DINGTALK
+      props:
+        dingtalk:
+          webhook: https://oapi.dingtalk.com/robot/send?access_token=42eead064e81ce81fc6af2c107fbe10a4339a3d40a7db8abf5b34d8261527a3f
+          keyword: keyword
+          secret: SEC0b0a6b13b6823b95737dd83491c23adee5d8a7a649899a12217e038eddc84ff4
+          connectTimeout: 3000
+          readTimeout: 5000
+    occurErrorNoticeWechatJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeWechatJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: WECHAT
+      props:
+        wechat:
+          webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5308e20a-2900-484b-a332-b5bb701ade04
+          connectTimeout: 3000
+          readTimeout: 5000
+#    occurErrorNoticeEmailJob:
+#      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeEmailJob
+#      overwrite: true
+#      cron: 0/5 * * * * ?
+#      shardingTotalCount: 3
+#      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+#      jobErrorHandlerType: EMAIL
+#      props:
+#        email:
+#          host: smtp.163.com
+#          username: xxx@163.com

Review comment:
       Please mask them too

##########
File path: examples/elasticjob-example-lite-springboot/src/main/resources/application.yml
##########
@@ -31,5 +31,48 @@ elasticjob:
       shardingTotalCount: 9
       props:
         script.command.line: "echo Manual SCRIPT Job: "
+    occurErrorNoticeDingtlakJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeDingtlakJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: DINGTALK
+      props:
+        dingtalk:
+          webhook: https://oapi.dingtalk.com/robot/send?access_token=42eead064e81ce81fc6af2c107fbe10a4339a3d40a7db8abf5b34d8261527a3f
+          keyword: keyword
+          secret: SEC0b0a6b13b6823b95737dd83491c23adee5d8a7a649899a12217e038eddc84ff4
+          connectTimeout: 3000
+          readTimeout: 5000
+    occurErrorNoticeWechatJob:
+      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeWechatJob
+      overwrite: true
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+      jobErrorHandlerType: WECHAT
+      props:
+        wechat:
+          webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5308e20a-2900-484b-a332-b5bb701ade04
+          connectTimeout: 3000
+          readTimeout: 5000
+#    occurErrorNoticeEmailJob:
+#      elasticJobClass: org.apache.shardingsphere.elasticjob.lite.example.job.SpringBootOccurErrorNoticeEmailJob
+#      overwrite: true
+#      cron: 0/5 * * * * ?
+#      shardingTotalCount: 3
+#      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+#      jobErrorHandlerType: EMAIL
+#      props:
+#        email:
+#          host: smtp.163.com
+#          username: xxx@163.com
+#          password: xxxx
+#          port: 465
+#          useSsl: true
+#          protocol: smtp
+#          form: xxx@163.com
+#          to: xxx1@qq.com,xxx2@qq.com

Review comment:
       Please mask them too




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r503622106



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandler.java
##########
@@ -95,28 +96,35 @@ private String createErrorContext(final String jobName, final Throwable cause) {
         return String.format("Job '%s' exception occur in job processing, caused by %s", jobName, writer.toString());
     }
     
-    private Message createMessage(final String content) throws MessagingException {
-        MimeMessage result = new MimeMessage(session);
-        result.setFrom(new InternetAddress(config.getFrom()));
-        result.setSubject(config.getSubject());
+    private Message createMessage(final String content, final EmailConfiguration emailConfiguration) throws MessagingException {
+        MimeMessage result = new MimeMessage(createSession(emailConfiguration));

Review comment:
       Consider using `Optional.ofNullable(session).orElseGet(() -> createSession(emailConfiguration))` to prevent invoking synchronized method everytime. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] codecov-io commented on pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#issuecomment-706100018


   # [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=h1) Report
   > Merging [#1550](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere-elasticjob/commit/11532014e40561ea4bb46e93a2592e5b072a6f8c?el=desc) will **increase** coverage by `0.16%`.
   > The diff coverage is `90.54%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/graphs/tree.svg?width=650&height=150&src=pr&token=8ZMVc4Yo4Z)](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1550      +/-   ##
   ============================================
   + Coverage     85.30%   85.47%   +0.16%     
   - Complexity      102      103       +1     
   ============================================
     Files           247      247              
     Lines          5676     5686      +10     
     Branches        890      887       -3     
   ============================================
   + Hits           4842     4860      +18     
   + Misses          524      517       -7     
   + Partials        310      309       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...b/error/handler/general/IgnoreJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9JZ25vcmVKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...ob/error/handler/general/ThrowJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9UaHJvd0pvYkVycm9ySGFuZGxlci5qYXZh) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
   | [...cjob/error/handler/email/EmailJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `80.00% <75.00%> (+2.91%)` | `1.00 <0.00> (+1.00)` | |
   | [.../error/handler/dingtalk/DingtalkConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...rror/handler/dingtalk/DingtalkJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1kaW5ndGFsay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2Rpbmd0YWxrL0Rpbmd0YWxrSm9iRXJyb3JIYW5kbGVyLmphdmE=) | `93.10% <100.00%> (-0.12%)` | `0.00 <0.00> (ø)` | |
   | [...ticjob/error/handler/email/EmailConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1lbWFpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9lcnJvci9oYW5kbGVyL2VtYWlsL0VtYWlsQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (+1.00)` | |
   | [...cjob/error/handler/general/LogJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci1nZW5lcmFsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Vycm9yL2hhbmRsZXIvZ2VuZXJhbC9Mb2dKb2JFcnJvckhhbmRsZXIuamF2YQ==) | `100.00% <100.00%> (ø)` | `1.00 <0.00> (ø)` | |
   | [...cjob/error/handler/wechat/WechatConfiguration.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci13ZWNoYXQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvZXJyb3IvaGFuZGxlci93ZWNoYXQvV2VjaGF0Q29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (+66.66%)` | `0.00 <0.00> (ø)` | |
   | [...ob/error/handler/wechat/WechatJobErrorHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1lcnJvci1oYW5kbGVyL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci10eXBlL2VsYXN0aWNqb2ItZXJyb3ItaGFuZGxlci13ZWNoYXQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvZXJyb3IvaGFuZGxlci93ZWNoYXQvV2VjaGF0Sm9iRXJyb3JIYW5kbGVyLmphdmE=) | `97.72% <100.00%> (+5.89%)` | `0.00 <0.00> (ø)` | |
   | [...sphere/elasticjob/executor/ElasticJobExecutor.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree#diff-ZWxhc3RpY2pvYi1leGVjdXRvci9lbGFzdGljam9iLWV4ZWN1dG9yLWtlcm5lbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9leGVjdXRvci9FbGFzdGljSm9iRXhlY3V0b3IuamF2YQ==) | `91.11% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=footer). Last update [1153201...2d767a6](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1550?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1550: Refactor the configuration of error handler

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r502766310



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailConfiguration.java
##########
@@ -50,4 +52,27 @@
     private String bcc;
     
     private boolean debug;
+    
+    /**
+     * Get email config.
+     *
+     * @param props props
+     * @return email config.
+     */
+    public static EmailConfiguration getByProps(final Properties props) {
+        EmailConfiguration configuration = new EmailConfiguration();
+        configuration.setHost(props.getProperty("email.host"));
+        configuration.setPort(Integer.parseInt(props.getOrDefault("email.port", "25").toString()));

Review comment:
       There are many SMTP servers required secure connection. I think it is better to let users declare port explicitly. 

##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandler.java
##########
@@ -95,28 +96,35 @@ private String createErrorContext(final String jobName, final Throwable cause) {
         return String.format("Job '%s' exception occur in job processing, caused by %s", jobName, writer.toString());
     }
     
-    private Message createMessage(final String content) throws MessagingException {
-        MimeMessage result = new MimeMessage(session);
-        result.setFrom(new InternetAddress(config.getFrom()));
-        result.setSubject(config.getSubject());
+    private Message createMessage(final String content, final EmailConfiguration emailConfiguration) throws MessagingException {
+        MimeMessage result = new MimeMessage(createSession(emailConfiguration));
+        result.setFrom(new InternetAddress(emailConfiguration.getFrom()));
+        result.setSubject(emailConfiguration.getSubject());
         result.setSentDate(new Date());
         Multipart multipart = new MimeMultipart();
         BodyPart mailBody = new MimeBodyPart();
         mailBody.setContent(content, "text/html; charset=utf-8");
         multipart.addBodyPart(mailBody);
         result.setContent(multipart);
-        if (StringUtils.isNotBlank(config.getTo())) {
-            result.addRecipient(Message.RecipientType.TO, new InternetAddress(config.getTo()));
+        String to = emailConfiguration.getTo();
+        if (StringUtils.isNotBlank(to)) {
+            String[] tos = to.split(",");
+            for (String t : tos) {
+                result.addRecipient(Message.RecipientType.TO, new InternetAddress(t));
+            }
+        }
+        if (StringUtils.isNotBlank(emailConfiguration.getCc())) {
+            result.addRecipient(Message.RecipientType.CC, new InternetAddress(emailConfiguration.getCc()));
         }
-        if (StringUtils.isNotBlank(config.getCc())) {
-            result.addRecipient(Message.RecipientType.CC, new InternetAddress(config.getCc()));
+        if (StringUtils.isNotBlank(emailConfiguration.getBcc())) {
+            result.addRecipient(Message.RecipientType.BCC, new InternetAddress(emailConfiguration.getBcc()));
         }
         result.saveChanges();
         return result;
     }
     
-    private void sendMessage(final Message message) throws MessagingException {
-        try (Transport transport = session.getTransport()) {
+    private void sendMessage(final Message message, final EmailConfiguration emailConfiguration) throws MessagingException {
+        try (Transport transport = createSession(emailConfiguration).getTransport()) {

Review comment:
       The method `createSession` is synchronized. I think it is better to check if session present before invoking synchronized method.

##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandler.java
##########
@@ -44,48 +45,48 @@
 @Slf4j
 public final class EmailJobErrorHandler implements JobErrorHandler {
     
-    public static final String CONFIG_PREFIX = "email";
+    private Session session;
     
-    private final EmailConfiguration config;
-    
-    private final Session session;
-    
-    public EmailJobErrorHandler() {
-        config = EmailConfigurationLoader.unmarshal(CONFIG_PREFIX);
-        session = Session.getDefaultInstance(createSessionProperties(), getSessionAuthenticator());
+    private synchronized Session createSession(final EmailConfiguration emailConfiguration) {
+        if (session == null) {

Review comment:
       Constant on the left.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1550: Refactor Dingtalk and Wechat error handler

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1550:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1550#discussion_r502213635



##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-dingtalk/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       Is it necessary to introduce general into dingtalk module?

##########
File path: elasticjob-error-handler/elasticjob-error-handler-type/elasticjob-error-handler-wechat/pom.xml
##########
@@ -33,6 +33,11 @@
             <artifactId>elasticjob-error-handler-spi</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-error-handler-general</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>

Review comment:
       Is it necessary to introduce general into wechat module?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org