Skip to content

Commit

Permalink
[Connectors API] Make default scheduling for all sync jobs more reada…
Browse files Browse the repository at this point in the history
  • Loading branch information
timgrein authored Feb 23, 2024
1 parent 5671669 commit 21b64ba
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@

public class ConnectorScheduling implements Writeable, ToXContentObject {

private final ScheduleConfig accessControl;
private final ScheduleConfig full;
private final ScheduleConfig incremental;

private static final String EVERYDAY_AT_MIDNIGHT = "0 0 0 * * ?";
private static final ParseField ACCESS_CONTROL_FIELD = new ParseField("access_control");
private static final ParseField FULL_FIELD = new ParseField("full");
private static final ParseField INCREMENTAL_FIELD = new ParseField("incremental");

private final ScheduleConfig accessControl;
private final ScheduleConfig full;
private final ScheduleConfig incremental;

/**
* @param accessControl connector access control sync schedule represented as {@link ScheduleConfig}
* @param full connector full sync schedule represented as {@link ScheduleConfig}
Expand Down Expand Up @@ -238,12 +239,19 @@ public ScheduleConfig build() {
}
}

/**
* Default scheduling is set to everyday at midnight (00:00:00).
*
* @return default scheduling for full, incremental and access control syncs.
*/
public static ConnectorScheduling getDefaultConnectorScheduling() {
return new ConnectorScheduling.Builder().setAccessControl(
new ConnectorScheduling.ScheduleConfig.Builder().setEnabled(false).setInterval(new Cron("0 0 0 * * ?")).build()
new ConnectorScheduling.ScheduleConfig.Builder().setEnabled(false).setInterval(new Cron(EVERYDAY_AT_MIDNIGHT)).build()
)
.setFull(new ConnectorScheduling.ScheduleConfig.Builder().setEnabled(false).setInterval(new Cron("0 0 0 * * ?")).build())
.setIncremental(new ConnectorScheduling.ScheduleConfig.Builder().setEnabled(false).setInterval(new Cron("0 0 0 * * ?")).build())
.setFull(new ConnectorScheduling.ScheduleConfig.Builder().setEnabled(false).setInterval(new Cron(EVERYDAY_AT_MIDNIGHT)).build())
.setIncremental(
new ConnectorScheduling.ScheduleConfig.Builder().setEnabled(false).setInterval(new Cron(EVERYDAY_AT_MIDNIGHT)).build()
)
.build();
}
}

0 comments on commit 21b64ba

Please sign in to comment.