The gemstone.plugins module

This module provides various tools to create general use plugins for the microservice.

A plugin can override specific attributes from the BasePlugin class that will be called in specific situations.

Also, a plugin can define extra methods that can be used later inside the method calls, as shown in the following example:

@gemstone.core.exposed_method()
def say_hello(self, name):
    self.get_plugin("remote_logging").log_info("Somebody said hello to {}".format(name))
    return True

The gemstone.plugins.BasePlugin class

class gemstone.plugins.BasePlugin[source]

Base class for creating a plugin.

name = None

The name of the plugin. Must be unique per microservice.

on_internal_error(exc_instance)[source]

Called when an internal error occurs when a method was called.

Parameters:exc_instance – The caught Exception instance.
on_method_call(jsonrpc_request)[source]

Called for every method call (even in batch requests, this method will be called for every request in batch).

Parameters:jsonrpc_request – a JsonRpcRequest instance.
on_service_start()[source]

Called once when the microservice starts, after it completed all the initialization steps

on_service_stop()[source]

Called once when the microservice stops.

Exceptions

exception gemstone.plugins.PluginError[source]

Base class for plugin specific errors

exception gemstone.plugins.MissingPluginNameError[source]

Raised when a plugin does not have a properly configured name