forked from apache/incubator-kie-kogito-runtimes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Job Service implementation (#1)
* Initial Job Service implementation Initial Job Service implementation inserting swagger * Apply PR comments and some code refactoring, test * Fix JobScheduler when cancelling job * Fixing cancel already scheduled job when re-scheduling
- Loading branch information
1 parent
5f01ac7
commit ce7b785
Showing
25 changed files
with
1,459 additions
and
5 deletions.
There are no files selected for viewing
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
79 changes: 79 additions & 0 deletions
79
addons/jobs/jobs-api/src/main/java/org/kie/kogito/jobs/api/JobBuilder.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,79 @@ | ||
/* | ||
* Copyright 2019 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.kie.kogito.jobs.api; | ||
|
||
import java.time.ZonedDateTime; | ||
|
||
public class JobBuilder { | ||
|
||
private String id; | ||
private ZonedDateTime expirationTime; | ||
private Integer priority; | ||
private String callbackEndpoint; | ||
private String processInstanceId; | ||
private String rootProcessInstanceId; | ||
private String processId; | ||
private String rootProcessId; | ||
|
||
public JobBuilder id(String id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public JobBuilder expirationTime(ZonedDateTime expirationTime) { | ||
this.expirationTime = expirationTime; | ||
return this; | ||
} | ||
|
||
public JobBuilder priority(Integer priority) { | ||
this.priority = priority; | ||
return this; | ||
} | ||
|
||
public JobBuilder callbackEndpoint(String callbackEndpoint) { | ||
this.callbackEndpoint = callbackEndpoint; | ||
return this; | ||
} | ||
|
||
public JobBuilder processInstanceId(String processInstanceId) { | ||
this.processInstanceId = processInstanceId; | ||
return this; | ||
} | ||
|
||
public JobBuilder rootProcessInstanceId(String rootProcessInstanceId) { | ||
this.rootProcessInstanceId = rootProcessInstanceId; | ||
return this; | ||
} | ||
|
||
public JobBuilder processId(String processId) { | ||
this.processId = processId; | ||
return this; | ||
} | ||
|
||
public JobBuilder rootProcessId(String rootProcessId) { | ||
this.rootProcessId = rootProcessId; | ||
return this; | ||
} | ||
|
||
public Job build() { | ||
return new Job(id, expirationTime, priority, callbackEndpoint, processInstanceId, rootProcessInstanceId, processId, rootProcessId); | ||
} | ||
|
||
public static JobBuilder builder(){ | ||
return new JobBuilder(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -8,4 +8,6 @@ target/ | |
/*.ipr | ||
/*.iws | ||
*.iml | ||
*.log | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode | ||
# | ||
# Before building the docker image run: | ||
# | ||
# mvn package | ||
# | ||
# Then, build the image with: | ||
# | ||
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/jobs-service-jvm . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/jobs-service-jvm | ||
# | ||
### | ||
FROM fabric8/java-alpine-openjdk8-jre | ||
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
ENV AB_ENABLED=jmx_exporter | ||
COPY target/lib/* /deployments/lib/ | ||
COPY target/*-runner.jar /deployments/app.jar | ||
EXPOSE 8080 | ||
|
||
# run with user 1001 and be prepared for be running in OpenShift too | ||
RUN adduser -G root --no-create-home --disabled-password 1001 \ | ||
&& chown -R 1001 /deployments \ | ||
&& chmod -R "g+rwX" /deployments \ | ||
&& chown -R 1001:root /deployments | ||
USER 1001 | ||
|
||
ENTRYPOINT [ "/deployments/run-java.sh" ] |
22 changes: 22 additions & 0 deletions
22
addons/jobs/jobs-service/src/main/docker/Dockerfile.native
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,22 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode | ||
# | ||
# Before building the docker image run: | ||
# | ||
# mvn package -Pnative -Dnative-image.docker-build=true | ||
# | ||
# Then, build the image with: | ||
# | ||
# docker build -f src/main/docker/Dockerfile.native -t quarkus/jobs-service . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/jobs-service | ||
# | ||
### | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal | ||
WORKDIR /work/ | ||
COPY target/*-runner /work/application | ||
RUN chmod 775 /work | ||
EXPOSE 8080 | ||
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] |
Oops, something went wrong.