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, json_decoder_class=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, json_decoder_class=None)[source]

Initialises remote notification log object.

Parameters:
  • base_url (str) – A URL for the HTTP API.
  • json_decoder_class (JSONDecoder) – JSON decoder class used to decode remote sections.
__getitem__(section_id)[source]

Returns a section of notification log.

Parameters:section_id (str) – ID of the section of the notification log.
Returns:Identified section of notification log.
Return type:Section
class eventsourcing.interface.notificationlog.NotificationLogView(notification_log: eventsourcing.application.notificationlog.LocalNotificationLog, json_encoder_class=None)[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_class=None)[source]

Initialises notification log view object.

Parameters:
  • notification_log (LocalNotificationLog) – A notification log object
  • json_encoder_class (JSONEncoder) – JSON encoder class
present_section(section_id)[source]

Returns a section of notification log in JSON format.

Parameters:section_id – ID of the section of the notification log.
Returns:Identified section of notification log in JSON format.
Return type:str