From c72284777d875fdce1c9d0a46f2c3ed3a520ad16 Mon Sep 17 00:00:00 2001 From: Andrea Acampora Date: Mon, 13 Feb 2023 22:54:06 +0100 Subject: [PATCH] feat: create event consumer interface --- .../application/presenter/EventConsumer.kt | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/kotlin/application/presenter/EventConsumer.kt diff --git a/src/main/kotlin/application/presenter/EventConsumer.kt b/src/main/kotlin/application/presenter/EventConsumer.kt new file mode 100644 index 00000000..fc429633 --- /dev/null +++ b/src/main/kotlin/application/presenter/EventConsumer.kt @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023. Smart Operating Block + * + * Use of this source code is governed by an MIT-style + * license that can be found in the LICENSE file or at + * https://opensource.org/licenses/MIT. + */ + +package application.presenter + +import entities.events.Event +import io.reactivex.rxjava3.core.FlowableEmitter + +/** + * The consumer of events. + * It's responsible to consume events and to emit them to an Observer. + */ +interface EventConsumer { + + /** + * The function to start the consumer. + * @param emitter the emitter of events. + */ + fun start(emitter: FlowableEmitter>) + + /** + * The function fon consuming events. + * @param inputEvent the input event. + * @return the parsed Event. + */ + fun consumeEvent(inputEvent: E): Event<*> +}