An open API service indexing awesome lists of open source software.

https://github.com/devwithzain/thebroadcaststore


https://github.com/devwithzain/thebroadcaststore

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# BroadcastStore

A distributed broadcast message store implementation for handling pub/sub
messaging patterns.

## Features

- Distributed message broadcasting
- Persistent message storage
- Publisher/Subscriber pattern support
- Message deduplication
- Fault tolerance and high availability
- Horizontal scaling capabilities

## Installation

```bash
go get github.com/yourusername/broadcaststore
```

## Quick Start

```go
import "github.com/yourusername/broadcaststore"

// Create a new broadcast store
store := broadcaststore.New(broadcaststore.Config{
StoragePath: "/tmp/broadcast-store",
})

// Start the store
if err := store.Start(); err != nil {
panic(err)
}

// Publish a message
store.Publish("channel-1", []byte("Hello World"))

// Subscribe to messages
sub := store.Subscribe("channel-1")
for msg := range sub.Messages() {
fmt.Printf("Received: %s\n", string(msg.Data))
}
```

## Configuration

| Option | Description | Default |
| --------------- | ----------------------------- | -------------------- |
| StoragePath | Path to store persistent data | /tmp/broadcast-store |
| MaxMessageSize | Maximum message size in bytes | 1MB |
| RetentionPeriod | How long to retain messages | 24h |

## API Reference

### Store Operations

- `New(config Config) *Store` - Create a new broadcast store
- `Start() error` - Start the store
- `Stop() error` - Stop the store
- `Publish(channel string, data []byte) error` - Publish a message
- `Subscribe(channel string) *Subscription` - Subscribe to a channel

### Subscription Operations

- `Messages() <-chan Message` - Get message channel
- `Close() error` - Close subscription
- `Unsubscribe()` - Unsubscribe from channel

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
for details.