use of org.mule.runtime.api.exception.MuleException in project mule by mulesoft.
the class ConfigOverrideValueResolverWrapper method initialise.
@Override
public void initialise() throws InitialisationException {
try {
muleContext.getInjector().inject(delegate);
initialiseIfNeeded(delegate, muleContext);
} catch (MuleException e) {
throw new InitialisationException(createStaticMessage("Failed to initialise the delegate ValueResolver for ConfigOverride wrapper"), e, this);
}
}
use of org.mule.runtime.api.exception.MuleException in project mule by mulesoft.
the class OAuthConnectionProviderObjectBuilder method getCustomParameters.
private Map<String, String> getCustomParameters(CoreEvent event) {
Map<String, String> oauthParams = new HashMap<>();
withCustomParameters((parameter, property) -> {
String alias = property.getRequestAlias();
if (StringUtils.isBlank(alias)) {
alias = parameter.getName();
}
ValueResolver resolver = resolverSet.getResolvers().get(alias);
if (resolver != null) {
try {
oauthParams.put(alias, resolveString(event, resolver));
} catch (MuleException e) {
throw new MuleRuntimeException(e);
}
}
});
return oauthParams;
}
use of org.mule.runtime.api.exception.MuleException in project mule by mulesoft.
the class MuleServiceManager method start.
@Override
public void start() throws MuleException {
File servicesFolder = getServicesFolder();
if (!servicesFolder.exists()) {
servicesFolder.mkdir();
}
try {
registeredServices = serviceDiscoverer.discoverServices();
wrappedServices = wrapServices(registeredServices);
startServices();
} catch (Exception e) {
throw new StartException(e, this);
}
}
use of org.mule.runtime.api.exception.MuleException in project mule by mulesoft.
the class ProcessorChainBenchmark method stream.
@Benchmark
public CountDownLatch stream() throws MuleException, InterruptedException {
CountDownLatch latch = new CountDownLatch(STREAM_SIZE);
Reference<FluxSink<CoreEvent>> sinkReference = new Reference<>();
FluxProcessor.create(sinkReference::set).transform(chain).doOnNext(event -> latch.countDown()).subscribe();
for (int i = 0; i < STREAM_SIZE; i++) {
sinkReference.get().next(event);
}
sinkReference.get().complete();
latch.await();
return latch;
}
use of org.mule.runtime.api.exception.MuleException in project mule by mulesoft.
the class SourceAdapter method getNonCallbackParameterValue.
private <T> Optional<T> getNonCallbackParameterValue(String fieldName, Class<T> type) {
ValueResolver<T> valueResolver = (ValueResolver<T>) nonCallbackParameters.getResolvers().get(fieldName);
if (valueResolver == null) {
return empty();
}
T object;
CoreEvent initialiserEvent = null;
try {
initialiserEvent = getInitialiserEvent(muleContext);
object = valueResolver.resolve(from(initialiserEvent));
} catch (MuleException e) {
throw new MuleRuntimeException(createStaticMessage("Unable to get the " + type.getSimpleName() + " value for Message Source"), e);
} finally {
if (initialiserEvent != null) {
((BaseEventContext) initialiserEvent.getContext()).success();
}
}
if (!(type.isInstance(object))) {
throw new IllegalStateException("The resolved value is not a " + type.getSimpleName());
}
return of(object);
}
Aggregations