From aab3c42a28dfedac7937787c9fddb0a2b8ab7dc8 Mon Sep 17 00:00:00 2001 From: Darwin <5746693+darwin67@users.noreply.github.com> Date: Wed, 17 Jul 2024 20:29:30 -0700 Subject: [PATCH] Make serve config configurable on spring boot adapter (#56) * expose serve config to be configurable * update version for adapter --------- Co-authored-by: Darwin D Wu --- inngest-spring-boot-adapter/VERSION | 2 +- .../com/inngest/springboot/InngestConfiguration.java | 9 +++++---- .../com/inngest/springbootdemo/DemoConfiguration.java | 7 ++++++- .../inngest/springbootdemo/DemoTestConfiguration.java | 5 +++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/inngest-spring-boot-adapter/VERSION b/inngest-spring-boot-adapter/VERSION index bcab45af..81340c7e 100644 --- a/inngest-spring-boot-adapter/VERSION +++ b/inngest-spring-boot-adapter/VERSION @@ -1 +1 @@ -0.0.3 +0.0.4 diff --git a/inngest-spring-boot-adapter/src/main/java/com/inngest/springboot/InngestConfiguration.java b/inngest-spring-boot-adapter/src/main/java/com/inngest/springboot/InngestConfiguration.java index 2c10cc33..746a0884 100644 --- a/inngest-spring-boot-adapter/src/main/java/com/inngest/springboot/InngestConfiguration.java +++ b/inngest-spring-boot-adapter/src/main/java/com/inngest/springboot/InngestConfiguration.java @@ -15,9 +15,10 @@ public abstract class InngestConfiguration { protected abstract Inngest inngestClient(); @Bean - protected CommHandler commHandler(@Autowired Inngest inngestClient) { - // TODO: Add missing configuration - ServeConfig serveConfig = new ServeConfig(inngestClient); - return new CommHandler(functions(), inngestClient, serveConfig, frameworkName); + protected abstract ServeConfig serve(@Autowired Inngest inngestClient); + + @Bean + protected CommHandler commHandler(@Autowired Inngest inngestClient, @Autowired ServeConfig serve) { + return new CommHandler(functions(), inngestClient, serve, frameworkName); } } diff --git a/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DemoConfiguration.java b/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DemoConfiguration.java index 4e81c4e3..9e8992ee 100644 --- a/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DemoConfiguration.java +++ b/inngest-spring-boot-demo/src/main/java/com/inngest/springbootdemo/DemoConfiguration.java @@ -21,7 +21,12 @@ public HashMap functions() { } @Override - public Inngest inngestClient() { + protected Inngest inngestClient() { return new Inngest("spring_demo"); } + + @Override + protected ServeConfig serve(Inngest inngestClient) { + return new ServeConfig(inngestClient); + } } diff --git a/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DemoTestConfiguration.java b/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DemoTestConfiguration.java index 6892142f..0e576eb9 100644 --- a/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DemoTestConfiguration.java +++ b/inngest-spring-boot-demo/src/test/java/com/inngest/springbootdemo/DemoTestConfiguration.java @@ -35,6 +35,11 @@ protected Inngest inngestClient() { return new Inngest("spring_test_demo"); } + @Override + protected ServeConfig serve(Inngest client) { + return new ServeConfig(client); + } + @Bean protected CommHandler commHandler(@Autowired Inngest inngestClient) { ServeConfig serveConfig = new ServeConfig(inngestClient);