org.apache.camel.component.reactive.streams.ReactiveStreamsComponent Java Examples

The following examples show how to use org.apache.camel.component.reactive.streams.ReactiveStreamsComponent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactiveStreamsResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Path("/inspect")
@GET
@Produces(MediaType.APPLICATION_JSON)
public JsonObject get() {
    ReactiveStreamsComponent component = camelContext.getComponent("reactive-streams", ReactiveStreamsComponent.class);
    ReactiveStreamsEndpoint endpoint = camelContext.getEndpointRegistry().values().stream()
            .filter(ReactiveStreamsEndpoint.class::isInstance)
            .map(ReactiveStreamsEndpoint.class::cast)
            .findFirst()
            .orElseThrow(() -> new IllegalArgumentException("Unable to find and endpoint of type ReactiveStreamsEndpoint"));

    return Json.createObjectBuilder()
            .add("reactive-streams-component-type", component.getClass().getName())
            .add("reactive-streams-component-backpressure-strategy", component.getBackpressureStrategy().toString())
            .add("reactive-streams-endpoint-backpressure-strategy", endpoint.getBackpressureStrategy().toString())
            .add("reactive-streams-service-type", reactiveStreamsService.getClass().getName())
            .add("reactive-streams-service-factory-type", reactiveStreamsServiceFactory.getClass().getName())
            .build();
}
 
Example #2
Source File: ReactiveStreamsComponentAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Lazy
@Bean(name = "reactive-streams-component")
@ConditionalOnMissingBean(ReactiveStreamsComponent.class)
public ReactiveStreamsComponent configureReactiveStreamsComponent()
        throws Exception {
    ReactiveStreamsComponent component = new ReactiveStreamsComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<ReactiveStreamsComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.reactive-streams.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.reactive-streams.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
Example #3
Source File: ReactiveStreamsAutoConfigurationTest.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Test
public void testConfiguration() throws Exception {
    CamelReactiveStreamsService service = CamelReactiveStreams.get(context);
    assertTrue(service instanceof DefaultCamelReactiveStreamsService);
    assertEquals(service, reactiveStreamsService);

    ReactiveStreamsComponent component = context.getComponent(ReactiveStreamsConstants.SCHEME, ReactiveStreamsComponent.class);
    assertEquals("rs-test", component.getThreadPoolName());
}
 
Example #4
Source File: RxJava2IntegrationTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
private CamelContext createCamelContext() throws Exception {
    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addComponent(
        ReactiveStreamsConstants.SCHEME,
        ReactiveStreamsComponent.withServiceType(RxJavaStreamsConstants.SERVICE_NAME)
    );
    return camelctx;
}
 
Example #5
Source File: ReactiveStreamsRecorder.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
public RuntimeValue<ReactiveStreamsComponent> createReactiveStreamsComponent(
        RuntimeValue<CamelReactiveStreamsServiceFactory> serviceFactory) {
    return new RuntimeValue<>(new QuarkusReactiveStreamsComponent(serviceFactory.getValue()));
}