-
Notifications
You must be signed in to change notification settings - Fork 1
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
Reply after emit without state doesn't compile #105
Comments
Did you try #99 ? |
Yes, that's what I'm using now as a workaround ( emit_event(Event::DeliverySelected {
delivery: DeliveryInProgress {
drone_id,
delivery_id: delivery.delivery_id.clone(),
pickup_time: Utc::now()
}
}).and_then_reply(move |_queue: &Self,
_new_state: Option<&State>,
_prev_result: effect::Result| {
reply_to.send(Some(delivery));
// fixme don't pretend we wait for something async?
future::ready(Ok(()))
}).boxed() When what I'd expected from the API docs is: emit_event(Event::DeliverySelected {
delivery: DeliveryInProgress {
drone_id,
delivery_id: delivery.delivery_id.clone(),
pickup_time: Utc::now()
}
}).reply(reply_to, delivery) |
I figured out how to do it (so maybe more motivation for #104 ): emit_event(Event::DeliverySelected {
delivery: DeliveryInProgress {
drone_id,
delivery_id: delivery.delivery_id.clone(),
pickup_time: Utc::now()
}
}).and(reply(reply_to, Some(delivery))).boxed() |
I wasn't sure whether I should supply conveniences for the successful completion case as well was the more comprehensive I could compliment all of the |
Closed but didn't see your comment, so reopening. Specifically persist and then ack is probably one of the two most common path for a command handler, so it might make sense with a |
Having both If I understand it correctly it's not possible to have overloaded functions? Same name different parameters. |
Looking at the TryFutureExt what I understand is that The In the JVM we never talk about the failure case, so maybe dropping that from the effect DSL would clean things up a bit, only have composition for the happy path and fail the entity for errors. Not sure if I saw any previous discussion/decision on that aspect. We also do not have any async-chains there, and separate the main effect from side effects, which keeps things a bit simpler. |
OK, given #114 it'd be great if we could review and possibly close this. Thanks. |
I didn't try it yet, but since the test does the exact thing we can close. |
From the docs I had expected this to be possible:
But I get an error for the
reply
call saying "method not found in `EmitEvent<_>"The text was updated successfully, but these errors were encountered: