moleculerjs / moleculerjs/rfcs
Event acknowledgement
Open
Nobody has claimed this yet.
Change: Major
Module: Core
Stage: 1
- Dominant language
- No language data
- Stars
- 2
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
- Start Date: 2019-09-04
- Target Version: (0.14 / 0.15)
- Reference Issues: (fill in existing related issues, if any)
- Implementation PR: (leave this empty)
Summary
Implement acknowledgement for events.
Basic example
In caller side
await this.broker.emit("user.created", { user }, { ack: true });
In event handler side
// activation.service.js
module.exports = {
name: "activation",
events: {
async "user.created"(ctx) {
try {
await this.activateUser(ctx.params.user);
// Acknowledges the received event.
ctx.ack();
} catch(err) {
// Negative acknowledges the received event.
ctx.nack();
}
}
}
};
Motivation
TODO
Detailed design
TODO
Drawbacks
TODO
Alternatives
TODO
Adoption strategy
TODO
Unresolved questions
- What happens with broadcast messages. Sending to all services?
- What happens if mixins register the same event listener, so the service has multiple handlers for the same event?
- How the caller side can check the acknowledgement result that it was successful or not?
- What happens, if one listener was successful and other was failed?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the caller-side broker.emit example and the event-handler example in this issue. Define the acknowledgement behavior for broadcast messages, multiple listeners, and mixed success or failure, then specify how the caller observes the result; the issue is done when those unresolved questions have a decided design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend-api-design, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100