pub trait Tasklet {
// Required method
fn execute(
&self,
step_execution: &StepExecution,
) -> Result<RepeatStatus, BatchError>;
}Expand description
A tasklet represents a single task or operation that can be executed as part of a step.
Tasklets are useful for operations that don’t fit the chunk-oriented processing model, such as file operations, database maintenance, or custom business logic.
§Examples
use spring_batch_rs::core::step::{StepExecution, RepeatStatus};
use spring_batch_rs::BatchError;
use spring_batch_rs::core::step::Tasklet;
struct FileCleanupTasklet {
directory: String,
}
impl Tasklet for FileCleanupTasklet {
fn execute(&self, _step_execution: &StepExecution) -> Result<RepeatStatus, BatchError> {
// Perform file cleanup logic here
println!("Cleaning up directory: {}", self.directory);
Ok(RepeatStatus::Finished)
}
}Required Methods§
Sourcefn execute(
&self,
step_execution: &StepExecution,
) -> Result<RepeatStatus, BatchError>
fn execute( &self, step_execution: &StepExecution, ) -> Result<RepeatStatus, BatchError>
Implementors§
impl Tasklet for FtpGetFolderTasklet
Available on crate feature
ftp only.impl Tasklet for FtpGetTasklet
Available on crate feature
ftp only.impl Tasklet for FtpPutFolderTasklet
Available on crate feature
ftp only.impl Tasklet for FtpPutTasklet
Available on crate feature
ftp only.impl Tasklet for ZipTasklet
Available on crate feature
zip only.