Skip to content
Merged
Show file tree
Hide file tree
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 @@ -7,4 +7,8 @@ private CamelProperties() {}
public static final String AUTH_TYPE = "authType";
public static final String IS_BATCH_READY = "isBatchReady"; // camel property to check if batch is ready for sampling

public static final String SERVER_FILE_NAME = "serverFileNam";

public static final String LOCAL_FILE_PATH = "localFilePath";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.mifos.processor.bulk.camel.routes;

import org.mifos.processor.bulk.file.FileTransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.File;
import java.io.FileOutputStream;

import static org.mifos.processor.bulk.camel.config.CamelProperties.LOCAL_FILE_PATH;
import static org.mifos.processor.bulk.camel.config.CamelProperties.SERVER_FILE_NAME;

@Component
public class FileDownloadingRoute extends BaseRouteBuilder{

@Autowired
@Qualifier("awsStorage")
private FileTransferService fileTransferService;

@Value("${application.bucket-name}")
private String bucketName;

@Override
public void configure() throws Exception {
from("direct:download-file")
.id("download-file")
.log("Started download-file route")
.process(exchange -> {
String filename = exchange.getProperty(SERVER_FILE_NAME, String.class);

byte[] csvFile = fileTransferService.downloadFile(filename, bucketName);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also need to be handled using a stream, so that large files can be handled properly

File file = new File(filename);
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(csvFile);
}
exchange.setProperty(LOCAL_FILE_PATH, file.getAbsolutePath());
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
@Component
public class WorkerConfig {

@Value("${config.partylookup}")
@Value("${config.partylookup.enable}")
public boolean isPartyLookUpWorkerEnabled;

@Value("${config.approval}")
@Value("${config.approval.enable}")
public boolean isApprovalWorkerEnabled;

@Value("${config.ordering}")
@Value("${config.ordering.enable}")
public boolean isOrderingWorkerEnabled;

@Value("${config.splitting}")
@Value("${config.splitting.enable}")
public boolean isSplittingWorkerEnabled;

@Value("${config.formatting}")
@Value("${config.formatting.enable}")
public boolean isFormattingWorkerEnabled;

@Value("${config.mergeback}")
@Value("${config.mergeback.enable}")
public boolean isMergeBackWorkerEnabled;


Expand Down
22 changes: 15 additions & 7 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ bpmn:

config:
minimum-successful-tx-ratio: 0.90
partylookup: false
approval: false
ordering: true
splitting: false
formatting: true
mergeback: false
backpressure: false
partylookup:
enable: false
approval:
enable: false
ordering:
enable: true
splitting:
enable: false
batch-size: 10
formatting:
enable: true
mergeback:
enable: false
backpressure:
enable: false