Skip to content

Commit c722847

Browse files
feat: create event consumer interface
1 parent 61dfb21 commit c722847

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package application.presenter
10+
11+
import entities.events.Event
12+
import io.reactivex.rxjava3.core.FlowableEmitter
13+
14+
/**
15+
* The consumer of events.
16+
* It's responsible to consume events and to emit them to an Observer.
17+
*/
18+
interface EventConsumer<in E> {
19+
20+
/**
21+
* The function to start the consumer.
22+
* @param emitter the emitter of events.
23+
*/
24+
fun start(emitter: FlowableEmitter<Event<Any>>)
25+
26+
/**
27+
* The function fon consuming events.
28+
* @param inputEvent the input event.
29+
* @return the parsed Event.
30+
*/
31+
fun consumeEvent(inputEvent: E): Event<*>
32+
}

0 commit comments

Comments
 (0)