diff --git a/docs/Job Cleanup and Improvement.postman_collection.json b/docs/Job Cleanup and Improvement.postman_collection.json
new file mode 100644
index 0000000..48c47af
--- /dev/null
+++ b/docs/Job Cleanup and Improvement.postman_collection.json
@@ -0,0 +1,109 @@
+{
+ "info": {
+ "_postman_id": "d1083801-f6dd-4220-a6c6-55ddab035754",
+ "name": "Job Cleanup and Improvement",
+ "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
+ },
+ "item": [
+ {
+ "name": "View challenges in challenges listing index",
+ "request": {
+ "method": "GET",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": "http://cockpit.cloud.topcoder.com:9200/challengeslisting/challenges/30005520"
+ },
+ "response": []
+ },
+ {
+ "name": "View challenges in challenges details index",
+ "request": {
+ "method": "GET",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": "http://cockpit.cloud.topcoder.com:9200/challengesdetail/challenges/30005520"
+ },
+ "response": []
+ },
+ {
+ "name": "View marachon match in challenges listing index",
+ "request": {
+ "method": "GET",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": "http://cockpit.cloud.topcoder.com:9200/challengeslisting/challenges/13675"
+ },
+ "response": []
+ },
+ {
+ "name": "View marathon match in challenges details index",
+ "request": {
+ "method": "GET",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": "http://cockpit.cloud.topcoder.com:9200/challengeslisting/challenges/13675"
+ },
+ "response": []
+ },
+ {
+ "name": "View marathon match",
+ "request": {
+ "method": "GET",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": "http://cockpit.cloud.topcoder.com:9200/mmatches/mmatches/_search"
+ },
+ "response": []
+ },
+ {
+ "name": "View single round match",
+ "request": {
+ "method": "GET",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": "http://cockpit.cloud.topcoder.com:9200/srms/srms/_search"
+ },
+ "response": []
+ }
+ ],
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "id": "d61f2275-4803-4bac-9787-1bfd6c2540e8",
+ "type": "text/javascript",
+ "exec": [
+ ""
+ ]
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "id": "40db868c-a50a-4b47-a1cd-73f959da9145",
+ "type": "text/javascript",
+ "exec": [
+ ""
+ ]
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/docs/Verification_Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement version 1.0.docx b/docs/Verification_Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement version 1.0.docx
new file mode 100644
index 0000000..07f401d
Binary files /dev/null and b/docs/Verification_Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement version 1.0.docx differ
diff --git a/local/run.sh b/local/run.sh
index ab932ce..967c46f 100644
--- a/local/run.sh
+++ b/local/run.sh
@@ -6,6 +6,5 @@ export TC_JWT_KEY="secret"
# export AWS_SECRET_KEY=your secret
export REDISSON_JOB_CLUSTER_ENABLED=false
-export REDISSON_JOB_FORCE_INITIAL_LOAD=true
java -jar -Duser.timezone=America/New_York ../target/elasticsearch-feeder-service-*.jar server ../src/main/resources/elasticsearch-feeder-service.yaml
diff --git a/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceApplication.java b/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceApplication.java
index f3546cf..58f7632 100644
--- a/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceApplication.java
+++ b/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceApplication.java
@@ -8,8 +8,8 @@
import com.appirio.service.challengefeeder.resources.HealthCheckResource;
import com.appirio.service.challengefeeder.util.JestClientUtils;
import com.appirio.service.resourcefactory.ChallengeFeederFactory;
-import com.appirio.service.resourcefactory.MmFeederResourceFactory;
import com.appirio.service.resourcefactory.MarathonMatchFeederFactory;
+import com.appirio.service.resourcefactory.MmFeederResourceFactory;
import com.appirio.service.resourcefactory.SRMFeederFactory;
import com.appirio.service.supply.resources.SupplyDatasourceFactory;
@@ -70,8 +70,13 @@
*
Add job for LoadChangedChallengeDetailJob
*
*
+ *
+ *
+ * Version 1.8 - Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ * - remove the useless resources, jobs and logging of configuration values
+ *
* @author TCSCODER
- * @version 1.7
+ * @version 1.8
*/
public class ChallengeFeederServiceApplication extends BaseApplication {
/**
@@ -107,19 +112,47 @@ protected void logServiceSpecificConfigs(ChallengeFeederServiceConfiguration con
logger.info("\t\tAWS region : " + config.getJestClientConfiguration().getAwsRegion());
logger.info("\t\tAWS service : " + config.getJestClientConfiguration().getAwsService());
- logger.info("\tRedissonConfiguration ");
- logger.info("\t\tChallenges index: " + config.getRedissonConfiguration().getChallengesIndex());
- logger.info("\t\tChallenges type: " + config.getRedissonConfiguration().getChallengesType());
- logger.info("\t\tSingle server address: " + config.getRedissonConfiguration().getSingleServerAddress());
- logger.info("\t\tLast run timestamp prefix for job LoadChangedChallengesJob: " + config.getRedissonConfiguration().getLoadChangedChallengesJobLastRunTimestampPrefix());
- logger.info("\t\tLast run timestamp prefix for job MarathonMatchesJob: " + config.getRedissonConfiguration().getMarathonMatchesJobLastRunTimestampPrefix());
- logger.info("\t\tLast run timestamp prefix for job SingleRoundMatchesJob: " + config.getRedissonConfiguration().getSingleRoundMatchesJobLastRunTimestampPrefix());
- logger.info("\t\tCluster enabled: " + config.getRedissonConfiguration().isClusterEnabled());
- logger.info("\t\tLoadChangedChallengesJob Locker key name: " + config.getRedissonConfiguration().getLoadChangedChallengesJobLockerKeyName());
- logger.info("\t\tMarathonMatchesJob Locker key name: " + config.getRedissonConfiguration().getMarathonMatchesJobLockerKeyName());
- logger.info("\t\tSingleRoundMatchesJob Locker key name: " + config.getRedissonConfiguration().getSingleRoundMatchesJobLockerKeyName());
- logger.info("\t\tLock watchdog timeout: " + config.getRedissonConfiguration().getLockWatchdogTimeout());
- logger.info("\t\tNode addresses: " + config.getRedissonConfiguration().getNodeAddresses());
+ logger.info("\tJobsConfiguration");
+ logger.info("\t\tRedissonConfiguration");
+ logger.info("\t\t\tSingle server address: " + config.getJobsConfiguration().getRedissonConfiguration().getSingleServerAddress());
+ logger.info("\t\t\tCluster enabled: " + config.getJobsConfiguration().getRedissonConfiguration().isClusterEnabled());
+ logger.info("\t\t\tLock watchdog timeout: " + config.getJobsConfiguration().getRedissonConfiguration().getLockWatchdogTimeout());
+ logger.info("\t\t\tNode addresses: " + config.getJobsConfiguration().getRedissonConfiguration().getNodeAddresses());
+
+
+ logger.info("\tJobs configuration");
+ logger.info("\t\t\tRedisson configuration");
+ logger.info("\t\t\t\t\tLock watchdog timeout : " + config.getJobsConfiguration().getRedissonConfiguration().getLockWatchdogTimeout());
+ logger.info("\t\t\t\t\tSingle server address : " + config.getJobsConfiguration().getRedissonConfiguration().getSingleServerAddress());
+ logger.info("\t\t\t\t\tCluster enabled : " + config.getJobsConfiguration().getRedissonConfiguration().isClusterEnabled());
+ logger.info("\t\t\tNode addresses: " + config.getJobsConfiguration().getRedissonConfiguration().getNodeAddresses());
+ logger.info("\t\t\t\t\tNode addresses");
+ logger.info("\t\t\tLoad changed challenges listing job");
+ logger.info("\t\t\t\t\tIndex name");
+ logger.info("\t\t\t\t\tBatch size : " + config.getJobsConfiguration().getLoadChangedChallengesListingJob().getBatchUpdateSize());
+ logger.info("\t\t\tLoad changed challenges detail job");
+ logger.info("\t\t\t\t\tIndex name");
+ logger.info("\t\t\t\t\tBatch size : " + config.getJobsConfiguration().getLoadChangedChallengesDetailJob().getBatchUpdateSize());
+ logger.info("\t\t\tLegacymm to challenge listing job");
+ logger.info("\t\t\t\t\tIndex name");
+ logger.info("\t\t\t\t\tBatch size : " + config.getJobsConfiguration().getLegacyMMToChallengeListingJob().getBatchUpdateSize());
+ logger.info("\t\t\t\t\tMarathon matches days to subtract : " + config.getJobsConfiguration().getLegacyMMToChallengeListingJob().getMarathonMatchesDaysToSubtract());
+ logger.info("\t\t\t\t\tMarathon matches forum url : " + config.getJobsConfiguration().getLegacyMMToChallengeListingJob().getMarathonMatchesForumUrl());
+ logger.info("\t\t\tLoad changedmm challenge detail job");
+ logger.info("\t\t\t\t\tIndex name");
+ logger.info("\t\t\t\t\tBatch size : " + config.getJobsConfiguration().getLoadChangedMMChallengeDetailJob().getBatchUpdateSize());
+ logger.info("\t\t\t\t\tMarathon matches days to subtract : " + config.getJobsConfiguration().getLoadChangedMMChallengeDetailJob().getMarathonMatchesDaysToSubtract());
+ logger.info("\t\t\t\t\tMarathon matches forum url : " + config.getJobsConfiguration().getLoadChangedMMChallengeDetailJob().getMarathonMatchesForumUrl());
+ logger.info("\t\t\tMarathon matches job");
+ logger.info("\t\t\t\t\tIndex name");
+ logger.info("\t\t\t\t\tBatch size : " + config.getJobsConfiguration().getMarathonMatchesJob().getBatchUpdateSize());
+ logger.info("\t\t\t\t\tMarathon matches days to subtract : " + config.getJobsConfiguration().getMarathonMatchesJob().getMarathonMatchesDaysToSubtract());
+ logger.info("\t\t\t\t\tMarathon matches forum url : " + config.getJobsConfiguration().getMarathonMatchesJob().getMarathonMatchesForumUrl());
+ logger.info("\t\t\tSingle round matches job");
+ logger.info("\t\t\t\t\tIndex name");
+ logger.info("\t\t\t\t\tBatch size : " + config.getJobsConfiguration().getSingleRoundMatchesJob().getBatchUpdateSize());
+ logger.info("\t\t\t\t\tSingle round matches days to subtract : " + config.getJobsConfiguration().getSingleRoundMatchesJob().getSingleRoundMatchesDaysToSubtract());
+
logger.info("\tJobs ");
logger.info("\t\tJobs: " + config.getJobs());
@@ -149,9 +182,9 @@ protected void registerResources(ChallengeFeederServiceConfiguration config, Env
JestClient jestClient = JestClientUtils.get(config.getJestClientConfiguration());
// Register resources here
+ env.jersey().register(new HealthCheckResource());
env.jersey().register(new ChallengeFeederFactory(jestClient).getResourceInstance());
env.jersey().register(new MmFeederResourceFactory(jestClient).getResourceInstance());
- env.jersey().register(new HealthCheckResource());
env.jersey().register(new MarathonMatchFeederFactory(jestClient).getResourceInstance());
env.jersey().register(new SRMFeederFactory(jestClient).getResourceInstance());
logger.info("Services registered");
@@ -182,7 +215,7 @@ public void initialize(Bootstrap bootstrap)
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
- bootstrap.addBundle(new JobsBundle(new StartupJob(), new LoadChangedChallengesJob(), new LoadChangedChallengesListingJob(), new LegacyMMToChallengeListingJob(),
- new MarathonMatchesJob(), new SingleRoundMatchesJob(), new LegacyMMToChallengeJob(), new LoadChangedChallengesDetailJob(), new LoadChangedMMChallengeDetailJob()));
+ bootstrap.addBundle(new JobsBundle(new LoadChangedChallengesListingJob(), new LegacyMMToChallengeListingJob(), new MarathonMatchesJob(),
+ new SingleRoundMatchesJob(), new LoadChangedChallengesDetailJob(), new LoadChangedMMChallengeDetailJob()));
}
}
diff --git a/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceConfiguration.java b/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceConfiguration.java
index c19d32a..1c1255b 100644
--- a/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceConfiguration.java
+++ b/src/main/java/com/appirio/service/challengefeeder/ChallengeFeederServiceConfiguration.java
@@ -11,11 +11,12 @@
import com.appirio.service.challengefeeder.config.ChallengeConfiguration;
import com.appirio.service.challengefeeder.config.CommonConfiguration;
import com.appirio.service.challengefeeder.config.JestClientConfiguration;
-import com.appirio.service.challengefeeder.config.RedissonConfiguration;
+import com.appirio.service.challengefeeder.config.JobsConfiguration;
import com.appirio.service.supply.resources.SupplyDatasourceFactory;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.spinscale.dropwizard.jobs.JobConfiguration;
+import lombok.Getter;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@@ -34,8 +35,13 @@
*
* Version 1.3 - Topcoder ElasticSearch Feeder Service - Way To Populate Challenge-Listing Index
* - add commonConfiguration
+ *
+ * Version 1.4 - Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ * - refactor the job configuration
+ *
+ *
* @author TCSCODER
- * @version 1.3
+ * @version 1.4
*/
public class ChallengeFeederServiceConfiguration extends BaseAppConfiguration implements JobConfiguration {
@@ -62,10 +68,11 @@ public class ChallengeFeederServiceConfiguration extends BaseAppConfiguration im
private Map jobs;
/**
- * Represents the redissonConfiguration field
+ * Represents the jobsConfiguration field
*/
- @JsonProperty("redissonConfiguration")
- private RedissonConfiguration redissonConfiguration;
+ @JsonProperty("jobsConfiguration")
+ @Getter
+ private JobsConfiguration jobsConfiguration;
/**
* The challengeConfiguration
@@ -110,14 +117,6 @@ public Map getJobs() {
return jobs;
}
- /**
- * Get redissonConfiguration
- * @return the redissonConfiguration
- */
- public RedissonConfiguration getRedissonConfiguration() {
- return this.redissonConfiguration;
- }
-
/**
* Get challenge configuration
*
diff --git a/src/main/java/com/appirio/service/challengefeeder/config/BaseJobConfiguration.java b/src/main/java/com/appirio/service/challengefeeder/config/BaseJobConfiguration.java
new file mode 100644
index 0000000..52c9044
--- /dev/null
+++ b/src/main/java/com/appirio/service/challengefeeder/config/BaseJobConfiguration.java
@@ -0,0 +1,46 @@
+package com.appirio.service.challengefeeder.config;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents the BaseJobConfiguration
+ *
+ * It's added in Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ *
+ * @author TCCoder
+ * @version 1.0
+ *
+ */
+public class BaseJobConfiguration {
+ /**
+ * The index field
+ */
+ @JsonProperty
+ @NotEmpty
+ @Getter
+ @Setter
+ private String indexName;
+
+ /**
+ * The type name field
+ */
+ @JsonProperty
+ @NotEmpty
+ @Getter
+ @Setter
+ private String typeName;
+
+ /**
+ * Represents the batch update size field.
+ */
+ @JsonProperty
+ @Getter
+ @Setter
+ private int batchUpdateSize;
+
+}
diff --git a/src/main/java/com/appirio/service/challengefeeder/config/JobConfiguration.java b/src/main/java/com/appirio/service/challengefeeder/config/JobConfiguration.java
new file mode 100644
index 0000000..e01dc31
--- /dev/null
+++ b/src/main/java/com/appirio/service/challengefeeder/config/JobConfiguration.java
@@ -0,0 +1,36 @@
+package com.appirio.service.challengefeeder.config;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents the JobConfiguration
+ *
+ * It's added in Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ *
+ * @author TCCoder
+ * @version 1.0
+ *
+ */
+public class JobConfiguration {
+ /**
+ * The index field
+ */
+ @JsonProperty
+ @NotEmpty
+ @Getter
+ @Setter
+ private String indexName;
+
+ /**
+ * Represents the batch update size field.
+ */
+ @JsonProperty
+ @Getter
+ @Setter
+ private int batchUpdateSize;
+}
diff --git a/src/main/java/com/appirio/service/challengefeeder/config/JobsConfiguration.java b/src/main/java/com/appirio/service/challengefeeder/config/JobsConfiguration.java
new file mode 100644
index 0000000..824a80b
--- /dev/null
+++ b/src/main/java/com/appirio/service/challengefeeder/config/JobsConfiguration.java
@@ -0,0 +1,66 @@
+package com.appirio.service.challengefeeder.config;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import lombok.Getter;
+
+/**
+ * The JobsConfiguration is for the jobs configuration
+ *
+ * It's added in Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ *
+ * @author TCCoder
+ * @version 1.0
+ *
+ */
+public class JobsConfiguration {
+ /**
+ * Represents the redissonConfiguration field
+ */
+ @JsonProperty("redissonConfiguration")
+ @Getter
+ private RedissonConfiguration redissonConfiguration;
+
+ /**
+ * The loadChangedChallengesListingJob field
+ */
+ @JsonProperty("loadChangedChallengesListingJob")
+ @Getter
+ private JobConfiguration loadChangedChallengesListingJob;
+
+ /**
+ * The loadChangedChallengesDetailJob field
+ */
+ @JsonProperty("loadChangedChallengesDetailJob")
+ @Getter
+ private JobConfiguration loadChangedChallengesDetailJob;
+
+ /**
+ * The legacyMMToChallengeListingJob field
+ */
+ @JsonProperty("legacyMMToChallengeListingJob")
+ @Getter
+ private MMJobConfiguration legacyMMToChallengeListingJob;
+
+ /**
+ * The loadChangedMMChallengeDetailJob field
+ */
+ @JsonProperty("loadChangedMMChallengeDetailJob")
+ @Getter
+ private MMJobConfiguration loadChangedMMChallengeDetailJob;
+
+ /**
+ * The marathonMatchesJob field
+ */
+ @JsonProperty("marathonMatchesJob")
+ @Getter
+ private MMJobConfiguration marathonMatchesJob;
+
+ /**
+ * The singleRoundMatchesJob field
+ */
+ @JsonProperty("singleRoundMatchesJob")
+ @Getter
+ private SRMJobConfiguration singleRoundMatchesJob;
+
+}
diff --git a/src/main/java/com/appirio/service/challengefeeder/config/MMJobConfiguration.java b/src/main/java/com/appirio/service/challengefeeder/config/MMJobConfiguration.java
new file mode 100644
index 0000000..43af84f
--- /dev/null
+++ b/src/main/java/com/appirio/service/challengefeeder/config/MMJobConfiguration.java
@@ -0,0 +1,36 @@
+package com.appirio.service.challengefeeder.config;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents the MMJobConfiguration
+ *
+ * It's added in Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ *
+ * @author TCCoder
+ * @version 1.0
+ *
+ */
+public class MMJobConfiguration extends JobConfiguration {
+ /**
+ * The days to subtract in MarathonMatchesJob.
+ */
+ @JsonProperty
+ @Getter
+ @Setter
+ private int marathonMatchesDaysToSubtract;
+
+ /**
+ * Represents the marathonMatchesForumUrl.
+ */
+ @JsonProperty
+ @NotEmpty
+ @Getter
+ @Setter
+ private String marathonMatchesForumUrl;
+}
diff --git a/src/main/java/com/appirio/service/challengefeeder/config/RedissonConfiguration.java b/src/main/java/com/appirio/service/challengefeeder/config/RedissonConfiguration.java
index f1fe505..0fa655a 100644
--- a/src/main/java/com/appirio/service/challengefeeder/config/RedissonConfiguration.java
+++ b/src/main/java/com/appirio/service/challengefeeder/config/RedissonConfiguration.java
@@ -5,8 +5,6 @@
import java.util.List;
-import org.hibernate.validator.constraints.NotEmpty;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
@@ -52,200 +50,17 @@
* Added {@link #loadChangedChallengesDetailJobLockerKeyName}
*
*
+ *
+ *
+ * Version 2.0 - Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ *
+ * - keep only redisson connection configurations
+ *
+ *
* @author TCCoder
- * @version 1.5
+ * @version 2.0
*/
public class RedissonConfiguration {
-
- /**
- * The forceInitialLoad field
- */
- @JsonProperty
- @Getter
- @Setter
- private boolean forceInitialLoad;
-
- /**
- * The challenge index field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String challengesIndex;
-
- /**
- * The challenge index listing field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String challengesListingIndex;
-
- /**
- * The marathon match index field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String mmIndex;
-
- /**
- * The challenge detail index field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String challengesDetailIndex;
-
- /**
- * The single round match index field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String srmsIndex;
-
- /**
- * The challenges type field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String challengesType;
-
- /**
- * The challenges listing type field
- * @since 1.2
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String challengesDetailType;
-
- /**
- * The marahon match type field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String mmType;
-
- /**
- * The single round match type field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String srmsType;
-
- /**
- * The challenge type listing field
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String challengesListingType;
-
- /**
- * Represents the batch update size attribute.
- */
- @JsonProperty
- @Getter
- @Setter
- private int batchUpdateSize;
-
- /**
- * Represents the last run timestamp prefix attribute for job LoadChangedChallengesListingJob.
- * @since 1.2
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedChallengesDetailJobLastRunTimestampPrefix;
-
- /**
- * Represents the last run timestamp prefix attribute for job LoadChangedChallengesJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedChallengesJobLastRunTimestampPrefix;
-
- /**
- * Represents the last run timestamp prefix attribute for job LoadChangedChallengesListingJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedChallengesListingJobLastRunTimestampPrefix;
-
- /**
- * Represents the last run timestamp prefix attribute for job MarathonMatchesJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String marathonMatchesJobLastRunTimestampPrefix;
-
- /**
- * Represents the last run timestamp prefix attribute for LegacyMMToChallengeJob
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String legacyMMJobLastRunTimestampPrefix;
-
- /**
- * Represents the last run timestamp prefix attribute for job SingleRoundMatchesJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String singleRoundMatchesJobLastRunTimestampPrefix;
-
- /**
- * Represents the last run timestamp prefix for LegacyMMToChallengeListJob
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String legacyMMToChallengeListingJobLastRunTimestampPrefix;
-
- /**
- * Represents the last run timestamp prefix attribute for load changed mm challenge detail job .
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedMMChallengeDetailJobLastRunTimestampPrefix;
-
- /**
- * Represents the locker key name attribute for load changed mm challenge detail job.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedMMChallengeDetailJobLockerKeyName;
-
/**
* The cluster enabled field
*/
@@ -254,71 +69,6 @@ public class RedissonConfiguration {
@Setter
private boolean clusterEnabled;
- /**
- * Represents the locker key name attribute for job LoadChangedChallengesJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedChallengesJobLockerKeyName;
-
- /**
- * Represents the locker key name attribute for job LoadChangedChallengesListingJob.
- * @since 1.2
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedChallengesDetailJobLockerKeyName;
-
-
- /**
- * Represents the locker key name attribute for job LoadChangedChallengesListingJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String loadChangedChallengesListingJobLockerKeyName;
-
- /**
- * Represents the locker key name attribute for job MarathonMatchesJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String marathonMatchesJobLockerKeyName;
-
- /**
- * Represents the locker key name attribute for LegacyMMToChallengeJob
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String legacyMMJobLockerKeyName;
-
- /**
- * Represents the locker key name attribute for LegacyMMToChallengeListJob
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String legacyMMToChallengeListingJobLockerKeyName;
-
- /**
- * Represents the locker key name attribute for job SingleRoundMatchesJob.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String singleRoundMatchesJobLockerKeyName;
-
/**
* Represents the lock watchdog timeout attribute.
*/
@@ -343,29 +93,4 @@ public class RedissonConfiguration {
@Setter
private String singleServerAddress;
- /**
- * The days to subtract in MarathonMatchesJob.
- */
- @JsonProperty
- @Getter
- @Setter
- private int marathonMatchesDaysToSubtract;
-
- /**
- * The days to subtract in SingleRoundMatchesJob.
- */
- @JsonProperty
- @Getter
- @Setter
- private int singleRoundMatchesDaysToSubtract;
-
- /**
- * Represents the marathonMatchesForumUrl.
- */
- @JsonProperty
- @NotEmpty
- @Getter
- @Setter
- private String marathonMatchesForumUrl;
-
}
\ No newline at end of file
diff --git a/src/main/java/com/appirio/service/challengefeeder/config/SRMJobConfiguration.java b/src/main/java/com/appirio/service/challengefeeder/config/SRMJobConfiguration.java
new file mode 100644
index 0000000..7da4647
--- /dev/null
+++ b/src/main/java/com/appirio/service/challengefeeder/config/SRMJobConfiguration.java
@@ -0,0 +1,26 @@
+package com.appirio.service.challengefeeder.config;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents the SRMJobConfiguration
+ *
+ * It's added in Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ *
+ * @author TCCoder
+ * @version 1.0
+ *
+ */
+public class SRMJobConfiguration extends JobConfiguration {
+
+ /**
+ * The days to subtract in SingleRoundMatchesJob.
+ */
+ @JsonProperty
+ @Getter
+ @Setter
+ private int singleRoundMatchesDaysToSubtract;
+}
diff --git a/src/main/java/com/appirio/service/challengefeeder/dao/ChallengeDetailMMFeederDAO.java b/src/main/java/com/appirio/service/challengefeeder/dao/ChallengeDetailMMFeederDAO.java
index fcaf7d0..05a928b 100644
--- a/src/main/java/com/appirio/service/challengefeeder/dao/ChallengeDetailMMFeederDAO.java
+++ b/src/main/java/com/appirio/service/challengefeeder/dao/ChallengeDetailMMFeederDAO.java
@@ -3,14 +3,19 @@
*/
package com.appirio.service.challengefeeder.dao;
+import java.sql.Date;
import java.util.List;
+import org.skife.jdbi.v2.sqlobject.Bind;
+
import com.appirio.service.challengefeeder.api.challengedetail.ChallengeDetailData;
import com.appirio.service.challengefeeder.api.challengedetail.RegistrantData;
import com.appirio.service.challengefeeder.api.challengedetail.SubmissionData;
+import com.appirio.service.challengefeeder.dto.DatabaseTimestamp;
import com.appirio.supply.dataaccess.ApiQueryInput;
import com.appirio.supply.dataaccess.DatasourceName;
import com.appirio.supply.dataaccess.SqlQueryFile;
+import com.appirio.tech.core.api.v3.TCID;
import com.appirio.tech.core.api.v3.request.QueryParameter;
/**
@@ -18,8 +23,11 @@
*
* It's added in Topcoder ElasticSearch Feeder Service - Way To Populate Challenge-Detail Index For Legacy Marathon Matches v1.0
*
+ * Version 1.1 - Topcoder Elasticsearch Feeder Service - Jobs Cleanup And Improvement v1.0
+ * - add more methods for marathon match
+ *
* @author TCCODER
- * @version 1.1
+ * @version 1.1
*/
@DatasourceName("oltp")
public interface ChallengeDetailMMFeederDAO {
@@ -50,4 +58,21 @@ public interface ChallengeDetailMMFeederDAO {
*/
@SqlQueryFile("sql/mm-feeder-into-challenges/get_submissions_for_challenge_detail.sql")
List getSubmissionsForChallengeDetail(@ApiQueryInput QueryParameter queryParameter);
+
+ /**
+ * Get timestamp
+ *
+ * @return the result
+ */
+ @SqlQueryFile("sql/challenge-feeder/job/get_timestamp.sql")
+ DatabaseTimestamp getTimestamp();
+
+ /**
+ * Get the marathon matches whose registration phase started after the specified date and after the last run timestamp.
+ * @param date
+ * @param lastRunTimestamp
+ * @return
+ */
+ @SqlQueryFile("sql/mmatches-feeder/job/get_mm_registration_phase_started.sql")
+ List getMatchesWithRegistrationPhaseStartedIds(@Bind("initialDate") Date date, @Bind("lastRunTimestamp") Long lastRunTimestamp);
}
diff --git a/src/main/java/com/appirio/service/challengefeeder/dao/ChallengeFeederDAO.java b/src/main/java/com/appirio/service/challengefeeder/dao/ChallengeFeederDAO.java
deleted file mode 100644
index 9f9c4c3..0000000
--- a/src/main/java/com/appirio/service/challengefeeder/dao/ChallengeFeederDAO.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2017 TopCoder Inc., All Rights Reserved.
- */
-package com.appirio.service.challengefeeder.dao;
-
-
-import com.appirio.service.challengefeeder.api.*;
-import com.appirio.service.challengefeeder.dto.DatabaseTimestamp;
-import com.appirio.supply.dataaccess.ApiQueryInput;
-import com.appirio.supply.dataaccess.DatasourceName;
-import com.appirio.supply.dataaccess.SqlQueryFile;
-import com.appirio.tech.core.api.v3.TCID;
-import com.appirio.tech.core.api.v3.request.QueryParameter;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.skife.jdbi.v2.sqlobject.Bind;
-
-/**
- * DAO to interact with challenge data
- *
- * Version 1.1 - Topcoder - Create CronJob For Populating Changed Challenges To Elasticsearch v1.0
- * - add the methods to get the changed challenge ids and current timestamp
- *
- * Version 1.2 - Topcoder - Elasticsearch Service - Populate Challenge Points Prize In Challenges Index
- * - add the methods to get the prize points for the challenge ids
- *
- * @author TCCODER
- * @version 1.2
- */
-@DatasourceName("oltp")
-public interface ChallengeFeederDAO {
- /**
- * Get challenges
- *
- * @param queryParameter the queryParameter to use
- * @return the List result
- */
- @SqlQueryFile("sql/challenge-feeder/get_challenges.sql")
- List getChallenges(@ApiQueryInput QueryParameter queryParameter);
-
- /**
- * Get phases
- *
- * @param queryParameter the queryParameter to use
- * @return the List result
- */
- @SqlQueryFile("sql/challenge-feeder/get_phases.sql")
- List getPhases(@ApiQueryInput QueryParameter queryParameter);
-
- /**
- * Get resources
- *
- * @param queryParameter the queryParameter to use
- * @return the List result
- */
- @SqlQueryFile("sql/challenge-feeder/get_resources.sql")
- List getResources(@ApiQueryInput QueryParameter queryParameter);
-
- /**
- * Get events
- *
- * @param queryParameter the queryParameter to use
- * @return the List result
- */
- @SqlQueryFile("sql/challenge-feeder/get_events.sql")
- List getEvents(@ApiQueryInput QueryParameter queryParameter);
-
- /**
- * Get user ids
- *
- * @param queryParameter the queryParameter to use
- * @return the result
- */
- @SqlQueryFile("sql/challenge-feeder/get_user_ids.sql")
- List