Skip to content

Instantly share code, notes, and snippets.

View igalshilman's full-sized avatar

Igal Shilman igalshilman

View GitHub Profile
/*
* Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH
*
* This file is part of the Restate SDK for Node.js/TypeScript,
* 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-typescript/blob/main/LICENSE
*/
@igalshilman
igalshilman / compose.yml
Created November 28, 2024 12:08
A simple docker-compose for the distributed restate
services:
n1:
image: ghcr.io/restatedev/restate:main
ports:
- 8080:8080
- 9070:9070
- 5123:5123
restart: "no"
environment:
RESTATE_LOG_FILTER: restate=info
import * as restate from "@restatedev/restate-sdk";
export type WorkItem = {
item: number; // compute item factorial
};
export type WorkRequest = {
awekable: string;
};
export type Subscriber = {
service: string;
handler: string;
key?: string;
};
export const pubsub = restate.object({
name: "pubsub",
handlers: {
/**
import { service, type Context } from "@restatedev/restate-sdk";
interface ServiceB {
greet: (ctx: Context, name: string) => Promise<string>;
}
const realServiceB = service({
name: "realServiceB",
handlers: {
from fastapi import FastAPI
import restate
app = FastAPI()
@app.get("/")
async def foo():
return { "foo" : "bar" }
import {
ObjectContext,
Rand,
service,
TerminalError,
type Context,
} from "@restatedev/restate-sdk";
class CircuitBreakerState {
constructor(