Skip to content

Multi-handler support #18

@ibnesayeed

Description

@ibnesayeed

There are use cases where having a single instance running multiple handlers can be useful. For example, a webmaster is running multiple CMS software such as WordPress, Joomla, MediaWiki, and some custom applications and is interested in providing TimeGate access to some or all of those services. Currently, the Webmaster needs to run separate handler instances for each service. Additionally, all the example handlers in the package are something that anyone can run on their servers (we don't expect that these well know services will use our code and run it to provide native Memento support, it would be awesome if they do), for instance, LANL's Memento aggregator uses all the example implementations as Memento proxies, so is ODU's Memento aggregator.

In the current setup, each instance needs to run separately on separate ports (or in separate containers), then a loadbalancer/reverse proxy needs to be setup in order to unify them under the same domain name and port while name spacing handlers based on the first path segment. Although, I like the modular micro-instance approach, but when there are too much repetitions in the architecture, sometimes it's better to make monolithic, but easier.

I am proposing the multi-handler mode in which one can keep single entries for [server] and [cache] sections in the config.ini file while introducing subsections under the [handler] section to serve multiple proxies under the same instance like this:

[server]
host = http://localhost
strict_datetime = true
api_time_out = 6

[cache]
cache_activated = false
cache_refresh_time = 86400
cache_directory = cache
cache_max_values = 250

[handler][simple]
handler_class = timegate.examples.simple:ExampleHandler
use_timemap = true
is_vcs = true
base_uri = http://www.example.com/simple/

[handler][webcite]
handler_class = timegate.examples.webcite:WebCiteHandler
use_timemap = false
is_vcs = false
base_uri = http://www.example.com/webcite/

The code should check if there are subsections under [handler] section then honor the multi-handler mode or fallback to the existing single instance mode. This way the new config style will not break the backward compatibility. I would note that the ConfigParser package does not support sub-sections, but there are several alternatives available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions