Functional approach

Refer to the com.example.service.functional.CustomService class to understand the functional service implementation.

This class is an implementation of FunctionalService interface. Unlike REST based service, there are no HTTP specific callback methods in this type of service implementation. In fact, functional service may not necessarily be related to any HTTP invocation. This type of service can include any operation which has no out of the box support from Asset Picker. It can talk to the database, invoke third party web service, do the file system operation etc.

Implement the following method for a functional service. This method also accepts an argument of type ExecutionContext, containing the contextual information required for completing the desired task. The generic type parameter to the ExecutionContext class represents the type of the input given to the service being implemented.

  • RS execute(ExecutionContext<RQ> executionContext)

    This method performs its designated task using the contextual information passed to it. In return, it gives the desired value after finishing its operation. The return value shown in this signature is a generic type and is based on the type used while implementing FunctionalService interface.

Error Handling

Above method must not throw any checked exception. Unchecked exceptions can be thrown if required.