Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/younisshah/valkyrie
An Apache Thrift server with pluggable message broker!
https://github.com/younisshah/valkyrie
message-queue thrift
Last synced: 14 days ago
JSON representation
An Apache Thrift server with pluggable message broker!
- Host: GitHub
- URL: https://github.com/younisshah/valkyrie
- Owner: younisshah
- License: gpl-3.0
- Created: 2017-05-11T20:42:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-15T11:37:54.000Z (over 7 years ago)
- Last Synced: 2024-06-20T13:33:14.891Z (8 months ago)
- Topics: message-queue, thrift
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Valkyrie
##### An Apache Thrift server with pluggable message broker!
Valkyrie implements Adapter pattern to plug-in any message broker you want to process the messages.
The current implementation provides an example implementation of **RabbitMQ**.You should provide an implementation of `Queuer` and `ValkyrieService` interface.
```go
type Queuer interface {
// Adaptee must provide a *connection* field specific to the Message queue used
Connect(url string) error
// Arguments are message and queue name
Produce(message interface{}, queueName string) error
// consume from the given queue using the callback function
Consume(queueName string, callback func(interface{}) error)
// Closes the connection to message queue using the connection object provided
Close()
}
``````go
type ValkyrieService interface {
// Parameters:
// - Message
// - Queue
Send(message string, queue string) (r bool, err error)
}
```After writing your custom message queue implementation, use it to construct the **Apache Thrift** `handlder`
Example __RabbitMQ__ message broker handler:
```go
handler := vhandler.NewValkyrieHandler(&vrabbit.RabbitMQ{})
```
Finally implement the `Send` method of `ValkyrieService`.Example implementation:
```go
if err := v.messageBroker.Connect(RABBIT_MQ_URL); err != nil {
fmt.Println(err)
return false, err
} else {
if err = v.messageBroker.Produce(message, queueName); err != nil {
fmt.Println("[*] Failed to produce", err)
return false, err
}
fmt.Println("[+] Produced to queue", queueName)
return true, nil
}
```---
Example server implementation:
```go
type valkyrieHandler struct {
messageQueue vadapter.Queuer
}
```Here `valkyrieHandler` implements `Send` method of `ValkyrieService`
```go
messageQueue := &vrabbit.RabbitMQ{}
handler := valkyrieHandler{messageQueue: messageQueue}
valkyrieServer := vserver.NewValkyrieServer("localhost:9090")
valkyrieServer.InjectValkyrieMessageQueue(messageQueue)
valkyrieServer.StartServer(handler)
```---
TODO
* Write Valkyrie consumer
* Add support for any kind of data
* Try using Non-Blocking server over **TFramedTransport**.