Class QueueHandler<T extends Point>
java.lang.Object
io.openems.backend.timedata.timescaledb.internal.write.QueueHandler<T>
- Direct Known Subclasses:
QueueHandler.FloatQueueHandler
,QueueHandler.IntQueueHandler
,QueueHandler.StringQueueHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
QueueHandler
(MergePointsWorker<T> mergePointsWorker, Class<T> pointClass) -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Activates theMergePointsWorker
.protected abstract T
dataToPointConverter
(Schema.ChannelRecord channel, ZonedDateTime time, com.google.gson.JsonElement json) debugLog()
Returns a DebugLog String.static QueueHandler<?>
of
(Type type, Priority priority, com.zaxxer.hikari.HikariDataSource dataSource, ExecutorService executor) Returns a newQueueHandler
of the given type.boolean
offer
(Schema.ChannelRecord channel, long timestamp, com.google.gson.JsonElement json) Adds a point to the handler.
-
Constructor Details
-
QueueHandler
-
-
Method Details
-
offer
public boolean offer(Schema.ChannelRecord channel, long timestamp, com.google.gson.JsonElement json) throws OpenemsError.OpenemsNamedException Adds a point to the handler.- Parameters:
channel
- the channeltimestamp
- the timestampjson
- the value- Returns:
- true if the element was added to this queue, else false
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
getMergePointsWorker
-
debugLog
Returns a DebugLog String.- Returns:
- debug log
-
dataToPointConverter
protected abstract T dataToPointConverter(Schema.ChannelRecord channel, ZonedDateTime time, com.google.gson.JsonElement json) throws OpenemsError.OpenemsNamedException -
activate
public void activate()Activates theMergePointsWorker
. -
of
public static QueueHandler<?> of(Type type, Priority priority, com.zaxxer.hikari.HikariDataSource dataSource, ExecutorService executor) Returns a newQueueHandler
of the given type.- Parameters:
type
- the type of the handlerpriority
- the priority of the handlerdataSource
- the dataSource to get database connectionsexecutor
- the executor to execute writes- Returns:
- the handler
-