Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alindeman/go-kestrel
Interact with kestrel using golang
https://github.com/alindeman/go-kestrel
Last synced: about 1 month ago
JSON representation
Interact with kestrel using golang
- Host: GitHub
- URL: https://github.com/alindeman/go-kestrel
- Owner: alindeman
- Created: 2013-11-15T16:17:20.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-16T14:45:23.000Z (about 11 years ago)
- Last Synced: 2024-10-20T07:43:16.394Z (2 months ago)
- Language: Go
- Homepage:
- Size: 1.33 MB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go.kestrel
A simple wrapper over kestrel's thrift API. Includes support for multiple
servers and retries.It's still early days, so dig into client.go for all the details of what
you can do.## Basic Usage
```go
import (
"github.com/alindeman/go.kestrel"
"time"
)// assuming the thrift port is 2229
client := kestrel.NewClient("localhost", 2229)item := []byte("Hello World")
nitems, err := client.Put("queue1", [][]byte{item})items, err := client.Get("queue1", 1, 0, 1*time.Minute)
```## Cluster Usage
```go
import (
"github.com/alindeman/go.kestrel"
"time"
)// assuming the thrift port is 2229
clients := []*kestrel.Client{
kestrel.NewClient("host1", 2229),
kestrel.NewClient("host2", 2229),
kestrel.NewClient("host3", 2229),
}
cluster := kestrel.NewClusterReader(clients)ch := make(chan *kestrel.QueueItem, 10)
go cluster.ReadIntoChannel("queue1", ch)item1 := <-ch
item2 := <-chcluster.Close()
```