Skip to content

Commit

Permalink
Adjust update sender argument order for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
wasdennnoch committed Jan 13, 2024
1 parent 6b04045 commit 0a85119
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions latte/src/main/java/gg/beemo/latte/broker/BrokerMessage.kt
Expand Up @@ -11,7 +11,7 @@ open class BrokerMessage<T, H : BrokerMessageHeaders>(
get() = headers.messageId

internal fun <ResponseT> toRpcRequestMessage(
updateSender: suspend (ResponseT, RpcStatus) -> Unit,
updateSender: suspend (RpcStatus, ResponseT) -> Unit,
): RpcRequestMessage<T, ResponseT, H> {
return RpcRequestMessage(topic, key, value, headers, updateSender)
}
Expand All @@ -32,11 +32,11 @@ class RpcRequestMessage<RequestT, ResponseT, H : BrokerMessageHeaders>(
key: String,
value: RequestT,
headers: H,
private val updateSender: suspend (ResponseT, RpcStatus) -> Unit,
private val updateSender: suspend (RpcStatus, ResponseT) -> Unit,
) : BrokerMessage<RequestT, H>(topic, key, value, headers) {

suspend fun sendUpdate(response: ResponseT, status: RpcStatus) {
updateSender(response, status)
suspend fun sendUpdate(status: RpcStatus, response: ResponseT) {
updateSender(status, response)
}

}
Expand Up @@ -220,7 +220,7 @@ class RpcClient<RequestT, ResponseT>(
responseProducer.internalSend(responseMsg, bypassNullCheck = isException)
}

val rpcMessage = msg.toRpcRequestMessage<ResponseT> { data, status ->
val rpcMessage = msg.toRpcRequestMessage<ResponseT> { status, data ->
sendResponse(data, status, isException = false, isUpdate = true)
}
try {
Expand Down

0 comments on commit 0a85119

Please sign in to comment.