This page provides a generic description of the way commands differ from queries in Fineract CN services.

CQRS stands for Command Query Responsibility Segregation.  In the case of REST services, the most common commands are POST, PUT, DELETE, and the most common query is GET.  Fineract CN services execute commands asynchronously and queries synchronously.

Asynchronous Command Execution

Asynchronous command execution means that as soon as some basic checks are performed, and the command is persisted to the cassandra repository, the REST controller returns ACCEPTED for a given change request.  Actual execution of the command is performed asynchronously in the command handler sometime after the REST controller returns.

The advantage to this approach is that it's really fast.  The drawback is that some kinds of errors can only be detected while the command handler is executing and this class of errors will not be surfaced appropriately to the user.  The basic sanity checks are intended to ameliorate this.

Synchronous Query Response

Query processing is necessarily synchronous.  The command database is ignored for the purpose of queries.  Only the SQL repository is addressed.

  • No labels