Business processes

Prev Next
Business processes/Business flows

A good practice is to have one or more services representing business processes that listens for business events and acts on them.

Usually there are several steps involved in a process, such as fetching data from one or more services and then creating/updating entities in one or more services, maybe associating entities in Nexus Value Translator and Data Sync Engine; and possibly publishing an event.

Overview

The platform integration test service is used to make sure that entire business processes works:

  • from creating/updating an entity
  • an event is triggered
  • which triggers the process
  • which does it's thing
  • and then checking that the result is what is to be expected
    • (maybe that something has been created/updated in another capability provider)
    • (maybe subscribing to an event that the process publishes)

Method A

In the Platform integration tests service, use http clients to make requests to capability provider endpoints that should trigger business events (or make direct calls to the Business Procesess service). Long poll the outcome of the process and verify that the expected changes have happened throughout the business platform.

Testing business processes

In case a process ends with an event, make the integration tests service subscribe to it and verify that the process is done only when that event arrives.

Method B

In the Platform integration tests service, use http clients to make requests to capability provider endpoints that should trigger business events (or make direct calls to the Business Procesess service). Let the Business Process service be aware that it's in test mode (by propagating the X-nexus-test-context header). As it's final step, have it call the Platform integration testing service or send an event (perhaps TestProcess/Completed).

Testing business processes

Propagating the test header

The Nexus Link libraries has support for propagating the X-nexus-test-context header. Use RestClient (or the PropagateNexusTestHeader deltaging handler) in combination with SaveNexusTestContext.

The Nexus Business Events service has support for propagting the header.

Test header from a system

If a system is not able to propagate the header, e.g. when creating/updating an entity from the Platform integration tests service,, let the adapter cache the entity and the header value, and then when the system calls it for publishing an event, setup the header and publish through the Business API.