Search in sources :

Example 21 with RuntimeValue

use of io.quarkus.runtime.RuntimeValue in project quarkus-logging-cloudwatch by quarkiverse.

the class LoggingCloudWatchHandlerValueFactory method create.

public RuntimeValue<Optional<Handler>> create(final LoggingCloudWatchConfig config) {
    if (!config.enabled) {
        LOGGER.fine("Quarkus Logging Cloudwatch Extension is not enabled");
        return new RuntimeValue<>(Optional.empty());
    }
    config.validate();
    LOGGER.info("Initializing Quarkus Logging Cloudwatch Extension");
    LOGGER.info("Logging to log-group: " + config.logGroup.get() + " and log-stream: " + config.logStreamName.get());
    AWSLogsClientBuilder clientBuilder = AWSLogsClientBuilder.standard();
    clientBuilder.setCredentials(new CloudWatchCredentialsProvider(config));
    clientBuilder.setRegion(config.region.get());
    AWSLogs awsLogs = clientBuilder.build();
    String token = createLogStreamIfNeeded(awsLogs, config);
    LoggingCloudWatchHandler handler = new LoggingCloudWatchHandler(awsLogs, config.logGroup.get(), config.logStreamName.get(), token);
    handler.setLevel(config.level);
    return new RuntimeValue<>(Optional.of(handler));
}
Also used : CloudWatchCredentialsProvider(io.quarkiverse.logging.cloudwatch.auth.CloudWatchCredentialsProvider) AWSLogsClientBuilder(com.amazonaws.services.logs.AWSLogsClientBuilder) RuntimeValue(io.quarkus.runtime.RuntimeValue) AWSLogs(com.amazonaws.services.logs.AWSLogs)

Example 22 with RuntimeValue

use of io.quarkus.runtime.RuntimeValue in project camunda-bpm-platform by camunda.

the class CamundaEngineRecorder method createProcessEngine.

public RuntimeValue<ProcessEngine> createProcessEngine(RuntimeValue<ProcessEngineConfigurationImpl> configurationRuntimeValue) {
    // build process engine
    ProcessEngineConfigurationImpl configuration = configurationRuntimeValue.getValue();
    ProcessEngine processEngine = configuration.buildProcessEngine();
    // register process engine with the runtime container delegate
    RuntimeContainerDelegate runtimeContainerDelegate = RuntimeContainerDelegate.INSTANCE.get();
    runtimeContainerDelegate.registerProcessEngine(processEngine);
    return new RuntimeValue<>(processEngine);
}
Also used : RuntimeValue(io.quarkus.runtime.RuntimeValue) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) RuntimeContainerDelegate(org.camunda.bpm.container.RuntimeContainerDelegate) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 23 with RuntimeValue

use of io.quarkus.runtime.RuntimeValue in project camel-quarkus by apache.

the class ConsumeProcessor method generateConsumeRoutes.

@Record(value = ExecutionTime.RUNTIME_INIT)
@BuildStep
void generateConsumeRoutes(ConsumeRecorder recorder, CombinedIndexBuildItem index, List<CapabilityBuildItem> capabilities, CamelContextBuildItem camelContext) {
    final Collection<AnnotationInstance> consumeAnnotations = index.getIndex().getAnnotations(CONSUME_ANNOTATION);
    if (!consumeAnnotations.isEmpty()) {
        final RuntimeValue<RoutesDefinition> routesDefinition = recorder.createRoutesDefinition();
        final boolean beanCapabilityAvailable = capabilities.stream().map(CapabilityBuildItem::getName).anyMatch(feature -> CamelCapabilities.BEAN.equals(feature));
        for (AnnotationInstance annot : consumeAnnotations) {
            final AnnotationTarget target = annot.target();
            switch(target.kind()) {
                case METHOD:
                    {
                        final MethodInfo methodInfo = target.asMethod();
                        String uri = null;
                        RuntimeValue<Object> runtimeUriOrEndpoint = null;
                        final ClassInfo declaringClass = methodInfo.declaringClass();
                        String beanName = namedValue(declaringClass);
                        if (beanName == null) {
                            beanName = ConsumeProcessor.uniqueBeanName(declaringClass);
                        }
                        if (annot.value() != null) {
                            uri = annot.value().asString();
                        } else if (annot.value("uri") != null) {
                            uri = annot.value("uri").asString();
                        } else if (annot.value("property") != null) {
                            runtimeUriOrEndpoint = recorder.getEndpointUri(camelContext.getCamelContext(), beanName, findEndpointMethodName(annot.value("property").asString(), declaringClass, new ArrayList<>()));
                        } else {
                            runtimeUriOrEndpoint = recorder.getEndpointUri(camelContext.getCamelContext(), beanName, findEndpointMethodName(methodInfo.name(), declaringClass, new ArrayList<>()));
                        }
                        if (uri == null && runtimeUriOrEndpoint == null) {
                            throw new IllegalStateException("@" + Consume.class.getName() + " on " + methodInfo + " in " + declaringClass.name() + " requires to specify a Camel Endpoint or endpoint URI through one of the following options:\n" + " * via @Consume value, e.g. @Consume(\"direct:myDirect\")\n" + " * via explicit @Consume property parameter, e.g. @Consume(property = \"myUriProperty\") and getMyUriProperty() or getMyUriPropertyEndpoint() in the same class must exist and return a String or org.apache.camel.Endpoint\n" + " * via naming convention: if your @Consume method is called myEvent or onMyEvent then getMyEvent() or getMyEventEndpoint() must exist in the same class and return a String or org.apache.camel.Endpoint\n" + "See https://camel.apache.org/manual/latest/pojo-consuming.html for more details");
                        }
                        if (!beanCapabilityAvailable) {
                            throw new IllegalStateException("Add camel-quarkus-bean dependency to be able to use @" + Consume.class.getName() + " on method:" + methodInfo + " in " + declaringClass.name());
                        }
                        recorder.addConsumeRoute(camelContext.getCamelContext(), routesDefinition, uri, runtimeUriOrEndpoint, beanName, methodInfo.name());
                        break;
                    }
                default:
                    throw new IllegalStateException("Expected method, got " + target.kind() + ": " + target);
            }
        }
        recorder.addConsumeRoutesToContext(camelContext.getCamelContext(), routesDefinition);
    }
}
Also used : AnnotationTarget(org.jboss.jandex.AnnotationTarget) ArrayList(java.util.ArrayList) Consume(org.apache.camel.Consume) RoutesDefinition(org.apache.camel.model.RoutesDefinition) MethodInfo(org.jboss.jandex.MethodInfo) RuntimeValue(io.quarkus.runtime.RuntimeValue) AnnotationInstance(org.jboss.jandex.AnnotationInstance) ClassInfo(org.jboss.jandex.ClassInfo) Record(io.quarkus.deployment.annotations.Record) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 24 with RuntimeValue

use of io.quarkus.runtime.RuntimeValue in project camel-quarkus by apache.

the class CamelXsltRecorder method createXsltComponent.

public RuntimeValue<XsltComponent> createXsltComponent(CamelXsltConfig config, RuntimeValue<RuntimeUriResolver.Builder> uriResolverBuilder) {
    final RuntimeUriResolver uriResolver = uriResolverBuilder.getValue().build();
    final QuarkusTransformerFactoryConfigurationStrategy strategy = new QuarkusTransformerFactoryConfigurationStrategy(config.packageName, config.features, uriResolver);
    final XsltComponent component = new XsltComponent();
    component.setUriResolver(uriResolver);
    component.setTransformerFactoryConfigurationStrategy(strategy);
    component.setTransformerFactoryClass(XalanTransformerFactory.class.getName());
    return new RuntimeValue<>(component);
}
Also used : XsltComponent(org.apache.camel.component.xslt.XsltComponent) XalanTransformerFactory(org.apache.camel.quarkus.support.xalan.XalanTransformerFactory) RuntimeValue(io.quarkus.runtime.RuntimeValue)

Example 25 with RuntimeValue

use of io.quarkus.runtime.RuntimeValue in project camel-quarkus by apache.

the class CamelVertxRecorder method createVertxComponent.

public RuntimeValue<VertxComponent> createVertxComponent(RuntimeValue<Vertx> vertx) {
    VertxComponent component = new VertxComponent();
    component.setVertx(vertx.getValue());
    return new RuntimeValue<>(component);
}
Also used : VertxComponent(org.apache.camel.component.vertx.VertxComponent) RuntimeValue(io.quarkus.runtime.RuntimeValue)

Aggregations

RuntimeValue (io.quarkus.runtime.RuntimeValue)31 FhirContext (ca.uhn.fhir.context.FhirContext)4 BuildStep (io.quarkus.deployment.annotations.BuildStep)2 Record (io.quarkus.deployment.annotations.Record)2 CamelContext (org.apache.camel.CamelContext)2 Component (org.apache.camel.Component)2 KnativeComponent (org.apache.camel.component.knative.KnativeComponent)2 CamelProducers (org.apache.camel.quarkus.core.CamelProducers)2 ComponentCustomizer (org.apache.camel.spi.ComponentCustomizer)2 Logger (ch.qos.logback.classic.Logger)1 AWSLogs (com.amazonaws.services.logs.AWSLogs)1 AWSLogsClientBuilder (com.amazonaws.services.logs.AWSLogsClientBuilder)1 Configuration (freemarker.template.Configuration)1 Tracer (io.opentracing.Tracer)1 CloudWatchCredentialsProvider (io.quarkiverse.logging.cloudwatch.auth.CloudWatchCredentialsProvider)1 AdditionalBeanBuildItem (io.quarkus.arc.deployment.AdditionalBeanBuildItem)1 BeanRegistrationPhaseBuildItem (io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem)1 UnremovableBeanBuildItem (io.quarkus.arc.deployment.UnremovableBeanBuildItem)1 BuildExtension (io.quarkus.arc.processor.BuildExtension)1 ApplicationArchive (io.quarkus.deployment.ApplicationArchive)1