You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Reactr has been deprecated. You can use the new [scheduler](https://github.com/suborbital/e2core/tree/main/scheduler) and [engine](https://github.com/suborbital/sat/tree/vmain/engine) packages, which are a drop-in replacements for this project.
1
+
## Reactr has been deprecated. You can use the new [scheduler](https://github.com/suborbital/e2core/tree/main/scheduler) and [engine](https://github.com/suborbital/sat/tree/vmain/engine) packages, which are a drop-in replacements for this project. You can find the [docs](./docs) in this repo.
2
2
3
3
Reactr is a fast, performant function scheduling library. Reactr is designed to be flexible, with the ability to run embedded in your Go applications and first-class support for WebAssembly.
4
4
5
5
Reactr runs functions called Runnables, and transparently spawns workers to process jobs. Each worker processes jobs in sequence, using Runnables to execute them. Reactr jobs are arbitrary data, and they return arbitrary data (or an error). Jobs are scheduled, and their results can be retrieved at a later time.
6
6
7
7
## Wasm
8
8
9
-
Reactr has support for Wasm-packaged Runnables. The `engine` package contains a multi-tenant Wasm scheduler, an API to grant capabilities to Wasm Runnables, and support for several languages including Rust (stable), TypeScript/AssemblyScript (beta), and Swift (alpha). See [Wasm](https://docs.suborbital.dev/reactr/wasm) and the [Subo CLI](https://github.com/suborbital/subo) for details.
9
+
Reactr has support for Wasm-packaged Runnables. The `engine` package contains a multi-tenant Wasm scheduler, an API to grant capabilities to Wasm Runnables, and support for several languages including Rust (stable), TypeScript/AssemblyScript (beta), and Swift (alpha). See [Wasm](./docs/wasm.md) and the [Subo CLI](https://github.com/suborbital/subo) for details.
10
10
11
11
### The Basics
12
12
@@ -20,26 +20,26 @@ And then get started by defining something `Runnable`:
A `Runnable` is something that can take care of a job, all it needs to do is conform to the `Runnable` interface as you see above.
@@ -49,33 +49,29 @@ Once you have a Runnable, create a Reactr instance, register it, and `Do` some w
49
49
package main
50
50
51
51
import (
52
-
"fmt"
53
-
"log"
52
+
"fmt"
53
+
"log"
54
54
55
-
"github.com/suborbital/reactr/rt"
55
+
"github.com/suborbital/reactr/rt"
56
56
)
57
57
58
58
funcmain() {
59
-
r:= rt.New()
59
+
r:= rt.New()
60
+
61
+
r.Register("generic", generic{})
60
62
61
-
r.Register("generic", generic{})
63
+
result:= r.Do(r.Job("generic", "hard work"))
62
64
63
-
result:= r.Do(r.Job("generic", "hard work"))
65
+
res, err:= result.Then()
66
+
if err != nil {
67
+
log.Fatal(err)
68
+
}
64
69
65
-
res, err:= result.Then()
66
-
if err != nil {
67
-
log.Fatal(err)
68
-
}
69
-
70
-
fmt.Println("done!", res.(string))
70
+
fmt.Println("done!", res.(string))
71
71
}
72
72
```
73
73
When you `Do` some work, you get a `Result`. A result is like a Rust future or a JavaScript promise, it is something you can get the job's result from once it is finished.
74
74
75
75
Calling `Then()` will block until the job is complete, and then give you the return value from the Runnable's `Run`. Cool, right?
76
76
77
-
## Reactr has some very powerful capabilities, visit the [Reactr guide](https://docs.suborbital.dev/reactr/) to learn more.
78
-
79
-
Reactr is being actively developed and has planned improvements, including optimized memory usage, library stability, data persistence, and more. Cheers!
## Reactr has been deprecated. You can use the new [scheduler](https://github.com/suborbital/e2core/tree/main/scheduler) and [engine](https://github.com/suborbital/sat/tree/vmain/engine) packages, which are a drop-in replacements for this project.
2
+
3
+
# Reactr ➕ Grav
4
+
5
+
Reactr is designed to integrate with the other [Suborbital](https://suborbital.dev) projects such as [Grav](https://github.com/suborbital/grav). Grav is a decentralized message bus which allows for your application code to communicate in a scalable, resilient way.
6
+
7
+
## Handle Messages
8
+
Reactr can respond to messages by connecting to a `grav.Pod` using `HandleMsg`:
Whenever a message with the given type is received from the bus, a `Job` will be queued to be handled by the provided Runnable. The `Job` will contain the message data.
16
+
17
+
The result returned by the Runnable's `Run` function may be a `grav.Message`. If so, it will be sent back out over the message bus. Anything else will be put into a message (by converting it into bytes) and sent back over the bus. If `Run` returns an error, a message with type `reactr.runerr` will be sent. If `Run` returns `nil, nil`, then a message of type `reactr.nil` will be sent. All messages sent will be a reply to the message that triggered the job.
0 commit comments