-
Notifications
You must be signed in to change notification settings - Fork 3
Configuration
Scott Hill edited this page Jan 10, 2019
·
5 revisions
Subserver can be configured in a number of ways to best support your system.
When starting the subserver process with bundle exec subserver
subserver will start with the default
queue. This means that any Subscriber that does not specify which queue it belongs to will be loaded by this instance of Subserver. Breaking your subscribers into queues allows you to control the horizontal scaling by running multiple subserver processes.
Run subserver using
bundle exec subserver -q 'critical'
bundle exec subserver -q 'low' -q 'default'
And provide the queue in your subscriber class
class MyImportantSubscriber
include Subserver::Subscriber
subserver_options subscription: 'important-messages', queue: 'critital'
end
class MyImportantSubscriber
include Subserver::Subscriber
subserver_options subscription: 'regular-messages', queue: 'low'
end
This allows you to independently scale your critical messages based on load.
When Subserver starts a listener thread for Pub/Sub it allows configuration of the underlying Pub/Sub subscriber.
class MySubscriber
include Subserver::Subscriber
subserver_options {
subscription: 'my-subscription',
deadline: 60,
streams: 2,
threads: {
callback: 4,
push: 2
},
inventory: 1000
}
Option | Type | Description |
---|---|---|
subscription | string Required: True |
The name of the Pub/Sub topic subscription. |
deadline | numeric Required: false Default: 60 |
The number of seconds the listener will wait for message acknowlagement. |
streams | numberic Required: false Default: 2 |
The number of recieveing streams for this subscription. |
threads | hash Required: false Default: {callback: 4, push: 2} |
The number of threads for recieveing messages and pushing acknowlagement. |
inventory | numeric Required: false Default: 1000 |
The number of received messages the subscriber will hold in memory. |
queue | string Required: false Default: 'default |
The queue that the Subscriber should be loaded on. |