File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1+ import { type Context , Resonate } from "@resonatehq/sdk" ;
2+ import { Kafka } from "./src/index" ;
3+
4+ async function main ( ) {
5+ const transport = new Kafka ( { brokers : [ "localhost:9092" ] } ) ;
6+ await transport . start ( ) ;
7+
8+ const resonate = new Resonate ( { transport } ) ;
9+
10+ resonate . register ( "foo" , foo ) ;
11+ resonate . register ( "baz" , baz ) ;
12+
13+ const v = await resonate . run ( "foo.1" , foo ) ;
14+ console . log ( v ) ;
15+
16+ resonate . stop ( ) ;
17+ }
18+
19+ function * foo ( ctx : Context ) : Generator {
20+ const reply = yield * ctx . rpc ( "baz" ) ;
21+ return reply ;
22+ }
23+
24+ function baz ( ctx : Context ) {
25+ return `hello world` ;
26+ }
27+
28+ main ( ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @resonatehq/kafka" ,
3- "version" : " 0.1.0 " ,
3+ "version" : " 0.1.1 " ,
44 "description" : " Resonate Kafka Transport" ,
55 "repository" : {
66 "url" : " https://github.com/resonatehq/resonate-transport-kafka-ts"
You can’t perform that action at this time.
0 commit comments