johnny2002 edited a comment on issue #1720:
URL:
https://github.com/apache/shardingsphere-elasticjob/issues/1720#issuecomment-728055492
> What I mean is we need to design a whole way to provide a project, not for
patch only.
> Customized job instance id and sharding strategy together is not good for
common user.
A graceful way is to add some customizable attributes in JobInstance, like
group, tag, etc. then put them in Zookeeper. Like Dubbo service does. e.g.
```java
@RequiredArgsConstructor
@Data
@EqualsAndHashCode(of = "jobInstanceId")
public final class JobInstance {
private static final String DELIMITER = "@-@";
private final String jobInstanceId;
private String group;
private String tag;
public JobInstance() {
jobInstanceId = IpUtils.getIp() + DELIMITER +
ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
//TODO: Get value from spring environment is preferred
group = System.getProperty("elasticjob.jobInstance.group");
tag = System.getProperty("elasticjob.jobInstance.tag");
}
/**
* Get server IP address.
*
* @return server IP address
*/
public String getIp() {
return jobInstanceId.substring(0, jobInstanceId.indexOf(DELIMITER));
}
}
```
----------------------------------------------------------------
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:
[email protected]