Interface CamelReactiveStreamsService

  • All Superinterfaces:
    AutoCloseable, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.HasId, org.apache.camel.Service
    All Known Implementing Classes:
    DefaultCamelReactiveStreamsService

    public interface CamelReactiveStreamsService
    extends org.apache.camel.Service, org.apache.camel.spi.HasId, org.apache.camel.spi.HasCamelContext
    The interface to which any implementation of the reactive-streams engine should comply.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ReactiveStreamsCamelSubscriber attachCamelConsumer​(String name, ReactiveStreamsConsumer consumer)
      Used by Camel to associate the subscriber of the stream with the given name to a specific Camel consumer.
      void attachCamelProducer​(String name, ReactiveStreamsProducer producer)
      Used by Camel to associate the publisher of the stream with the given name to a specific Camel producer.
      void detachCamelConsumer​(String name)
      Used by Camel to detach the existing consumer from the given stream.
      void detachCamelProducer​(String name)
      Used by Camel to detach the existing producer from the given stream.
      org.reactivestreams.Publisher<org.apache.camel.Exchange> from​(String uri)
      Creates a new stream from the endpoint URI (used as Camel Consumer) and returns the associated Publisher.
      <T> org.reactivestreams.Publisher<T> from​(String uri, Class<T> type)
      Creates a new stream of the given type from the endpoint URI (used as Camel Consumer) and returns the associated Publisher.
      org.reactivestreams.Publisher<org.apache.camel.Exchange> fromStream​(String name)
      Returns the publisher associated to the given stream name.
      <T> org.reactivestreams.Publisher<T> fromStream​(String name, Class<T> type)
      Returns the publisher associated to the given stream name.
      <T> void process​(String uri, Class<T> type, Function<? super org.reactivestreams.Publisher<T>,​?> processor)
      Adds a processing step at the specified endpoint uri (usually a "direct:name") that delegates to the given reactive processor.
      void process​(String uri, Function<? super org.reactivestreams.Publisher<org.apache.camel.Exchange>,​?> processor)
      Adds a processing step at the specified endpoint uri (usually a "direct:name") that delegates to the given reactive processor.
      void sendCamelExchange​(String name, org.apache.camel.Exchange exchange)
      Used by Camel to send the exchange to all active subscriptions on the given stream.
      org.reactivestreams.Subscriber<org.apache.camel.Exchange> streamSubscriber​(String name)
      Returns the subscriber associated to the given stream name.
      <T> org.reactivestreams.Subscriber<T> streamSubscriber​(String name, Class<T> type)
      Returns the subscriber associated to the given stream name.
      org.reactivestreams.Subscriber<org.apache.camel.Exchange> subscriber​(String uri)
      Creates a new route that pushes data to the endpoint URI and returns the associated Subscriber.
      <T> org.reactivestreams.Subscriber<T> subscriber​(String uri, Class<T> type)
      Creates a new route that pushes data to the endpoint URI and returns the associated Subscriber.
      Function<Object,​org.reactivestreams.Publisher<org.apache.camel.Exchange>> to​(String uri)
      Creates a new route that uses the endpoint URI as producer, and returns a function that pushes the data into the route and returns the Publisher that holds the resulting exchange or the error.
      <T> Function<Object,​org.reactivestreams.Publisher<T>> to​(String uri, Class<T> type)
      Creates a new route that uses the endpoint URI as producer, and returns a function that pushes the data into the route and returns the Publisher that holds the exchange output or an error.
      org.reactivestreams.Publisher<org.apache.camel.Exchange> to​(String uri, Object data)
      Creates a new route that uses the endpoint URI as producer, pushes the given data to the route and returns a Publisher that will eventually return the resulting exchange or an error.
      <T> org.reactivestreams.Publisher<T> to​(String uri, Object data, Class<T> type)
      Creates a new route that uses the endpoint URI as producer, pushes the given data to the route and returns a Publisher that will eventually return the exchange output or an error.
      Function<?,​? extends org.reactivestreams.Publisher<org.apache.camel.Exchange>> toStream​(String name)
      Returns a function that pushes data into the specified Camel stream and returns a Publisher (mono) holding the resulting exchange or an error.
      <T> Function<Object,​org.reactivestreams.Publisher<T>> toStream​(String name, Class<T> type)
      Returns a function that pushes data into the specified Camel stream and returns a Publisher (mono) holding the exchange output or an error.
      org.reactivestreams.Publisher<org.apache.camel.Exchange> toStream​(String name, Object data)
      Pushes the given data into the specified Camel stream and returns a Publisher (mono) holding the resulting exchange or an error.
      <T> org.reactivestreams.Publisher<T> toStream​(String name, Object data, Class<T> type)
      Pushes the given data into the specified Camel stream and returns a Publisher (mono) holding the exchange output or an error.
      • Methods inherited from interface org.apache.camel.spi.HasCamelContext

        getCamelContext
      • Methods inherited from interface org.apache.camel.spi.HasId

        getId
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
    • Method Detail

      • fromStream

        org.reactivestreams.Publisher<org.apache.camel.Exchange> fromStream​(String name)
        Returns the publisher associated to the given stream name. A publisher can be used to push Camel exchanges to reactive-streams subscribers.
        Parameters:
        name - the stream name
        Returns:
        the stream publisher
      • fromStream

        <T> org.reactivestreams.Publisher<T> fromStream​(String name,
                                                        Class<T> type)
        Returns the publisher associated to the given stream name. A publisher can be used to push Camel exchange to external reactive-streams subscribers. The publisher converts automatically exchanges to the given type.
        Type Parameters:
        T - the type of items emitted by the publisher
        Parameters:
        name - the stream name
        type - the type of the emitted items
        Returns:
        the publisher associated to the stream
      • streamSubscriber

        org.reactivestreams.Subscriber<org.apache.camel.Exchange> streamSubscriber​(String name)
        Returns the subscriber associated to the given stream name. A subscriber can be used to push items coming from external reactive-streams publishers to Camel routes.
        Parameters:
        name - the stream name
        Returns:
        the subscriber associated with the stream
      • streamSubscriber

        <T> org.reactivestreams.Subscriber<T> streamSubscriber​(String name,
                                                               Class<T> type)
        Returns the subscriber associated to the given stream name. A subscriber can be used to push items coming from external reactive-streams publishers to Camel routes. The subscriber converts automatically items of the given type to exchanges before pushing them.
        Type Parameters:
        T - the type of items accepted by the subscriber
        Parameters:
        name - the stream name
        type - the publisher converts automatically exchanges to the given type.
        Returns:
        the subscriber associated with the stream
      • toStream

        org.reactivestreams.Publisher<org.apache.camel.Exchange> toStream​(String name,
                                                                          Object data)
        Pushes the given data into the specified Camel stream and returns a Publisher (mono) holding the resulting exchange or an error.
        Parameters:
        name - the stream name
        data - the data to push
        Returns:
        a publisher with the resulting exchange
      • toStream

        Function<?,​? extends org.reactivestreams.Publisher<org.apache.camel.Exchange>> toStream​(String name)
        Returns a function that pushes data into the specified Camel stream and returns a Publisher (mono) holding the resulting exchange or an error. This is a curryied version of toStream(String, Object).
        Parameters:
        name - the stream name
        Returns:
        a function that returns a publisher with the resulting exchange
      • toStream

        <T> org.reactivestreams.Publisher<T> toStream​(String name,
                                                      Object data,
                                                      Class<T> type)
        Pushes the given data into the specified Camel stream and returns a Publisher (mono) holding the exchange output or an error.
        Type Parameters:
        T - the generic type of the resulting Publisher
        Parameters:
        name - the stream name
        data - the data to push
        type - the type to which the output should be converted
        Returns:
        a publisher with the resulting data
      • toStream

        <T> Function<Object,​org.reactivestreams.Publisher<T>> toStream​(String name,
                                                                             Class<T> type)
        Returns a function that pushes data into the specified Camel stream and returns a Publisher (mono) holding the exchange output or an error. This is a curryied version of toStream(String, Object, Class).
        Type Parameters:
        T - the generic type of the resulting Publisher
        Parameters:
        name - the stream name
        type - the type to which the output should be converted
        Returns:
        a function that returns a publisher with the resulting data
      • from

        org.reactivestreams.Publisher<org.apache.camel.Exchange> from​(String uri)
        Creates a new stream from the endpoint URI (used as Camel Consumer) and returns the associated Publisher. If a stream has already been created, the existing Publisher is returned.
        Parameters:
        uri - the consumer uri
        Returns:
        the publisher associated to the uri
      • from

        <T> org.reactivestreams.Publisher<T> from​(String uri,
                                                  Class<T> type)
        Creates a new stream of the given type from the endpoint URI (used as Camel Consumer) and returns the associated Publisher. If a stream has already been created, the existing Publisher is returned.
        Type Parameters:
        T - the type to which Camel should convert exchanges to
        Parameters:
        uri - the consumer uri
        type - the type of items emitted by the publisher
        Returns:
        the publisher associated to the uri
      • subscriber

        org.reactivestreams.Subscriber<org.apache.camel.Exchange> subscriber​(String uri)
        Creates a new route that pushes data to the endpoint URI and returns the associated Subscriber. This method always create a new stream.
        Parameters:
        uri - the target uri
        Returns:
        the subscriber associated to the uri
      • subscriber

        <T> org.reactivestreams.Subscriber<T> subscriber​(String uri,
                                                         Class<T> type)
        Creates a new route that pushes data to the endpoint URI and returns the associated Subscriber. This method always create a new stream.
        Type Parameters:
        T - the type from which Camel should convert data to exchanges
        Parameters:
        uri - the target uri
        type - the type of items that the subscriber can receive
        Returns:
        the subscriber associated to the uri
      • to

        org.reactivestreams.Publisher<org.apache.camel.Exchange> to​(String uri,
                                                                    Object data)
        Creates a new route that uses the endpoint URI as producer, pushes the given data to the route and returns a Publisher that will eventually return the resulting exchange or an error.
        Parameters:
        uri - the producer uri
        data - the data to push
        Returns:
        a publisher with the resulting exchange
      • to

        Function<Object,​org.reactivestreams.Publisher<org.apache.camel.Exchange>> to​(String uri)
        Creates a new route that uses the endpoint URI as producer, and returns a function that pushes the data into the route and returns the Publisher that holds the resulting exchange or the error. This is a curryied version of to(String, Object).
        Parameters:
        uri - the producer uri
        Returns:
        a function that returns a publisher with the resulting exchange
      • to

        <T> org.reactivestreams.Publisher<T> to​(String uri,
                                                Object data,
                                                Class<T> type)
        Creates a new route that uses the endpoint URI as producer, pushes the given data to the route and returns a Publisher that will eventually return the exchange output or an error.
        Type Parameters:
        T - the generic type of the resulting Publisher
        Parameters:
        uri - the producer uri
        data - the data to push
        type - the type to which the output should be converted
        Returns:
        a publisher with the resulting data
      • to

        <T> Function<Object,​org.reactivestreams.Publisher<T>> to​(String uri,
                                                                       Class<T> type)
        Creates a new route that uses the endpoint URI as producer, and returns a function that pushes the data into the route and returns the Publisher that holds the exchange output or an error. This is a curryied version of to(String, Object, Class).
        Type Parameters:
        T - the generic type of the resulting Publisher
        Parameters:
        uri - the producer uri
        type - the type to which the output should be converted
        Returns:
        a function that returns a publisher with the resulting data
      • process

        void process​(String uri,
                     Function<? super org.reactivestreams.Publisher<org.apache.camel.Exchange>,​?> processor)
        Adds a processing step at the specified endpoint uri (usually a "direct:name") that delegates to the given reactive processor. The processor receives a Publisher of exchanges and returns an object. If the output of the processor is a Publisher, it will be unwrapped before delivering the result to the source route.
        Parameters:
        uri - the uri where the processor should be attached
        processor - the reactive processor
      • process

        <T> void process​(String uri,
                         Class<T> type,
                         Function<? super org.reactivestreams.Publisher<T>,​?> processor)
        Adds a processing step at the specified endpoint uri (usually a "direct:name") that delegates to the given reactive processor. The processor receives a Publisher of items of the given type and returns an object. If the output of the processor is a Publisher, it will be unwrapped before delivering the result to the source route.
        Type Parameters:
        T - the generic type of the Publisher that should be processed
        Parameters:
        uri - the uri where the processor should be attached
        type - the type to which the body of the exchange should be converted
        processor - the reactive processor
      • attachCamelProducer

        void attachCamelProducer​(String name,
                                 ReactiveStreamsProducer producer)
        Used by Camel to associate the publisher of the stream with the given name to a specific Camel producer. This method is used to bind a Camel route to a reactive stream.
        Parameters:
        name - the stream name
        producer - the producer of the route
        Throws:
        IllegalStateException - if another producer is already associated with the given stream name
      • detachCamelProducer

        void detachCamelProducer​(String name)
        Used by Camel to detach the existing producer from the given stream.
        Parameters:
        name - the stream name
      • sendCamelExchange

        void sendCamelExchange​(String name,
                               org.apache.camel.Exchange exchange)
        Used by Camel to send the exchange to all active subscriptions on the given stream. The callback is used to signal that the exchange has been delivered to the subscribers.
        Parameters:
        name - the stream name
        exchange - the exchange to be forwarded to the external subscribers
      • attachCamelConsumer

        ReactiveStreamsCamelSubscriber attachCamelConsumer​(String name,
                                                           ReactiveStreamsConsumer consumer)
        Used by Camel to associate the subscriber of the stream with the given name to a specific Camel consumer. This method is used to bind a Camel route to a reactive stream.
        Parameters:
        name - the stream name
        consumer - the consumer of the route
        Returns:
        the associated subscriber
        Throws:
        IllegalStateException - if another consumer is already associated with the given stream name
      • detachCamelConsumer

        void detachCamelConsumer​(String name)
        Used by Camel to detach the existing consumer from the given stream.
        Parameters:
        name - the stream name