Types of Hooks

Event Hooks

Event hooks are invoked in an asynchronous manner after the event has occurred. Post an
insert operation, update operation or delete operation, the registered event hooks will be
invoked. By the time the hook is invoked the operation has already executed.

The database does not guarantee innovation of the hook. Invocation of event hooks is not
covered within the ACID properties of the database. This means if a failure occurs on the
database that causes the database or a node on the database to abruptly shutdown
immediately after a transaction; then the hook corresponding to such a transaction may
never be invoked.

If the URL for an event hook is unresponsive or not reachable and the invocation in the
first attempt fails, no re-attempts are made. If your external system that wants to hook
into the database requires consistency of data, then it is recommended you use transaction
hooks.

Transaction Hooks

Transaction hooks are invoked just before an insert, update or delete transaction is
committed. The hook is required to response back with either a commit or rollback
message that instructs the transaction to be either committed or rolled-back.

A transaction cannot be committed unless a registered transaction hook does not approve
of the commit. It could however be rollbacked without invocation of the hook, and it will
rollback if a hook invocation fails, or an invoked hook fails to respond before a request
timeout.

A transaction hook may be invoked twice for the same transaction. If the hook successfully
returns a commit instruction as a response to the invocation, then the transaction is
guaranteed to be committed. The same hook may be re-invoked though to reconfirm the
commit instruction if any intermittent failure occurs in the database, and as long as the
subsequent invocation also returns a commit instruction, the commit will stand
guaranteed.