Skip to content

Commit 4057292

Browse files
committed
Update readme
1 parent 05bb0cc commit 4057292

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# @resonatehq/kafka
22

3-
`@resonatehq/kafka` is the official [Kafka](https://kafka.apache.org) transport binding for running Distributed Async Await, Resonate’s durable-execution framework. This package allows Resonate workers to communicate over Apache Kafka, using Kafka as a durable, ordered, and scalable message bus across processes and machines.
3+
`@resonatehq/kafka` is the official [Kafka](https://kafka.apache.org) transport binding for [Resonate](https://github.com/resonatehq/resonate).
44

55
## Quick Start
66

7-
### Installation
7+
### Install
88
```bash
99
npm install @resonatehq/kafka
1010
```
1111

12-
### Example
12+
### Run
1313

14-
```typescript
14+
**app.ts**
15+
```ts
1516
import { type Context, Resonate } from "@resonatehq/sdk";
1617
import { Kafka } from "@resonatehq/kafka";
1718

@@ -20,9 +21,8 @@ async function main() {
2021
await transport.start();
2122

2223
const resonate = new Resonate({ transport });
23-
24-
resonate.register("foo", foo);
25-
resonate.register("baz", baz);
24+
resonate.register(foo);
25+
resonate.register(bar);
2626

2727
const v = await resonate.run("foo.1", foo);
2828
console.log(v);
@@ -31,25 +31,26 @@ async function main() {
3131
}
3232

3333
function* foo(ctx: Context): Generator {
34-
const reply = yield* ctx.rpc("baz");
35-
return reply;
34+
return yield* ctx.rpc("bar");
3635
}
3736

38-
function baz(ctx: Context) {
39-
return `hello world`;
37+
function bar(ctx: Context) {
38+
return "hello world";
4039
}
4140

4241
main()
4342
```
44-
### Start Resonate with Kafka enabled
45-
Ensure the `resonate` and `default` Kafka topics exist:
43+
44+
Create the following topics:
45+
- resonate
46+
- default
47+
48+
Start the server:
4649
```bash
47-
<!-- start resonate with kafka enabled -->
48-
resonate dev --api-kafka-enable --aio-sender-plugin-kafka-enable
50+
resonate dev --api-kafka-enable --aio-kafka-enable
4951
```
5052

51-
### Run the Application
53+
Start the client:
5254
```bash
53-
<!-- run the app -->
5455
npx ts-node app.ts
5556
```

0 commit comments

Comments
 (0)