Package com.framed.streamer.dispatcher
Class JsonlDispatcher
java.lang.Object
com.framed.core.Service
com.framed.io.dispatch.Dispatcher
com.framed.streamer.dispatcher.JsonlDispatcher
-
Field Summary
Fields inherited from class com.framed.core.Service
ADDRESS_REGISTRY_SUFFIX, eventBus, formatter, logger -
Constructor Summary
ConstructorsConstructorDescriptionJsonlDispatcher(EventBus eventBus, org.json.JSONArray devices, String path, String fileName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalled when datapoint cannot be queued or pushed.protected voidonHandlerError(String deviceID, String address, Object rawMsg, Exception e) Called when handler fails before enqueueing (e.g., parse error).voidPushes a single datapoint to the underlying sink.voidPushes a batch of datapoints to the underlying sink.Methods inherited from class com.framed.io.dispatch.Dispatcher
shutdown, stopMethods inherited from class com.framed.core.Service
addressRegistry, announceAddress
-
Constructor Details
-
JsonlDispatcher
-
-
Method Details
-
push
Description copied from class:DispatcherPushes a single datapoint to the underlying sink.Invoked on the dispatcher's worker thread. Implementations may throw
IOExceptionto signal a transient failure, which triggers retry with exponential backoff.- Specified by:
pushin classDispatcher- Parameters:
dataPoint- the datapoint to push- Throws:
IOException- if the push fails due to a transient IO error and should be retried
-
pushBatch
Description copied from class:DispatcherPushes a batch of datapoints to the underlying sink.- Specified by:
pushBatchin classDispatcher- Parameters:
batch- the datapoints to push
-
onHandlerError
Description copied from class:DispatcherCalled when handler fails before enqueueing (e.g., parse error). Override to write dead-letter files, metrics, etc.- Overrides:
onHandlerErrorin classDispatcher- Parameters:
deviceID- the identifier of the device whose message failed to be handledaddress- the channel address the failing message arrived onrawMsg- the raw, unparsed message payloade- the exception raised while handling the message
-
onDrop
Description copied from class:DispatcherCalled when datapoint cannot be queued or pushed. Override for dead-letter storage / metrics.- Overrides:
onDropin classDispatcher- Parameters:
dp- the datapoint that could not be queued or pushedcause- the reason the datapoint was dropped
-
