Implement a startup script which runs once on microservice start.

This commit is contained in:
Seán Healy
2026-05-08 20:45:49 +01:00
parent 13b82d66c6
commit c823a73bc4
6 changed files with 246 additions and 21 deletions

View File

@@ -18,8 +18,21 @@ fn process(
Ok(vec![(request, "case_a".to_string())])
}
fn startup(
_read_file: &ReadFileFn,
_write_file: &WriteFileFn,
_connection: &mut PgConnection,
) -> Result<Vec<(u64, String)>, AnyError> {
Ok(Vec::new())
}
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let microservice = Microservice::new("simple-microservice", "sys-map.slingshot.cv", process);
let microservice = Microservice::new(
"simple-microservice",
"sys-map.slingshot.cv",
startup,
process,
);
microservice.start()?;
Ok(())