Class Messaging.Builder

java.lang.Object
io.helidon.messaging.Messaging.Builder
All Implemented Interfaces:
Builder<Messaging.Builder,Messaging>, Supplier<Messaging>
Enclosing interface:
Messaging

public static final class Messaging.Builder extends Object implements Builder<Messaging.Builder,Messaging>
Fluent API builder for Messaging.
  • Method Details

    • config

      public Messaging.Builder config(Config config)
      Configuration needed for configuring connector and their routing.
      Parameters:
      config - config for connectors and their routes.
      Returns:
      this builder
    • connector

      public Messaging.Builder connector(ConnectorFactory connector)
      Add connector implementing IncomingConnectorFactory, OutgoingConnectorFactory or both.
      Parameters:
      connector - connector to add.
      Returns:
      this builder
    • emitter

      public <PAYLOAD> Messaging.Builder emitter(Emitter<PAYLOAD> emitter)
      Register new emitter and all its channels.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      emitter - to be registered
      Returns:
      this builder
    • publisher

      public <PAYLOAD> Messaging.Builder publisher(Channel<PAYLOAD> channel, PublisherBuilder<? extends Message<? extends PAYLOAD>> publisherBuilder)
      Register PublisherBuilder to be used for construction of the publisher for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to be publisher constructed for
      publisherBuilder - to be used for construction of the publisher
      Returns:
      this builder
    • publisher

      public <PAYLOAD> Messaging.Builder publisher(Channel<PAYLOAD> channel, Publisher<? extends PAYLOAD> publisher, Function<? super PAYLOAD,? extends Message<? extends PAYLOAD>> wrapper)
      Register Publisher to be used for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use publisher in
      publisher - to publish in supplied channel
      wrapper - function to be used for raw payload wrapping, if null simple Message.of(Object) is used.
      Returns:
      this builder
    • publisher

      public <PAYLOAD> Messaging.Builder publisher(Channel<PAYLOAD> channel, Flow.Publisher<? extends PAYLOAD> publisher, Function<? super PAYLOAD,? extends Message<? extends PAYLOAD>> wrapper)
      Register Flow.Publisher to be used for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use publisher in
      publisher - to publish in supplied channel
      wrapper - function to be used for raw payload wrapping, if null simple Message.of(Object) is used.
      Returns:
      this builder
    • publisher

      public <PAYLOAD> Messaging.Builder publisher(Channel<PAYLOAD> channel, Flow.Publisher<? extends Message<? extends PAYLOAD>> publisher)
      Register Flow.Publisher to be used for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use publisher in
      publisher - to publish in supplied channel
      Returns:
      this builder
    • publisher

      public <PAYLOAD> Messaging.Builder publisher(Channel<PAYLOAD> channel, Publisher<? extends Message<? extends PAYLOAD>> publisher)
      Register Publisher to be used for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use publisher in
      publisher - to publish in supplied channel
      Returns:
      this builder
    • listener

      public <PAYLOAD> Messaging.Builder listener(Channel<PAYLOAD> channel, Consumer<? super PAYLOAD> consumer)
      Register Consumer for listening every payload coming from upstream. This listener creates unbounded(Long.MAX_VALUE) demand. Messages are automatically acked and unwrapped. Equivalent of ProcessorBuilder.forEach(java.util.function.Consumer).
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use subscriber in
      consumer - to consume payloads
      Returns:
      this builder
    • subscriber

      public <PAYLOAD> Messaging.Builder subscriber(Channel<PAYLOAD> channel, Flow.Subscriber<? extends Message<? extends PAYLOAD>> subscriber)
      Register Flow.Subscriber to be used for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use subscriber in
      subscriber - to subscribe to supplied channel
      Returns:
      this builder
    • subscriber

      public <PAYLOAD> Messaging.Builder subscriber(Channel<PAYLOAD> channel, Consumer<Multi<? extends Message<? extends PAYLOAD>>> consumer)
      Use provided Multi to subscribe to supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use subscriber in
      consumer - to subscribe to supplied channel
      Returns:
      this builder
    • subscriber

      public <PAYLOAD, RESULT> Messaging.Builder subscriber(Channel<PAYLOAD> channel, SubscriberBuilder<? extends Message<? extends PAYLOAD>,RESULT> subscriberBuilder)
      Register SubscriberBuilder to be used for creating Subscriber for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      RESULT - result type
      Parameters:
      channel - to use subscriber in
      subscriberBuilder - to subscribe to supplied channel
      Returns:
      this builder
    • subscriber

      public <PAYLOAD> Messaging.Builder subscriber(Channel<PAYLOAD> channel, Subscriber<? extends Message<? extends PAYLOAD>> subscriber)
      Register Subscriber to be used for supplied Channel.
      Type Parameters:
      PAYLOAD - message payload type
      Parameters:
      channel - to use subscriber in
      subscriber - to subscribe to supplied channel
      Returns:
      this builder
    • processor

      public <PAYLOAD, RESULT> Messaging.Builder processor(Channel<PAYLOAD> in, Channel<RESULT> out, Processor<? extends Message<? extends PAYLOAD>,? extends Message<? extends RESULT>> processor)
      Register Processor to be used is in Channel's subscriber and out Channel's publisher.
      Type Parameters:
      PAYLOAD - message payload type of in channel
      RESULT - message payload type of out channel
      Parameters:
      in - Channel to use supplied Processor as subscriber in
      out - Channel to use supplied Processor as publisher in
      processor - to be used between supplied channels
      Returns:
      this builder
    • processor

      public <PAYLOAD, RESULT> Messaging.Builder processor(Channel<PAYLOAD> in, Channel<RESULT> out, ProcessorBuilder<? extends Message<? extends PAYLOAD>,? extends Message<? extends RESULT>> processorBuilder)
      Register ProcessorBuilder for building Processor to be used is in Channel's subscriber and out Channel's publisher.
      Type Parameters:
      PAYLOAD - message payload type of in channel
      RESULT - message payload type of out channel
      Parameters:
      in - Channel to use supplied Processor as subscriber in
      out - Channel to use supplied Processor as publisher in
      processorBuilder - to be used between supplied channels
      Returns:
      this builder
    • processor

      public <PAYLOAD, RESULT> Messaging.Builder processor(Channel<PAYLOAD> in, Channel<RESULT> out, Function<? super PAYLOAD,? extends RESULT> messageFunction)
      Register a mapping function between two channels.
      Type Parameters:
      PAYLOAD - message payload type of in channel
      RESULT - message payload type of out channel
      Parameters:
      in - Channel to map from
      out - Channel to map to
      messageFunction - mapping function
      Returns:
      this builder
    • build

      public Messaging build()
      Build new Messaging instance.
      Specified by:
      build in interface Builder<Messaging.Builder,Messaging>
      Returns:
      new instance of Messaging