use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.
the class UntilSuccessful method initialise.
@Override
public void initialise() throws InitialisationException {
if (processors == null) {
throw new InitialisationException(createStaticMessage("One message processor must be configured within 'until-successful'."), this);
}
this.nestedChain = newChain(getProcessingStrategy(locator, getRootContainerLocation()), processors);
super.initialise();
timer = muleContext.getSchedulerService().cpuLightScheduler();
policyTemplate = new SimpleRetryPolicyTemplate(millisBetweenRetries, maxRetries);
shouldRetry = event -> event.getError().isPresent();
Object rootContainer = getFromAnnotatedObject(componentLocator, this).orElse(null);
if (rootContainer instanceof FlowConstruct) {
processingStrategy = ((FlowConstruct) rootContainer).getProcessingStrategy();
} else {
processingStrategy = DIRECT_PROCESSING_STRATEGY_INSTANCE;
}
}
use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.
the class AbstractRegistry method initialise.
@Override
public final void initialise() throws InitialisationException {
if (id == null) {
logger.warn("No unique id has been set on this registry");
id = UUID.getUUID();
}
try {
doInitialise();
} catch (InitialisationException e) {
throw e;
} catch (Exception e) {
throw new InitialisationException(e, this);
}
try {
fireLifecycle(Initialisable.PHASE_NAME);
} catch (InitialisationException e) {
throw e;
} catch (LifecycleException e) {
if (e.getComponent() instanceof Initialisable) {
throw new InitialisationException(e, (Initialisable) e.getComponent());
}
throw new InitialisationException(e, this);
}
}
use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.
the class AbstractAsyncRequestReplyRequester method initialise.
@Override
public void initialise() throws InitialisationException {
name = format(NAME_TEMPLATE, storePrefix, muleContext.getConfiguration().getId(), getLocation().getRootContainerName());
MuleRegistry registry = ((MuleContextWithRegistries) muleContext).getRegistry();
store = ((ObjectStoreManager) registry.get(OBJECT_STORE_MANAGER)).createObjectStore(name, ObjectStoreSettings.builder().persistent(false).maxEntries(MAX_PROCESSED_GROUPS).entryTtl(UNCLAIMED_TIME_TO_LIVE).expirationInterval(UNCLAIMED_INTERVAL).build());
try {
notificationFirer = registry.lookupObject(NotificationDispatcher.class);
} catch (RegistrationException e) {
throw new InitialisationException(e, this);
}
}
use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.
the class AbstractJCEEncryptionStrategy method initialise.
@Override
public void initialise() throws InitialisationException {
if (algorithm == null) {
throw new InitialisationException(objectIsNull("Algorithm"), this);
} else {
logger.debug("Using encryption algorithm: " + algorithm);
}
keySpec = createKeySpec();
try {
secretKey = getSecretKey();
createAndInitCiphers();
} catch (Exception e) {
throw new InitialisationException(failedToCreate("encryption ciphers"), e, this);
}
}
use of org.mule.runtime.api.lifecycle.InitialisationException in project mule by mulesoft.
the class AbstractExpressionTransformer method initialise.
/**
* Template method were deriving classes can do any initialisation after the properties have been set on this transformer
*
* @throws InitialisationException
*/
@Override
public void initialise() throws InitialisationException {
if (arguments == null || arguments.size() == 0) {
throw new InitialisationException(objectIsNull("arguments[]"), this);
}
for (ExpressionArgument argument : arguments) {
argument.setMuleContext(muleContext);
argument.setExpressionEvaluationClassLoader(currentThread().getContextClassLoader());
try {
argument.validate();
} catch (Exception e) {
throw new InitialisationException(e, this);
}
}
}
Aggregations