Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
naueramant committed Dec 20, 2022
1 parent d77cae4 commit abace66
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# Boomerang 🪃

Recurring tasks scheduler for golang implemented on top of [redis](https://redis.io/).
Simple recurring task scheduler for golang implemented on top of [redis](https://redis.io/).

## Usage

```go
package main

import (
"context"
"fmt"
"time"

"github.com/go-redis/redis/v8"
"github.com/opsway-io/boomerang"
)

func main() {
ctx := context.Background()

cli := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
})

sch := boomerang.NewSchedule(cli)

task := boomerang.NewTask(
"greeter",
"some-unique-id",
time.Now().Add(5*time.Second),
"Hello!",
)

if err := sch.Add(ctx, task); err != nil {
panic(err)
}

sch.On(ctx, "greeter", func(ctx context.Context, task *boomerang.Task) {
fmt.Println(task.Data)
})
}
```

0 comments on commit abace66

Please sign in to comment.