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 Summary
Modifier and TypeMethodDescriptionbuild()
Build newMessaging
instance.Configuration needed for configuring connector and their routing.connector
(ConnectorFactory connector) Add connector implementingIncomingConnectorFactory
,OutgoingConnectorFactory
or both.<PAYLOAD> Messaging.Builder
Register new emitter and all its channels.<PAYLOAD> Messaging.Builder
RegisterConsumer
for listening every payload coming from upstream.<PAYLOAD,
RESULT>
Messaging.Builderprocessor
(Channel<PAYLOAD> in, Channel<RESULT> out, Function<? super PAYLOAD, ? extends RESULT> messageFunction) Register a mapping function between two channels.<PAYLOAD,
RESULT>
Messaging.Builderprocessor
(Channel<PAYLOAD> in, Channel<RESULT> out, ProcessorBuilder<? extends Message<? extends PAYLOAD>, ? extends Message<? extends RESULT>> processorBuilder) RegisterProcessorBuilder
for buildingProcessor
to be used isin
Channel
's subscriber andout
Channel
's publisher.<PAYLOAD,
RESULT>
Messaging.Builderprocessor
(Channel<PAYLOAD> in, Channel<RESULT> out, Processor<? extends Message<? extends PAYLOAD>, ? extends Message<? extends RESULT>> processor) <PAYLOAD> Messaging.Builder
publisher
(Channel<PAYLOAD> channel, Flow.Publisher<? extends Message<? extends PAYLOAD>> publisher) RegisterFlow.Publisher
to be used for suppliedChannel
.<PAYLOAD> Messaging.Builder
publisher
(Channel<PAYLOAD> channel, Flow.Publisher<? extends PAYLOAD> publisher, Function<? super PAYLOAD, ? extends Message<? extends PAYLOAD>> wrapper) RegisterFlow.Publisher
to be used for suppliedChannel
.<PAYLOAD> Messaging.Builder
publisher
(Channel<PAYLOAD> channel, PublisherBuilder<? extends Message<? extends PAYLOAD>> publisherBuilder) RegisterPublisherBuilder
to be used for construction of the publisher for suppliedChannel
.<PAYLOAD> Messaging.Builder
<PAYLOAD> Messaging.Builder
publisher
(Channel<PAYLOAD> channel, Publisher<? extends PAYLOAD> publisher, Function<? super PAYLOAD, ? extends Message<? extends PAYLOAD>> wrapper) <PAYLOAD> Messaging.Builder
subscriber
(Channel<PAYLOAD> channel, Flow.Subscriber<? extends Message<? extends PAYLOAD>> subscriber) RegisterFlow.Subscriber
to be used for suppliedChannel
.<PAYLOAD> Messaging.Builder
subscriber
(Channel<PAYLOAD> channel, Consumer<Multi<? extends Message<? extends PAYLOAD>>> consumer) <PAYLOAD,
RESULT>
Messaging.Buildersubscriber
(Channel<PAYLOAD> channel, SubscriberBuilder<? extends Message<? extends PAYLOAD>, RESULT> subscriberBuilder) <PAYLOAD> Messaging.Builder
subscriber
(Channel<PAYLOAD> channel, Subscriber<? extends Message<? extends PAYLOAD>> subscriber) RegisterSubscriber
to be used for suppliedChannel
.
-
Method Details
-
config
Configuration needed for configuring connector and their routing.- Parameters:
config
- config for connectors and their routes.- Returns:
- this builder
-
connector
Add connector implementingIncomingConnectorFactory
,OutgoingConnectorFactory
or both.- Parameters:
connector
- connector to add.- Returns:
- this builder
-
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) RegisterPublisherBuilder
to be used for construction of the publisher for suppliedChannel
.- Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to be publisher constructed forpublisherBuilder
- 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) - Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use publisher inpublisher
- to publish in supplied channelwrapper
- function to be used for raw payload wrapping, if null simpleMessage.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) RegisterFlow.Publisher
to be used for suppliedChannel
.- Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use publisher inpublisher
- to publish in supplied channelwrapper
- function to be used for raw payload wrapping, if null simpleMessage.of(Object)
is used.- Returns:
- this builder
-
publisher
public <PAYLOAD> Messaging.Builder publisher(Channel<PAYLOAD> channel, Flow.Publisher<? extends Message<? extends PAYLOAD>> publisher) RegisterFlow.Publisher
to be used for suppliedChannel
.- Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use publisher inpublisher
- to publish in supplied channel- Returns:
- this builder
-
publisher
public <PAYLOAD> Messaging.Builder publisher(Channel<PAYLOAD> channel, Publisher<? extends Message<? extends PAYLOAD>> publisher) - Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use publisher inpublisher
- to publish in supplied channel- Returns:
- this builder
-
listener
public <PAYLOAD> Messaging.Builder listener(Channel<PAYLOAD> channel, Consumer<? super PAYLOAD> consumer) RegisterConsumer
for listening every payload coming from upstream. This listener creates unbounded(Long.MAX_VALUE
) demand.Message
s are automatically acked and unwrapped. Equivalent ofProcessorBuilder.forEach(java.util.function.Consumer)
.- Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use subscriber inconsumer
- to consume payloads- Returns:
- this builder
-
subscriber
public <PAYLOAD> Messaging.Builder subscriber(Channel<PAYLOAD> channel, Flow.Subscriber<? extends Message<? extends PAYLOAD>> subscriber) RegisterFlow.Subscriber
to be used for suppliedChannel
.- Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use subscriber insubscriber
- to subscribe to supplied channel- Returns:
- this builder
-
subscriber
public <PAYLOAD> Messaging.Builder subscriber(Channel<PAYLOAD> channel, Consumer<Multi<? extends Message<? extends PAYLOAD>>> consumer) - Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use subscriber inconsumer
- 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) - Type Parameters:
PAYLOAD
- message payload typeRESULT
- result type- Parameters:
channel
- to use subscriber insubscriberBuilder
- to subscribe to supplied channel- Returns:
- this builder
-
subscriber
public <PAYLOAD> Messaging.Builder subscriber(Channel<PAYLOAD> channel, Subscriber<? extends Message<? extends PAYLOAD>> subscriber) RegisterSubscriber
to be used for suppliedChannel
.- Type Parameters:
PAYLOAD
- message payload type- Parameters:
channel
- to use subscriber insubscriber
- 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) - Type Parameters:
PAYLOAD
- message payload type of in channelRESULT
- message payload type of out channel- Parameters:
in
-Channel
to use suppliedProcessor
as subscriber inout
-Channel
to use suppliedProcessor
as publisher inprocessor
- 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) RegisterProcessorBuilder
for buildingProcessor
to be used isin
Channel
's subscriber andout
Channel
's publisher.- Type Parameters:
PAYLOAD
- message payload type of in channelRESULT
- message payload type of out channel- Parameters:
in
-Channel
to use suppliedProcessor
as subscriber inout
-Channel
to use suppliedProcessor
as publisher inprocessorBuilder
- 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. -
build
Build newMessaging
instance.- Specified by:
build
in interfaceBuilder<Messaging.Builder,
Messaging> - Returns:
- new instance of
Messaging
-