Class PropertySubscriber<T>
java.lang.Object
com.inductiveautomation.ignition.designer.mvvm.PropertySubscriber<T>
- Type Parameters:
T
- The type of the value that will be emitted by the publisher.
- All Implemented Interfaces:
Flow.Subscriber<SubmissionContext<T>>
This class is used to subscribe to a
PropertyPublisherReadOnly
and consume the values emitted by the
publisher.-
Constructor Summary
ConstructorsConstructorDescriptionPropertySubscriber
(BiConsumer<SubmissionContext<T>, T> onNextConsumer) This constructor is used when you don't need access to the subscription.PropertySubscriber
(Consumer<Flow.Subscription> subscriptionConsumer, BiConsumer<SubmissionContext<T>, T> onNextConsumer) This constructor is used when you want to have access to the created subscription so that you can cancel the subscription when needed.PropertySubscriber
(Consumer<T> onNextConsumer) This constructor is used when you don't need access to the subscription. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> PropertySubscriber<T>
create
(Consumer<Flow.Subscription> subscriptionConsumer, Consumer<T> processOnNextConsumer) void
void
void
onNext
(SubmissionContext<T> value) void
onSubscribe
(Flow.Subscription subscription)
-
Constructor Details
-
PropertySubscriber
This constructor is used when you don't need access to the subscription. This version of the constructor is used when you only need to consume the value emitted by the publisher.- Parameters:
onNextConsumer
- The consumer that will be called when a new value is emitted.
-
PropertySubscriber
This constructor is used when you don't need access to the subscription. This version of the constructor is used when you need to consume the value emitted by the publisher and theSubmissionContext
that is associated with the emission.- Parameters:
onNextConsumer
- The consumer that will be called when a new value is emitted.
-
PropertySubscriber
public PropertySubscriber(Consumer<Flow.Subscription> subscriptionConsumer, BiConsumer<SubmissionContext<T>, T> onNextConsumer) This constructor is used when you want to have access to the created subscription so that you can cancel the subscription when needed.- Parameters:
subscriptionConsumer
- The consumer that will be called when the subscription is created.onNextConsumer
- The consumer that will be called when a new value is emitted.
-
-
Method Details
-
onSubscribe
- Specified by:
onSubscribe
in interfaceFlow.Subscriber<T>
-
onNext
- Specified by:
onNext
in interfaceFlow.Subscriber<T>
-
onError
- Specified by:
onError
in interfaceFlow.Subscriber<T>
-
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceFlow.Subscriber<T>
-
create
public static <T> PropertySubscriber<T> create(Consumer<Flow.Subscription> subscriptionConsumer, Consumer<T> processOnNextConsumer)
-