Skip to content

Commit

Permalink
add sqs spin trigger
Browse files Browse the repository at this point in the history
Signed-off-by: leonardpahlke <[email protected]>
  • Loading branch information
leonardpahlke committed Nov 17, 2023
1 parent 62056e9 commit 91ed2c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions containerd-shim-spin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spin-core = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
spin-trigger = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
spin-trigger-http = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
spin-redis-engine = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
trigger-sqs = { git = "https://github.com/fermyon/spin-trigger-sqs", tag = "canary" }
spin-manifest = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
spin-loader = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
spin-oci = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
Expand Down
16 changes: 13 additions & 3 deletions containerd-shim-spin/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use spin_loader::cache::Cache;
use spin_loader::FilesMountStrategy;
use spin_manifest::schema::v2::AppManifest;
use spin_redis_engine::RedisTrigger;
use trigger-sqs::SqsTrigger;
use spin_trigger::TriggerHooks;
use spin_trigger::{loader, RuntimeConfig, TriggerExecutor, TriggerExecutorBuilder};
use spin_trigger_http::HttpTrigger;
Expand Down Expand Up @@ -172,8 +173,17 @@ impl SpinEngine {
info!(" >>> running spin trigger");
redis_trigger.run(spin_trigger::cli::NoArgs)
}
SqsTrigger::TRIGGER_TYPE => {
let sqs_trigger: SqsTrigger = self
.build_spin_trigger(working_dir, app)
.await
.context("failed to build spin trigger")?;

info!(" >>> running spin trigger");
sqs_trigger.run(spin_trigger::cli::NoArgs)
}
_ => {
todo!("Only Http and Redis triggers are currently supported.")
todo!("Only Http, Redis and SQS triggers are currently supported.")
}
};
info!(" >>> notifying main thread we are about to start");
Expand Down Expand Up @@ -297,9 +307,9 @@ fn trigger_command_for_resolved_app_source(resolved: &ResolvedAppSource) -> Resu
let trigger_type = resolved.trigger_type()?;

match trigger_type {
RedisTrigger::TRIGGER_TYPE | HttpTrigger::TRIGGER_TYPE => Ok(trigger_type.to_owned()),
RedisTrigger::TRIGGER_TYPE | HttpTrigger::TRIGGER_TYPE | SqsTrigger::TRIGGER_TYPE => Ok(trigger_type.to_owned()),
_ => {
todo!("Only Http and Redis triggers are currently supported.")
todo!("Only Http, Redis and SQS triggers are currently supported.")
}
}
}
Expand Down

0 comments on commit 91ed2c4

Please sign in to comment.