-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91296a3
commit b2d57d9
Showing
332 changed files
with
13,824 additions
and
12,353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
plugins { | ||
`kotlin-conventions` | ||
`library-publishing-conventions` | ||
} | ||
|
||
description = "Restate Client to interact with services from within other Kotlin applications" | ||
|
||
dependencies { | ||
api(project(":client")) | ||
implementation(libs.kotlinx.coroutines.core) | ||
} |
99 changes: 99 additions & 0 deletions
99
client-kotlin/src/main/kotlin/dev/restate/client/kotlin/ingress.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright (c) 2023 - Restate Software, Inc., Restate GmbH | ||
// | ||
// This file is part of the Restate Java SDK, | ||
// which is released under the MIT license. | ||
// | ||
// You can find a copy of the license in file LICENSE in the root | ||
// directory of this repository or package, or at | ||
// https://github.com/restatedev/sdk-java/blob/main/LICENSE | ||
package dev.restate.client.kotlin | ||
|
||
import dev.restate.client.Client | ||
import dev.restate.client.ClientRequestOptions | ||
import dev.restate.client.ClientResponse | ||
import dev.restate.client.SendResponse | ||
import dev.restate.common.Output | ||
import dev.restate.common.Request | ||
import dev.restate.serde.Serde | ||
import kotlinx.coroutines.future.await | ||
|
||
// Extension methods for the Client | ||
|
||
fun clientRequestOptions(init: ClientRequestOptions.Builder.() -> Unit): ClientRequestOptions { | ||
val builder = ClientRequestOptions.builder() | ||
builder.init() | ||
return builder.build() | ||
} | ||
|
||
suspend fun <Req, Res> Client.callSuspend(request: Request<Req, Res>): ClientResponse<Res> { | ||
return this.callAsync(request).await() | ||
} | ||
|
||
suspend fun <Req, Res> Client.callSuspend( | ||
requestBuilder: Request.Builder<Req, Res> | ||
): ClientResponse<Res> { | ||
return this.callAsync(requestBuilder).await() | ||
} | ||
|
||
suspend fun <Req, Res> Client.sendSuspend( | ||
request: Request<Req, Res> | ||
): ClientResponse<SendResponse<Res>> { | ||
return this.sendAsync(request).await() | ||
} | ||
|
||
suspend fun <Req, Res> Client.sendSuspend( | ||
request: Request.Builder<Req, Res> | ||
): ClientResponse<SendResponse<Res>> { | ||
return this.sendSuspend(request.build()) | ||
} | ||
|
||
suspend fun <T : Any> Client.AwakeableHandle.resolveSuspend( | ||
serde: Serde<T>, | ||
payload: T, | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<Void> { | ||
return this.resolveAsync(serde, payload, options).await() | ||
} | ||
|
||
suspend fun Client.AwakeableHandle.rejectSuspend( | ||
reason: String, | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<Void> { | ||
return this.rejectAsync(reason, options).await() | ||
} | ||
|
||
suspend fun <T> Client.InvocationHandle<T>.attachSuspend( | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<T> { | ||
return this.attachAsync(options).await() | ||
} | ||
|
||
suspend fun <T : Any?> Client.InvocationHandle<T>.getOutputSuspend( | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<Output<T>> { | ||
return this.getOutputAsync(options).await() | ||
} | ||
|
||
suspend fun <T> Client.IdempotentInvocationHandle<T>.attachSuspend( | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<T> { | ||
return this.attachAsync(options).await() | ||
} | ||
|
||
suspend fun <T> Client.IdempotentInvocationHandle<T>.getOutputSuspend( | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<Output<T>> { | ||
return this.getOutputAsync(options).await() | ||
} | ||
|
||
suspend fun <T> Client.WorkflowHandle<T>.attachSuspend( | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<T> { | ||
return this.attachAsync(options).await() | ||
} | ||
|
||
suspend fun <T> Client.WorkflowHandle<T>.getOutputSuspend( | ||
options: ClientRequestOptions = ClientRequestOptions.DEFAULT | ||
): ClientResponse<Output<T>> { | ||
return this.getOutputAsync(options).await() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
plugins { | ||
`java-library` | ||
`java-conventions` | ||
`kotlin-conventions` | ||
`library-publishing-conventions` | ||
} | ||
|
||
description = "Restate Client to interact with services from within other Java applications" | ||
|
||
dependencies { | ||
compileOnly(libs.jspecify) | ||
|
||
api(project(":common")) | ||
|
||
implementation(libs.jackson.core) | ||
implementation(libs.log4j.api) | ||
|
||
testImplementation(libs.junit.jupiter) | ||
testImplementation(libs.assertj) | ||
} |
Oops, something went wrong.