-
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.
Add formatting for Kotlin code snippets (#438)
* Add microservices code snippets for Java and Kotlin * Fix paths * Fix package names in java * Fix kotlin package names * Add Kotlin and Java to the event processing use case page * Add Kotlin and Java to event processing pages part 2 * Add async tasks in Java and Kotlin * Fixes to use case pages * Incorporate review feedback * Format java code snippets * Formatting * Fix imports
- Loading branch information
Showing
35 changed files
with
742 additions
and
824 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
plugins { | ||
id("org.gradle.toolchains.foojay-resolver-convention") version("0.5.0") | ||
} | ||
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version ("0.5.0") } |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
package develop | ||
|
||
import dev.restate.sdk.annotation.* | ||
import dev.restate.sdk.annotation.Handler | ||
import dev.restate.sdk.annotation.VirtualObject | ||
import dev.restate.sdk.http.vertx.RestateHttpEndpointBuilder | ||
import dev.restate.sdk.kotlin.* | ||
import dev.restate.sdk.kotlin.KtStateKey | ||
import dev.restate.sdk.kotlin.ObjectContext | ||
|
||
// withClass tooltip java-overview-virtual-object | ||
@VirtualObject | ||
class Greeter { | ||
|
||
// withClass(1:3) tooltip java-overview-state-key | ||
companion object { | ||
private val COUNT = KtStateKey.json<Int>("count") | ||
} | ||
// withClass(1:3) tooltip java-overview-state-key | ||
companion object { | ||
private val COUNT = KtStateKey.json<Int>("count") | ||
} | ||
|
||
// withClass tooltip java-overview-virtual-object-handler | ||
@Handler | ||
suspend fun greet(ctx: ObjectContext, greeting: String): String { | ||
// Get the count and increment it | ||
val count = ctx.get(COUNT) ?: 1 | ||
ctx.set(COUNT, count + 1) | ||
// withClass tooltip java-overview-virtual-object-handler | ||
@Handler | ||
suspend fun greet(ctx: ObjectContext, greeting: String): String { | ||
// Get the count and increment it | ||
val count = ctx.get(COUNT) ?: 1 | ||
ctx.set(COUNT, count + 1) | ||
|
||
// Send the response back | ||
return "$greeting ${ctx.key()} for the $count time!" | ||
} | ||
// Send the response back | ||
return "$greeting ${ctx.key()} for the $count time!" | ||
} | ||
} | ||
|
||
fun main() { | ||
RestateHttpEndpointBuilder | ||
.builder() | ||
.bind(Greeter()) | ||
.buildAndListen() | ||
RestateHttpEndpointBuilder.builder().bind(Greeter()).buildAndListen() | ||
} |
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 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
Oops, something went wrong.