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));
}
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);
}
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);
}
}
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);
}
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);
}
Aggregations