Skip to main content

Communication between modules

Modules reach shared services directly and reach each other in two ways: synchronous REST calls and asynchronous messages on the event bus.

Who talks to what​

  • Admin and Directory read and write the directory in Neo4j.
  • Catalog stores its data in PostgreSQL.
  • Portal stores its data in MongoDB.
  • Every module relies on the authentication module, backed by the identity provider, so that sign-in and access control are the same across the platform.

Synchronous: REST with JAX-RS​

A client sends an HTTP request and waits for the response. Resources are exposed at URLs and handled with the standard HTTP methods. The client must know the URL and the shape of the request, which couples it to the service.

Use it for:

  • create, read, update and delete operations, where the outcome of the call matters to the caller;
  • interactions where a member is waiting for an immediate answer, such as submitting a form;
  • any API offered to clients outside the module: user interfaces and third-party services.

Asynchronous: the Vert.x event bus​

A module sends a message to an address and carries on; whichever module listens on that address handles it. The sender does not need to know who the consumers are.

Use it for:

  • work that can run in the background without blocking the request being served;
  • decoupling modules that should not depend on each other directly;
  • high-volume exchanges between modules, where calls must not block.

See Event bus for the messaging patterns and the addresses the platform uses.

Choosing​

QuestionRESTEvent bus
Does the caller need the result to continue?YesNot necessarily
Is the caller outside the platform's server side?YesNo
Should the caller ignore who handles the request?NoYes
Can the work run in the background?NoYes