@NoImplement @MinMuleVersion(value="4.5.0") public interface ExtensionsClient
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:
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);
}
});
}
| Modifier and Type | Method and Description |
|---|---|
<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. |
<T,A> CompletableFuture<Result<T,A>> execute(String extension, String operation, Consumer<OperationParameterizer> parameters)
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.
T - The generic type of the result's payloadA - The generic type of the result's attributeextension - the name of the extension that contains the operation to be executed.operation - the name of the operation to be executed.parameters - CompletableFuture instance that completes into a Result with the payload content and the
corresponding attributes.Copyright © 2023. All rights reserved.