https://github.com/codekoala/celeriac.v1
Golang client library for adding support for interacting and monitoring Celery workers, tasks and events.
https://github.com/codekoala/celeriac.v1
Last synced: 5 months ago
JSON representation
Golang client library for adding support for interacting and monitoring Celery workers, tasks and events.
- Host: GitHub
- URL: https://github.com/codekoala/celeriac.v1
- Owner: codekoala
- License: mit
- Fork: true (svcavallar/celeriac.v1)
- Created: 2015-10-28T18:52:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-28T18:52:49.000Z (over 10 years ago)
- Last Synced: 2025-10-10T14:18:08.416Z (8 months ago)
- Language: Go
- Size: 98.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Celeriac
=======
Golang client library for adding support for interacting and monitoring Celery workers and tasks.
It provides functionality to place tasks on the task queue, as well
as monitor task and worker events.
Dependencies
------------
This library depends upon the following packages:
- github.com/streadway/amqp
- github.com/Sirupsen/logrus
- github.com/nu7hatch/gouuid
- github.com/pquerna/ffjson
Usage
-----
Installation: `go get github.com/svcavallar/celeriac.v1`
This imports a new namespace called `celeriac`
```go
package main
import (
"log"
"os"
"github.com/svcavallar/celeriac.v1"
)
func main() {
taskBrokerURI := "amqp://user:pass@localhost:5672/vhost"
// Connect to RabbitMQ task queue
TaskQueueMgr, err := celeriac.NewTaskQueueMgr(taskBrokerURI)
if err != nil {
log.Printf("Failed to connect to task queue: %v", err)
os.Exit(-1)
}
log.Printf("Service connected to task queue - (URL: %s)", taskBrokerURI)
// Get the task events from the task events channel
for {
select {
default:
ev := <-TaskQueueMgr.Monitor.EventsChannel
if ev != nil {
if x, ok := ev.(*celeriac.WorkerEvent); ok {
log.Printf("Task monitor: Worker event - %s", x.Type)
} else if x, ok := ev.(*celeriac.TaskEvent); ok {
log.Printf("Task monitor: Task event - %s [ID]: %s", x.Type, x.UUID)
}
}
}
}
}
```