-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
235 changed files
with
2,030 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...demo-job/src/main/java/io/github/hpsocket/demo/job/handler/SnailAnnotationJobHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.github.hpsocket.demo.job.handler; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import io.github.hpsocket.soa.framework.web.support.WebServerHelper; | ||
|
||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor; | ||
import com.aizuda.snailjob.client.job.core.dto.JobArgs; | ||
import com.aizuda.snailjob.client.model.ExecuteResult; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Component | ||
@JobExecutor(name = "classAnnotationJob", method = "doClassAnnotationJob") | ||
public class SnailAnnotationJobHandler | ||
{ | ||
private int i; | ||
|
||
public ExecuteResult doClassAnnotationJob(JobArgs jobArgs) | ||
{ | ||
log.info("traceId: {}", WebServerHelper.getTraceId()); | ||
|
||
if((++i) % 5 == 0) | ||
throw new RuntimeException("test thow exceptions"); | ||
|
||
return ExecuteResult.success(jobArgs.getTaskBatchId()); | ||
} | ||
|
||
@JobExecutor(name = "methodAnnotationJob") | ||
public ExecuteResult doMethodAnnotationJob(JobArgs jobArgs) | ||
{ | ||
log.info("traceId: {}", WebServerHelper.getTraceId()); | ||
|
||
if((++i) % 5 == 0) | ||
throw new RuntimeException("test thow exceptions"); | ||
|
||
return ExecuteResult.success(jobArgs.getTaskBatchId()); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...hp-demo-job/src/main/java/io/github/hpsocket/demo/job/handler/SnailInheritJobHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.github.hpsocket.demo.job.handler; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import io.github.hpsocket.soa.framework.web.support.WebServerHelper; | ||
import io.github.hpsocket.soa.starter.job.snailjob.executor.AbstractMdcJobExecutor; | ||
|
||
import com.aizuda.snailjob.client.job.core.dto.JobArgs; | ||
import com.aizuda.snailjob.client.model.ExecuteResult; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Component | ||
public class SnailInheritJobHandler extends AbstractMdcJobExecutor | ||
{ | ||
private int i; | ||
|
||
@Override | ||
protected ExecuteResult doJobExecuteEx(JobArgs jobArgs) | ||
{ | ||
log.info("traceId: {}", WebServerHelper.getTraceId()); | ||
|
||
if((++i) % 5 == 0) | ||
throw new RuntimeException("test thow exceptions"); | ||
|
||
return ExecuteResult.success(jobArgs.getTaskBatchId()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
.../src/main/java/io/github/hpsocket/demo/job/service/impl/SnailJobExceptionHandlerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.github.hpsocket.demo.job.service.impl; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import io.github.hpsocket.soa.starter.job.snailjob.exception.SnailJobExceptionHandler; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Service | ||
public class SnailJobExceptionHandlerImpl implements SnailJobExceptionHandler | ||
{ | ||
@Override | ||
public void handleException(String jobName, Long jobId, String method, String param, long timestamp, Exception e) | ||
{ | ||
log.info("handle snail-job exception : (jobName: {}, jobId: {}, method: {}, param: {}, exception: {})", jobName, jobId, method, param, e); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.