Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use target as the temporary directory location for the Flink mini cluster #6432

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading