Skip to content

spurge/actionqueuego

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Action Queue (go version)

Build Status

This is a very lightweight and non distributed data event stream library and server. The event stream is designed as a queue. You define you're queue with a filename (everything is written to disk) which the queue will append data to. Then you'll start adding data (Actions) to that queue. At the other end, you'll have some data consumers. Those consumers can consume any data in the stream and/or tailing.

Setup

go get -u github.com/kardianos/govendor
govendor sync

Test

govendor test +local

1. Create a queue

queue, err := NewActionQueue(filename)

2. Add an action to the queue

queue.AddAction("{\"some-property\":\"with-a-value\"}")

3. Read all actions

callback := func(entry *ActionEntry, err error) {
  // entry.pos
  // entry.tim
  // entry.def
}

count, err := queue.ReadHistory(callback, 0, -1)

4. Tailing actions

done := make(chan bool)

callback := func(entry *ActionEntry, err error) {
  // entry.pos
  // entry.tim
  // entry.def
}

go queue.TailHistory(callback, 0, done)
done <- true

About

Data event stream lib and server

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages