create bus and subscriber
This commit is contained in:
@@ -44,19 +44,20 @@ abstract class CommandStreamInMemory<C : Command> : CommandStream<C> {
|
||||
command: C,
|
||||
action: CommandBlock<C>,
|
||||
) {
|
||||
val status = object : CommandStream.ComputeStatus {
|
||||
var isSet: Boolean = false
|
||||
val status =
|
||||
object : CommandStream.ComputeStatus {
|
||||
var isSet: Boolean = false
|
||||
|
||||
override fun ack() {
|
||||
if (!isSet) markAsSuccess(command) else error("Already NACK")
|
||||
isSet = true
|
||||
}
|
||||
override fun ack() {
|
||||
if (!isSet) markAsSuccess(command) else error("Already NACK")
|
||||
isSet = true
|
||||
}
|
||||
|
||||
override fun nack() {
|
||||
if (!isSet) markAsFailed(command) else error("Already ACK")
|
||||
isSet = true
|
||||
override fun nack() {
|
||||
if (!isSet) markAsFailed(command) else error("Already ACK")
|
||||
isSet = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (runCatching { status.action(command) }.isFailure) {
|
||||
markAsFailed(command)
|
||||
|
||||
Reference in New Issue
Block a user