Package energy.eddie.aiida.streamers
Class AiidaStreamer
java.lang.Object
energy.eddie.aiida.streamers.AiidaStreamer
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
MqttStreamer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final UUIDprotected final reactor.core.publisher.Flux<AiidaRecord> protected final reactor.core.publisher.Sinks.One<UUID> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAiidaStreamer(UUID aiidaId, reactor.core.publisher.Flux<AiidaRecord> recordFlux, reactor.core.publisher.Sinks.One<UUID> terminationRequestSink) Create a new AiidaStreamer and sets the Flux for records and status messages that should be sent. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Unsubscribe from any Flux and free any used resources in this method.abstract voidcloseTerminally(AiidaConnectionStatusMessageDto statusMessage) Sends aAiidaConnectionStatusMessageDtowith the passedstatusbefore closing this streamer for good.abstract voidconnect()Open required connections to the streaming target (EP) in this method, not beforehand.
-
Field Details
-
aiidaId
-
recordFlux
-
terminationRequestSink
-
-
Constructor Details
-
AiidaStreamer
protected AiidaStreamer(UUID aiidaId, reactor.core.publisher.Flux<AiidaRecord> recordFlux, reactor.core.publisher.Sinks.One<UUID> terminationRequestSink) Create a new AiidaStreamer and sets the Flux for records and status messages that should be sent. The constructor should initialize and prepare any necessary resources but only afterconnect()was called, connections should be opened and data streamed.- Parameters:
recordFlux- Flux, where records that should be sent are available.terminationRequestSink- Sink, to which the permissionId will be published when the EP requests a termination.
-
-
Method Details
-
connect
public abstract void connect()Open required connections to the streaming target (EP) in this method, not beforehand. Subscribe to the Fluxes in this method, to receive records and status messages that shall be sent. Start listening for termination requests from the EP. -
close
public abstract void close()Unsubscribe from any Flux and free any used resources in this method. May flush all queued messages beforehand.- Specified by:
closein interfaceAutoCloseable
-
closeTerminally
Sends aAiidaConnectionStatusMessageDtowith the passedstatusbefore closing this streamer for good. May block until the passedstatusMessageis transmitted.- See Also:
-