-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(worker): context is available for scripting
* the context contains the current job and the Zeebe client * get rid of Spring Boot
- Loading branch information
Showing
8 changed files
with
268 additions
and
58 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
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
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,49 @@ | ||
/* | ||
* Copyright © 2017 camunda services GmbH ([email protected]) | ||
* | ||
* 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 io.zeebe.script; | ||
|
||
import io.zeebe.client.ZeebeClient; | ||
import io.zeebe.client.api.subscription.JobWorker; | ||
import java.time.Duration; | ||
|
||
public class ZeebeScriptWorker { | ||
|
||
private final String contactPoint; | ||
|
||
private JobWorker jobWorker; | ||
|
||
public ZeebeScriptWorker(String contactPoint) { | ||
this.contactPoint = contactPoint; | ||
} | ||
|
||
public void start() { | ||
final ZeebeClient client = | ||
ZeebeClient.newClientBuilder() | ||
.brokerContactPoint(contactPoint) | ||
.defaultJobWorkerName("script-worker") | ||
.defaultJobTimeout(Duration.ofSeconds(10)) | ||
.build(); | ||
|
||
final ScriptJobHandler jobHandler = new ScriptJobHandler(client); | ||
jobWorker = client.jobClient().newWorker().jobType("script").handler(jobHandler).open(); | ||
} | ||
|
||
public void stop() { | ||
if (jobWorker != null) { | ||
jobWorker.close(); | ||
} | ||
} | ||
} |
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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Configuration status="WARN"> | ||
|
||
<Appenders> | ||
<Console name="Console" target="SYSTEM_OUT"> | ||
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> | ||
</Console> | ||
</Appenders> | ||
|
||
<Loggers> | ||
<Logger name="io.zeebe" level="info"/> | ||
<Logger name="io.zeebe.script" level="debug"/> | ||
|
||
<Root level="info"> | ||
<AppenderRef ref="Console"/> | ||
</Root> | ||
</Loggers> | ||
|
||
</Configuration> |
Oops, something went wrong.