Feather
Feather is an extremely lightweight publish-subscribe message broker (event bus). It supports both topic (through types) and content (through a predicate) based filtering. The goal of Feather is to maximize message throughput.
Table of contents:
Features
- Strategy based - Allows you to provide strategies to specify how the broker does things. This allows you to optimize for different things by simply changing how you create the broker.
- Asynchronous - Everything can run asynchronously, as well as synchronously. Just provide a strategy that does what you want.
- Filters - A simple yet flexible filter system. Every subscriber is filtered by types, and it is optionally filtered by a predicate. All you need to do is implement the PredicatedSubscriber class and the applies method.
- Unread messages - Catch any message that was not received by a subscriber just by creating a subscriber that listens for UnreadMessage.
- Lightweight - Feather is extremely lightweight and doesn't bring in any bloat, redundant concepts or confusing features.
- Fast - Faster than other publish-subscribe frameworks by orders of magnitude. Check out the case study.
Usage
How to create the publish-subscribe message broker and set up for use: ```Java // Use a builder to create a new PSBroker. // The builder allows you to provide customizable strategies for the broker to use. PSBroker broker = new PSBrokerBuilder().build(); ``` How to create a subscriber: ```Java public class UnreadMessageReader extends Subscriber { @Override public void receive(UnreadMessage message) { // insert logic here } } ``` How to let the broker know what messages a subscriber is listening to: ```Java broker.subscribe(new UnreadMessageReader(), UnreadMessage.class); ``` How to send a message that subscribers can receive: ```Java broker.publish("Hello world!"); ``` For complete examples, check out the examples in the src/example directory.License
This project is distributed under the terms of the MIT License. See file "LICENSE" for further information.