Skip to content

Latest commit

 

History

History
67 lines (54 loc) · 2.94 KB

faq.md

File metadata and controls

67 lines (54 loc) · 2.94 KB
id title
faq
FAQ

Q: Where can I find information about CQRS and Event Sourcing?
A: Refer to the following resources:

Q: What is the difference between a Read Model and a View Model?
A: Read Models implement the standard event sourcing mechanisms. View Models are a Redux-specific extension to these mechanisms. View models are reactive and use websockets to synchronize their state with the redux state on the client.

Q: How to implement a Read Model with direct access to the underlying store?
A: Implement a custom Read Model. Custom Read Models allow you to use custom logic to communicate with a Read Model store.

Q: How to send an aggregate command?
A: To send a command from a client browser, use the standard HTTP API:

$ curl -X POST "http://localhost:3000/api/commands"
--header "Content-Type: application/json" \
--data '
{
  "aggregateName":"Todo",
  "type":"createItem",
  "aggregateId":"root-id",
  "payload": {
    "id":`date +%s`,
    "text":"Learn reSolve API"
  }
}

On the server side, you can send a command from an API Handler or Saga:

await sideEffects.executeCommand({
  aggregateName: 'User',
  aggregateId: event.aggregateId,
  type: 'requestConfirmUser',
  payload: event.payload
})

Q: How to perform validation to ensure input values are unique?
A: In a distributed application, it is not possible to perform reliable checks. You should detect value duplicates in a Read Model or Saga projection code and mark duplicated values as incorrect.

Q: How to implement a frontend?
A: There are three main approaches to frontend development in reSolve:

  • Use one of the available client libraries. Refer to the Frontend article for more information.
  • Use the HTTP API exposed by a reSolve application.
  • Write your own wrappers for the reSolve HTTP API.