Search in sources :

Example 1 with ReactiveStreamsEndpoint

use of org.apache.camel.component.reactive.streams.ReactiveStreamsEndpoint in project camel by apache.

the class CamelPublisher method attachProducer.

public void attachProducer(ReactiveStreamsProducer producer) {
    Objects.requireNonNull(producer, "producer cannot be null, use the detach method");
    if (this.producer != null) {
        throw new IllegalStateException("A producer is already attached to the stream '" + name + "'");
    }
    this.producer = producer;
    // Apply endpoint options if available
    ReactiveStreamsEndpoint endpoint = producer.getEndpoint();
    if (endpoint.getBackpressureStrategy() != null) {
        this.backpressureStrategy = endpoint.getBackpressureStrategy();
        for (CamelSubscription sub : this.subscriptions) {
            sub.setBackpressureStrategy(endpoint.getBackpressureStrategy());
        }
    }
}
Also used : ReactiveStreamsEndpoint(org.apache.camel.component.reactive.streams.ReactiveStreamsEndpoint)

Aggregations

ReactiveStreamsEndpoint (org.apache.camel.component.reactive.streams.ReactiveStreamsEndpoint)1