Search in sources :

Example 1 with FaultToleranceExtension

use of io.smallrye.faulttolerance.FaultToleranceExtension in project wildfly by wildfly.

the class MicroProfileFaultToleranceDeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (!MicroProfileFaultToleranceMarker.isMarked(deploymentUnit)) {
        return;
    }
    // Weld Extension
    CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    WeldCapability weldCapability;
    try {
        weldCapability = support.getCapabilityRuntimeAPI(Capabilities.WELD_CAPABILITY_NAME, WeldCapability.class);
    } catch (CapabilityServiceSupport.NoSuchCapabilityException e) {
        throw new IllegalStateException();
    }
    weldCapability.registerExtensionInstance(new FaultToleranceExtension(), deploymentUnit);
}
Also used : FaultToleranceExtension(io.smallrye.faulttolerance.FaultToleranceExtension) WeldCapability(org.jboss.as.weld.WeldCapability) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Aggregations

FaultToleranceExtension (io.smallrye.faulttolerance.FaultToleranceExtension)1 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 WeldCapability (org.jboss.as.weld.WeldCapability)1