README.md in message_bus-2.1.2 vs README.md in message_bus-2.1.3
- old
+ new
@@ -17,10 +17,11 @@
## Want to help?
If you are looking to contribute to this project here are some ideas
+- MAKE THIS README BETTER!
- Build backends for other providers (zeromq, rabbitmq, disque) - currently we support pg and redis.
- Improve and properly document admin dashboard (add opt-in stats, better diagnostics into queues)
- Improve general documentation (Add examples, refine existing examples)
- Make MessageBus a nice website
- Add optional transports for websocket and shared web workers
@@ -56,10 +57,13 @@
Server to Server messaging
```ruby
message_id = MessageBus.publish "/channel", "message"
+# last id in a channel
+id = MessageBus.last_id("/channel")
+
# in another process / spot
MessageBus.subscribe "/channel" do |msg|
# block called in a background thread when message is received
end
@@ -140,17 +144,17 @@
**NOTE**: do not set proxy_buffering off globally, it may have unintended consequences.
If you wish to disable chunked encoding run:
-```
+```ruby
MessageBus.enableChunkedEncoding = false; // in your JavaScript
```
Or
-```
+```ruby
MessageBus.configure(chunked_encoding_enabled: false) // in Ruby
```
Long Polling requires no special setup, as soon as new data arrives on the channel the server delivers the data and closes the connection.
@@ -279,9 +283,27 @@
```ruby
MessageBus.configure(backend: :redis, url: "redis://:p4ssw0rd@10.0.1.1:6380/15")
```
The redis client message_bus uses is [redis-rb](https://github.com/redis/redis-rb), so you can visit it's repo to see what options you can configure.
+
+#### Data Retention
+
+Out of the box Redis keeps track of 2000 messages in the global backlog and 1000 messages in a per-channel backlog. Per-channel backlogs get cleared automatically after 7 days of inactivity.
+
+This is configurable via accessors on the ReliablePubSub instance.
+
+```ruby
+# only store 100 messages per channel
+MessageBus.reliabe_pub_sub.max_backlog_size = 100
+
+# only store 100 global messages
+MessageBus.reliabe_pub_sub.max_global_backlog_size = 100
+
+# flush per-channel backlog after 100 seconds of inactivity
+MessageBus.reliabe_pub_sub.max_backlog_age = 100
+
+```
### PostgreSQL
message_bus also supports PostgreSQL as the backend: