Skip to content

Commit

Permalink
refactor(eze): rename gateway class
Browse files Browse the repository at this point in the history
  • Loading branch information
saig0 committed Aug 13, 2021
1 parent 893faee commit 96acb70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions eze/src/main/kotlin/org/camunda/community/eze/EngineFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ object EngineFactory {
val streamWriter = logStream.newLogStreamRecordWriter().join()
streamWritersByPartition[partitionId] = streamWriter

val simpleGateway = SimpleGateway(streamWriter)
val server = ServerBuilder.forPort(ZeebeEngineImpl.PORT).addService(simpleGateway).build()
val gateway = GrpcToLogStreamGateway(streamWriter)
val grpcServer = ServerBuilder.forPort(ZeebeEngineImpl.PORT).addService(gateway).build()

val db = createDatabase()
val zeebeDb = createDatabase()

val grpcResponseWriter = GrpcResponseWriter(
responseCallback = simpleGateway::responseCallback,
errorCallback = simpleGateway::errorCallback
responseCallback = gateway::responseCallback,
errorCallback = gateway::errorCallback
)

val streamProcessor = createStreamProcessor(
partitionCount = partitionCount,
logStream = logStream,
database = db,
database = zeebeDb,
scheduler = scheduler,
grpcResponseWriter
)
Expand All @@ -91,17 +91,17 @@ object EngineFactory {

return ZeebeEngineImpl(
startCallback = {
server.start()
grpcServer.start()
streamProcessor.openAsync(false).join()
exporterRunner.open()
},
stopCallback = {
server.shutdownNow()
server.awaitTermination()
simpleGateway.close()
grpcServer.shutdownNow()
grpcServer.awaitTermination()
gateway.close()
exporterRunner.close()
streamProcessor.close()
db.close()
zeebeDb.close()
logStream.close()
scheduler.stop()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicLong

class SimpleGateway(
class GrpcToLogStreamGateway(
private val writer: LogStreamRecordWriter
) : GatewayGrpc.GatewayImplBase(), AutoCloseable {

Expand Down

0 comments on commit 96acb70

Please sign in to comment.