Skip to content

Events streaming-based helper library to store structured configuration

License

Notifications You must be signed in to change notification settings

Autodoc-Technology/streaming-based-config

Repository files navigation

Streaming-Based Config

Streaming-Based Config is a helper library for accessing structured configurations based on event streaming/subscription.

Installation

To install the Streaming-Based-Config library, you can use go get:

go get github.com/Autodoc-Technology/streaming-based-config

Usage

Here's a basic example of how to use the Streaming-Based-Config library:

sub := sbc.NewSubscriber[SimpleConfig](
    sbctransport.NewDemoTransport([]byte(`{"value": 1, "value2": "hello"}`), 3*time.Second),
    sbc.DefaultKeyBuilder[SimpleConfig](),
)
confSubs, err := sub.Subscribe(ctx)
if err != nil {
    log.Fatalf("Failed to subscribe: %v", err)
}
defer confSubs.Unsubscribe()

// get the current value
config := confSubs.Get()
log.Printf("Get Config: %+v", config)

// subscribe to the values stream
for val := range confSubs.GetUpdates() {
    log.Printf("Config: %+v", val)
}

For more detailed examples, please refer to the example directory.

Development plan

  • Basic code structure
  • Unit tests for most of the code
  • Nats transport implementation
  • Consul transport implementation
  • Unit tests for Subscriber/Subscriptions (with mocks)
  • Kafka transport implementation

Contributing

We welcome contributions from the community. If you wish to contribute, please follow these steps:

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

License

This project is Apache 2.0 licensed. For more information, please refer to the LICENSE file.

Contact

http://autodoc.eu/

Project Link: https://github.com/Autodoc-Technology/streaming-based-config

About

Events streaming-based helper library to store structured configuration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages