-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add retries configuration to InngestFunction * Add a test function with zero retries * Address PR comments
- Loading branch information
Showing
6 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...boot-demo/src/main/java/com/inngest/springbootdemo/testfunctions/ZeroRetriesFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.inngest.springbootdemo.testfunctions; | ||
|
||
import com.inngest.*; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ZeroRetriesFunction extends InngestFunction { | ||
@NotNull | ||
@Override | ||
public InngestFunctionConfigBuilder config(InngestFunctionConfigBuilder builder) { | ||
return builder | ||
.id("zero-retries-function") | ||
.name("Zero Retries Function") | ||
.triggerEvent("test/zero.retries") | ||
.retries(0); | ||
} | ||
|
||
@Override | ||
public String execute(FunctionContext ctx, Step step) { | ||
step.run("fail-step", () -> { | ||
throw new RetryAfterError("This is a retriable exception but retries are set to 0", 50); | ||
}, String.class); | ||
|
||
// This is unreachable because the step above will always throw an exception, and it will never be retried. | ||
return "Success"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters