Skip to content

Commit

Permalink
Use target as the temporary directory location for the Flink mini clu…
Browse files Browse the repository at this point in the history
…ster
  • Loading branch information
jamesnetherton committed Sep 6, 2024
1 parent 05d223a commit 10bf4e9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.camel.component.flink.VoidDataStreamCallback;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -66,6 +67,7 @@ public Response dataSetFromTextFile(@PathParam("filePath") String filePath) {

if (Files.exists(Paths.get(filePath))) {
ExecutionEnvironment env = Flinks.createExecutionEnvironment();
env.getConfiguration().setString("io.tmp.dirs", "target");
DataSet<String> myDataSet = env.readTextFile(filePath);
context.getRegistry().bind("myDataSet", myDataSet);
context.getRegistry().bind("countTotal", addDataSetCallback());
Expand All @@ -84,7 +86,9 @@ public Response dataSetFromTextFile(@PathParam("filePath") String filePath) {
public Response loadStream(@PathParam("filePath") String filePath, String data) throws IOException {
java.nio.file.Path path = Paths.get(filePath);
if (path != null) {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
Configuration configuration = new Configuration();
configuration.setString("io.tmp.dirs", "target");
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(configuration);
DataStream<String> datastream = env.fromElements(data);
context.getRegistry().bind("myDataStream", datastream);
template.sendBodyAndHeader(flinkDataStreamUri, null,
Expand Down

0 comments on commit 10bf4e9

Please sign in to comment.