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 2021/07/01 12:22:12 UTC
[GitHub] [shardingsphere-elasticjob] xdxTao opened a new issue #1918: Can't springboot use the listener?
xdxTao opened a new issue #1918:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1918
I don't see how the `springBootStarter` uses the listener in the document. Can it not be used?
If I can, what's wrong with my writing?
**MyListener**
```java
import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener;
import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts;
import org.springframework.stereotype.Component;
@Component("simpleJobListener")
public class MyJobListener implements ElasticJobListener {
@Override
public void beforeJobExecuted(ShardingContexts shardingContexts) {
System.out.println("before:" + shardingContexts.getJobName());
}
@Override
public void afterJobExecuted(ShardingContexts shardingContexts) {
System.out.println("after:" + shardingContexts.getJobName());
}
@Override
public String getType() {
return "simpleJobListener";
}
}
```
**MyYml**
```yml
elasticjob:
regCenter:
#zookeeper 的ip:port
serverLists: 127.0.0.1:2181
#名命空间,自己定义就好了
namespace: my-job13
jobs:
#你的这个定时任务名称,自定义名称
oneSimpleJob:
#定时任务的全路径名
elasticJobClass: com.xdx97.elasticjob.job.OneSimpleJob
#定时任务执行的cron表达式
cron: 0/30 * * * * ?
#分片数量
shardingTotalCount: 1
overwrite: true
jobErrorHandlerType: EMAIL
job-listener-types: simpleJobListener
```
**In addition, please take another look #1917**
Thank you.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] xdxTao closed issue #1918: Can't springboot use the listener?
Posted by GitBox <gi...@apache.org>.
xdxTao closed issue #1918:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1918
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] johnny2002 commented on issue #1918: Can't springboot use the listener?
Posted by GitBox <gi...@apache.org>.
johnny2002 commented on issue #1918:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1918#issuecomment-1033302727
Or if need, I may contribute on 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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] TeslaCN commented on issue #1918: Can't springboot use the listener?
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #1918:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1918#issuecomment-873397958
The current job listener supports SPI only. You may create a file `META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener`in your resources directory and specify your implementation.
We will enhance the Spring support in the next release.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] johnny2002 commented on issue #1918: Can't springboot use the listener?
Posted by GitBox <gi...@apache.org>.
johnny2002 commented on issue #1918:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1918#issuecomment-1033302464
I need this feature too, how is the progress?
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org