Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83c11ee
commit b4d0265
Showing
61 changed files
with
1,377 additions
and
215 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
6 changes: 3 additions & 3 deletions
6
cli/src/main/java/org/floworc/core/App.java → cli/src/main/java/org/floworc/cli/App.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
55 changes: 55 additions & 0 deletions
55
cli/src/main/java/org/floworc/cli/commands/TestCommand.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,55 @@ | ||
package org.floworc.cli.commands; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.floworc.core.models.flows.Flow; | ||
import org.floworc.core.repositories.FlowRepositoryInterface; | ||
import org.floworc.core.repositories.LocalFlowRepositoryLoader; | ||
import org.floworc.core.runners.RunnerUtils; | ||
import org.floworc.runner.memory.MemoryRunner; | ||
import picocli.CommandLine; | ||
|
||
import javax.inject.Inject; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
@CommandLine.Command( | ||
name = "test", | ||
description = "test a flow" | ||
) | ||
@Slf4j | ||
public class TestCommand implements Runnable { | ||
@CommandLine.Parameters(description = "the flow file to test") | ||
private Path file; | ||
|
||
@Inject | ||
private MemoryRunner runner; | ||
|
||
@Inject | ||
private LocalFlowRepositoryLoader repositoryLoader; | ||
|
||
@Inject | ||
private FlowRepositoryInterface flowRepository; | ||
|
||
@Inject | ||
private RunnerUtils runnerUtils; | ||
|
||
public void run() { | ||
try { | ||
runner.run(); | ||
repositoryLoader.load(file.toFile()); | ||
|
||
List<Flow> all = flowRepository.findAll(); | ||
if (all.size() != 1) { | ||
throw new IllegalArgumentException("Too many flow found, need 1, found " + all.size()); | ||
} | ||
|
||
runnerUtils.runOne(all.get(0).getId()); | ||
runner.close(); | ||
} catch (IOException | TimeoutException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
|
||
} | ||
} |
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
35 changes: 0 additions & 35 deletions
35
cli/src/main/java/org/floworc/core/commands/TestCommand.java
This file was deleted.
Oops, something went wrong.
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,3 +1,41 @@ | ||
micronaut: | ||
application: | ||
name: floworc | ||
|
||
floworc: | ||
kafka: | ||
defaults: | ||
topic: | ||
partitions: 64 | ||
replication-factor: 1 | ||
properties: | ||
compression.type: "lz4" | ||
|
||
consumer: | ||
properties: | ||
isolation.level: "read_committed" | ||
auto.offset.reset: "earliest" | ||
enable.auto.commit: "false" | ||
|
||
producer: | ||
properties: | ||
acks: "all" | ||
|
||
stream: | ||
properties: | ||
processing.guarantee: "exactly_once" | ||
replication.factor: "${floworc.kafka.defaults.topic.replication-factor}" | ||
acks: "all" | ||
|
||
topics: | ||
org.floworc.core.models.executions.Execution: | ||
name: "floworc_execution" | ||
properties: | ||
cleanup.policy: "compact" | ||
retention.ms: "-1" | ||
|
||
org.floworc.core.runners.WorkerTask: | ||
name: "floworc_workertask" | ||
|
||
org.floworc.core.runners.WorkerTaskResult: | ||
name: "floworc_workertaskresult" |
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: 2 additions & 1 deletion
3
core/src/main/java/org/floworc/core/models/executions/Execution.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
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
39 changes: 39 additions & 0 deletions
39
core/src/main/java/org/floworc/core/repositories/LocalFlowRepositoryLoader.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,39 @@ | ||
package org.floworc.core.repositories; | ||
|
||
import org.floworc.core.models.flows.Flow; | ||
import org.floworc.core.serializers.YamlFlowParser; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Singleton | ||
public class LocalFlowRepositoryLoader { | ||
private static final YamlFlowParser yamlFlowParser = new YamlFlowParser(); | ||
|
||
@Inject | ||
private FlowRepositoryInterface flowRepository; | ||
|
||
public void load(URL basePath) throws IOException, URISyntaxException { | ||
this.load(new File(basePath.toURI())); | ||
} | ||
|
||
public void load(File basePath) throws IOException { | ||
List<Path> list = Files.walk(basePath.toPath()) | ||
.filter(path -> com.google.common.io.Files.getFileExtension(path.toString()).equals("yaml")) | ||
.collect(Collectors.toList()); | ||
|
||
for (Path file: list) { | ||
Flow parse = yamlFlowParser.parse(file.toFile()); | ||
|
||
flowRepository.save(parse); | ||
} | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
core/src/main/java/org/floworc/core/runners/ExecutionStateInterface.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,7 +1,4 @@ | ||
package org.floworc.core.runners; | ||
|
||
import io.micronaut.context.annotation.Prototype; | ||
|
||
@Prototype | ||
public interface ExecutionStateInterface extends Runnable { | ||
} |
Oops, something went wrong.