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 reactor.core.publisher.Sinks.Many<PermissionCommand> protected reactor.core.publisher.Flux<AiidaRecord> protected final SchemaFormatterRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAiidaStreamer(reactor.core.publisher.Flux<AiidaRecord> recordFlux, SchemaFormatterRegistry schemaFormatterRegistry, reactor.core.publisher.Sinks.Many<PermissionCommand> commandSink) 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.abstract voidsetTransmissionEnabled(boolean enabled) Enables or disables data transmission for this streamer.abstract voidupdateRecordFlux(reactor.core.publisher.Flux<AiidaRecord> recordFlux) Replaces the record flux this streamer is subscribed to and resubscribes.
-
Field Details
-
commandSink
-
schemaFormatterRegistry
-
recordFlux
-
-
Constructor Details
-
AiidaStreamer
protected AiidaStreamer(reactor.core.publisher.Flux<AiidaRecord> recordFlux, SchemaFormatterRegistry schemaFormatterRegistry, reactor.core.publisher.Sinks.Many<PermissionCommand> commandSink) 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.commandSink- Sink, to which aPermissionCommandis published when the EP sends a control command.
-
-
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:
-
setTransmissionEnabled
public abstract void setTransmissionEnabled(boolean enabled) Enables or disables data transmission for this streamer. While disabled, records are not published to the EP. -
updateRecordFlux
Replaces the record flux this streamer is subscribed to and resubscribes. Used to apply a new transmission schedule, which re-aggregates the upstream records on a different cadence.
-