Interface ExtensionsClient


@NoImplement @MinMuleVersion("4.5.0") public interface ExtensionsClient
The ExtensionsClient is a simple interface for executing extension operations programmatically.

The operation to execute is referenced through its name and the name of the extension in which it's defined. Notice that the extension is referenced by name and not GAV, which means that the extension is assumed to be present and activated on the current execution context.

Once the operation is located, the operation execution is parameterized by not only providing parameter values, but also config reference, reconnection and streaming strategies, etc.

Note that this client will be reachable through the mule registry, and you will be able to inject it in any class with lifecycle.

A usage example for an operation with this signature public String getName(@UseConfig config, int account) could be:

 {@code
 public class UsingExtensionsClient {
  @Inject ExtensionsClient client;
  ...
  public void executeWithClient() {
    client.<String, Object>executeAsync("myExtensionName", "getName", params ->
  		params.withConfigRef("conf").withParameter("account", 12)
  	).whenComplete((result, e) -> {
  		if (e != null) {
  			logError(e);
            } else {
  			processResult(result);
      }
   });
 }
 </pre>

 @since 1.0
  • Method Details

    • execute

      <T, A> CompletableFuture<Result<T,A>> execute(String extension, String operation, Consumer<OperationParameterizer> parameters)
      Executes an operation asynchronously by returning a CompletableFuture instance that will complete into a Result with the corresponding payload and attributes after the operation execution finished.

      If the executed operation is not asynchronous in nature, the client might choose to actually execute in a synchronous manner.

      Type Parameters:
      T - The generic type of the result's payload
      A - The generic type of the result's attribute
      Parameters:
      extension - the name of the extension that contains the operation to be executed.
      operation - the name of the operation to be executed.
      parameters -
      Returns:
      a CompletableFuture instance that completes into a Result with the payload content and the corresponding attributes.