-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added base docker compose file, fixed cache eviction trigger in polli…
…ng service, fixed compilation errosm in polling service, made vehicle entity type consistent for redis persistence to be shared acrioss two different projects, removed throwing exception from scheduled tasks, fixed cron timings for polling service for consistent results, implemented logic to determine vehicle staleness, moved functional interface implementations to init method of refresh service in polling service, implemented correct setting of expiration time for redis keys cleanup service of polling service, implemented end to end flow of vehicle service to get all vehicles and their details by their vin
- Loading branch information
1 parent
a7dc8d4
commit fd38b05
Showing
51 changed files
with
866 additions
and
98 deletions.
There are no files selected for viewing
Empty file.
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,5 @@ | ||
FROM adoptopenjdk:11-jre-hotspot-focal | ||
MAINTAINER Anirban Das <anirbandas18@live.com> | ||
RUN mkdip ~p /opt/sharenow-coding-challenge | ||
COPY target/polling-app.jar /opt/sharenow-coding-challenge/polling-app.jar | ||
CMD ["java","-jar","/opt/sharenow-coding-challenge/polling-app.jar"] |
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
10 changes: 10 additions & 0 deletions
10
...a/com/teenthofabud/codingchallenge/sharenow/polling/cleanup/service/VehicleStaleness.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,10 @@ | ||
package com.teenthofabud.codingchallenge.sharenow.polling.cleanup.service; | ||
|
||
import com.teenthofabud.codingchallenge.sharenow.polling.model.entity.VehicleEntity; | ||
|
||
@FunctionalInterface | ||
public interface VehicleStaleness { | ||
|
||
public boolean isVehicleStale(VehicleEntity entity); | ||
|
||
} |
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
8 changes: 8 additions & 0 deletions
8
...in/java/com/teenthofabud/codingchallenge/sharenow/polling/exception/PollingErrorCode.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,8 @@ | ||
package com.teenthofabud.codingchallenge.sharenow.polling.exception; | ||
|
||
public enum PollingErrorCode { | ||
|
||
REST_ERROR, | ||
SCHEDULED_ERROR | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
.../com/teenthofabud/codingchallenge/sharenow/polling/exception/PollingServiceException.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 |
---|---|---|
@@ -1,4 +1,24 @@ | ||
package com.teenthofabud.codingchallenge.sharenow.polling.exception; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class PollingServiceException extends RuntimeException { | ||
|
||
private PollingErrorCode errorCode; | ||
private String message; | ||
|
||
public PollingServiceException(String message) { | ||
super(message); | ||
this.message = message; | ||
} | ||
|
||
public PollingServiceException(String message, PollingErrorCode errorCode) { | ||
super(message); | ||
this.message = message; | ||
this.errorCode = errorCode; | ||
} | ||
|
||
} |
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
23 changes: 23 additions & 0 deletions
23
...om/teenthofabud/codingchallenge/sharenow/polling/filter/ScheduledServiceErrorHandler.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,23 @@ | ||
package com.teenthofabud.codingchallenge.sharenow.polling.filter; | ||
|
||
import com.teenthofabud.codingchallenge.sharenow.polling.exception.PollingErrorCode; | ||
import com.teenthofabud.codingchallenge.sharenow.polling.exception.PollingServiceException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.task.TaskSchedulerCustomizer; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; | ||
|
||
@Configuration | ||
public class ScheduledServiceErrorHandler implements TaskSchedulerCustomizer { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(ScheduledServiceErrorHandler.class); | ||
|
||
@Override | ||
public void customize(ThreadPoolTaskScheduler taskScheduler) { | ||
taskScheduler.setErrorHandler(t -> { | ||
LOGGER.error("Error executing scheduled task: {}", t.getMessage()); | ||
t.printStackTrace(); | ||
}); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...e/src/main/java/com/teenthofabud/codingchallenge/sharenow/polling/model/dto/ErrorDTO.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
2 changes: 1 addition & 1 deletion
2
...rc/main/java/com/teenthofabud/codingchallenge/sharenow/polling/model/dto/PositionDTO.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
2 changes: 1 addition & 1 deletion
2
...src/main/java/com/teenthofabud/codingchallenge/sharenow/polling/model/dto/VehicleDTO.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
2 changes: 1 addition & 1 deletion
2
...n/java/com/teenthofabud/codingchallenge/sharenow/polling/model/entity/PositionEntity.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
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
3 changes: 0 additions & 3 deletions
3
...d/codingchallenge/sharenow/polling/refresh/configuration/VehicleRefreshConfiguration.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
4 changes: 2 additions & 2 deletions
4
...ofabud/codingchallenge/sharenow/polling/refresh/converter/PositionDTO2EntityConveter.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
4 changes: 2 additions & 2 deletions
4
...hofabud/codingchallenge/sharenow/polling/refresh/converter/VehicleDTO2EntityConveter.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
3 changes: 2 additions & 1 deletion
3
.../java/com/teenthofabud/codingchallenge/sharenow/polling/refresh/service/VehicleInput.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
2 changes: 1 addition & 1 deletion
2
...java/com/teenthofabud/codingchallenge/sharenow/polling/refresh/service/VehicleOutput.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
4 changes: 2 additions & 2 deletions
4
...a/com/teenthofabud/codingchallenge/sharenow/polling/refresh/service/VehicleProcessor.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
2 changes: 1 addition & 1 deletion
2
...ava/com/teenthofabud/codingchallenge/sharenow/polling/refresh/service/VehicleService.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
Oops, something went wrong.