forked from lsmyrnaios/UrlsWorker
- Update Spring and add the "gradle-wrapper.properties" file which defines the gradle version.
- Improve an info-logging message and cleanup the code.
This commit is contained in:
parent
53ccea869a
commit
5f3409e072
10
build.gradle
10
build.gradle
|
@ -1,11 +1,11 @@
|
|||
buildscript {
|
||||
ext {
|
||||
springSecurityVersion = "5.4.6"
|
||||
springSecurityVersion = "5.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '2.4.5'
|
||||
id 'org.springframework.boot' version '2.5.0'
|
||||
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
||||
id 'java'
|
||||
}
|
||||
|
@ -28,14 +28,10 @@ dependencies {
|
|||
implementation("org.springframework.security:spring-security-core:${springSecurityVersion}")
|
||||
implementation("org.springframework.security:spring-security-web:${springSecurityVersion}")
|
||||
implementation("org.springframework.security:spring-security-config:${springSecurityVersion}")
|
||||
implementation("io.jsonwebtoken:jjwt:0.9.1")
|
||||
|
||||
//implementation("io.jsonwebtoken:jjwt:0.9.1") // Use this in case we use auth-tokens later on.
|
||||
|
||||
implementation "org.projectlombok:lombok:1.18.20"
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
|
||||
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
|
||||
implementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
|
||||
|
||||
// https://mvnrepository.com/artifact/com.google.guava/guava
|
||||
implementation group: 'com.google.guava', name: 'guava', version: '30.1.1-jre' // It will be usefull later..
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -21,8 +21,8 @@ public class AssignmentHandler {
|
|||
|
||||
public static boolean isAvailableForWork = false;
|
||||
|
||||
public static Assignment requestAssignment() {
|
||||
|
||||
public static Assignment requestAssignment()
|
||||
{
|
||||
RestTemplate restTemplate = new RestTemplateBuilder().build();
|
||||
String url = "http://localhost:8080/api/urls/test?workerId=" + WorkerConstants.WORKER_ID + "&tasksLimit=" + WorkerConstants.TASKS_LIMIT;
|
||||
String json = null;
|
||||
|
@ -51,15 +51,15 @@ public class AssignmentHandler {
|
|||
//logger.debug(assignmentRequest.toString()); // DEBUG!
|
||||
|
||||
Assignment assignment = assignmentRequest.getAssignment();
|
||||
logger.info("Assignment with id < " + assignment.getAssignmentId() + " > was received and it's ready to be processed.");
|
||||
logger.info("Assignment with id < " + assignment.getAssignmentId() + " > was received and it's ready to be processed. It contains " + assignment.getTasks().size() + " tasks.");
|
||||
// TODO - Maybe create a HashSet with these IDs. It may be useful for the Worker to know and report which assignments (and how many) it has processed.
|
||||
|
||||
return assignment;
|
||||
}
|
||||
|
||||
|
||||
public static void handleAssignment() {
|
||||
|
||||
public static void handleAssignment()
|
||||
{
|
||||
Assignment assignment = requestAssignment();
|
||||
if ( assignment == null ) {
|
||||
logger.warn("The assignment was found to be null!");
|
||||
|
|
|
@ -4,4 +4,5 @@ public interface WorkerConstants {
|
|||
|
||||
String WORKER_ID = "worker_1"; // This should be different for every deployment of a Worker.
|
||||
int TASKS_LIMIT = 10000;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue