Search in sources :

Example 1 with CompletionCallback

use of org.mule.runtime.extension.api.runtime.process.CompletionCallback in project mule by mulesoft.

the class VoidCallbackArgumentResolver method resolve.

@Override
public LazyValue<VoidCompletionCallback> resolve(ExecutionContext executionContext) {
    return new LazyValue<>(() -> {
        ExecutionContextAdapter adapter = (ExecutionContextAdapter) executionContext;
        CompletionCallback completionCallback = (CompletionCallback) adapter.getVariable(COMPLETION_CALLBACK_CONTEXT_PARAM);
        final CoreEvent event = adapter.getEvent();
        return new VoidCompletionCallback() {

            @Override
            public void success() {
                completionCallback.success(EventedResult.from(event));
            }

            @Override
            public void error(Throwable e) {
                completionCallback.error(e);
            }
        };
    });
}
Also used : LazyValue(org.mule.runtime.api.util.LazyValue) CompletionCallback(org.mule.runtime.extension.api.runtime.process.CompletionCallback) VoidCompletionCallback(org.mule.runtime.extension.api.runtime.process.VoidCompletionCallback) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) VoidCompletionCallback(org.mule.runtime.extension.api.runtime.process.VoidCompletionCallback) ExecutionContextAdapter(org.mule.runtime.module.extension.api.runtime.privileged.ExecutionContextAdapter)

Aggregations

LazyValue (org.mule.runtime.api.util.LazyValue)1 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)1 CompletionCallback (org.mule.runtime.extension.api.runtime.process.CompletionCallback)1 VoidCompletionCallback (org.mule.runtime.extension.api.runtime.process.VoidCompletionCallback)1 ExecutionContextAdapter (org.mule.runtime.module.extension.api.runtime.privileged.ExecutionContextAdapter)1