-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New quickstart #214
New quickstart #214
Conversation
templates/java-maven-spring-boot/src/main/java/com/example/restatestarter/Utils.java
Outdated
Show resolved
Hide resolved
templates/java-maven-spring-boot/src/main/java/com/example/restatestarter/Utils.java
Outdated
Show resolved
Hide resolved
templates/java-maven-spring-boot/src/main/java/com/example/restatestarter/Greeter.java
Show resolved
Hide resolved
templates/rust-shuttle/src/utils.rs
Outdated
pub fn send_notification(greeting_id: &str, name: &str) { | ||
if random::<f32>() < 0.5 { | ||
println!("👻 Failed to send notification: {} - {}", greeting_id, name); | ||
panic!("Failed to send notification: {} - {}", greeting_id, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a good idea, convert this to error. I'm not even sure we catch panics actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing you can do to make this code better overall is the following:
Change the signature of this function to
pub async fn send_notification(greeting_id: &str, name: &str) -> anyhow::Result<()>
And then the context run should be as easy as
ctx.run(|| send_notification(&greeting_id, &name)).await?
templates/rust/src/utils.rs
Outdated
@@ -0,0 +1,17 @@ | |||
use rand::random; | |||
|
|||
pub fn send_notification(greeting_id: &str, name: &str) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments above
# Conflicts: # templates/java-gradle/src/main/java/my/example/Greeter.java # templates/java-maven/src/main/java/my/example/Greeter.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one minor thing and lgtm
class GreetingRequest(BaseModel): | ||
name: str | ||
|
||
|
||
class Greeting(BaseModel): | ||
message: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would honestly have them in example.py
, makes the whole thing way more readable, and this is super small...
We want to show Durable Execution in the quickstart. This allows us to make the quickstart touch upon the main features of Restate.