interface¶
The interface layer uses an application to service client requests.
notificationlog¶
Notification log is a pull-based mechanism for updating other applications.
-
class
eventsourcing.interface.notificationlog.
RemoteNotificationLog
(base_url: str, json_decoder_class: Optional[Type[json.decoder.JSONDecoder]] = None)[source]¶ Bases:
eventsourcing.application.notificationlog.AbstractNotificationLog
Presents notification log sections retrieved an HTTP API that presents notification log sections in JSON format, for example by using a NotificationLogView.
-
__init__
(base_url: str, json_decoder_class: Optional[Type[json.decoder.JSONDecoder]] = None)[source]¶ Initialises remote notification log object.
Parameters: - base_url (str) – A URL for the HTTP API.
- json_decoder_class (JSONDecoder) – used to deserialize remote sections.
-
section_size
¶ Size of section of notification log.
-
-
class
eventsourcing.interface.notificationlog.
NotificationLogView
(notification_log: eventsourcing.application.notificationlog.LocalNotificationLog, json_encoder: eventsourcing.utils.transcoding.ObjectJSONEncoder)[source]¶ Bases:
object
Presents sections of a notification log in JSON format.
Can be used to make an HTTP API that can be used remotely, for example by a RemoteNotificationLog.
-
__init__
(notification_log: eventsourcing.application.notificationlog.LocalNotificationLog, json_encoder: eventsourcing.utils.transcoding.ObjectJSONEncoder)[source]¶ Initialises notification log view object.
Parameters: - notification_log – A notification log object
- json_encoder_class – JSON encoder class
-
present_resource
(name: str) → bytes[source]¶ Returns a resource of the notification log in JSON format.
Supports returning section of the notification log.
Also supports returning section_size of notification log, if section_id has special value ‘section_size’.
Parameters: name – Name of the resource, e.g. a section ID. Returns: Identified resource of notification log view in JSON format.
-