Skip to content

houcy/go-kestrel

 
 

Repository files navigation

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

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

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 := <-ch

cluster.Close()

About

Interact with kestrel using golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 63.8%
  • Thrift 22.4%
  • Shell 9.6%
  • Scala 4.2%