moving everything to github
This commit is contained in:
12
README.md
12
README.md
@@ -6,7 +6,7 @@ I started to develop what is now GubGub in one of my personal projects but I soo
|
||||
## Getting started
|
||||
|
||||
```sh
|
||||
go get -u gitlab.com/naterciom/gubgub
|
||||
go get github.com/naterciom/gubgub@latest
|
||||
```
|
||||
|
||||
## Example
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"gitlab.com/naterciom/gubgub"
|
||||
"github.com/naterciom/gubgub"
|
||||
)
|
||||
|
||||
type MyMessage struct {
|
||||
@@ -62,10 +62,10 @@ Use the `WithOnClose` option when creating the topic to perform any extra clean
|
||||
|
||||
GubGub offers 2 kinds of topics:
|
||||
|
||||
* **SyncTopic** - Publishing blocks until the message was delivered to all subscribers.
|
||||
* **SyncTopic** - Publishing blocks until the message was delivered to all subscribers.
|
||||
Subscribing blocks until the subscriber is registered.
|
||||
|
||||
* **AsyncTopic** - Publishing schedules the message to be eventually delivered.
|
||||
* **AsyncTopic** - Publishing schedules the message to be eventually delivered.
|
||||
Subscribing schedules a subscriber to be eventually registered.
|
||||
Only message delivery is garanteed.
|
||||
|
||||
@@ -74,10 +74,10 @@ Currently we deliver messages sequenctially (each subscriber gets the message on
|
||||
|
||||
## Benchmarks
|
||||
|
||||
* **SyncTopic** - Subscribers speed and number **will** have a direct impact the publishing performance.
|
||||
* **SyncTopic** - Subscribers speed and number **will** have a direct impact the publishing performance.
|
||||
Under the right conditions (few and fast subscribers) this is the most performant topic.
|
||||
|
||||
* **AsyncTopic** - Subscribers speed and number **will not** directly impact the publishing perfomance at the cost of some publishing overhead.
|
||||
* **AsyncTopic** - Subscribers speed and number **will not** directly impact the publishing perfomance at the cost of some publishing overhead.
|
||||
This is generally the most scalable topic.
|
||||
|
||||
The following benchmarks are just for topic comparison regarding how the number of subscribers and their speed can impact the publishing performance:
|
||||
|
||||
5
async.go
5
async.go
@@ -45,11 +45,12 @@ func NewAsyncTopic[T any](opts ...TopicOption) *AsyncTopic[T] {
|
||||
}
|
||||
|
||||
// Close terminates background go routines and prevents further publishing and subscribing. All
|
||||
// published messages are garanteed to be delivered once Close returns. This is idempotent.
|
||||
// published messages are garanteed to be delivered once Close returns. This is idempotent and
|
||||
// thread safe.
|
||||
func (t *AsyncTopic[T]) Close() {
|
||||
t.mu.Lock()
|
||||
if t.closing {
|
||||
// Multiple go routines attempted to close this topic. Both should wait for the topic to be
|
||||
// Multiple go routines attempted to close this topic. All should wait for the topic to be
|
||||
// closed before returning.
|
||||
t.mu.Unlock()
|
||||
<-t.closed
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitlab.com/naterciom/gubgub"
|
||||
"github.com/nmoniz/gubgub"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user