Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

namespace java in.shop2020.alert
namespace py shop2020.thriftpy.alert

include "GenericService.thrift"

/**
Exceptions
*/
exception AlertServiceException {
        1:string message,
        2:i32 errorCode
}

/**
Various structures
**/
enum EntityType {
        ORDER = 1,
        COURIER = 2,
        PRODUCT = 3,
        TICKET = 4
}

enum EntityProcessedState {
        UNEXPIRED = 1,
        WARNING_SENT = 2,
        CRITICAL_SENT = 3
}

enum AlertType {
        EMAIL = 1
}

struct EntityMonitoringStatus {
        1:EntityType entityType,
        2:bool isActive
        3:string userIds
}

struct MonitoredEntity {
        1:i64 id,
        2:EntityType entityType,
        3:i32 eventType,
        4:string entityIdentifier,
        5:i64 warnExpiryTime,
        6:i64 criticalExpiryTime,
        7:string description,
        8:EntityProcessedState entityProcessedState
}

struct AlertMapper {
        1:EntityType entityType,
        2:i32 eventType,
        3:string eventdesciption,
        4:AlertType alertType,
        5:string userIds
} 

struct AlertedEntity {
        1:i64 id,
        2:EntityType entityType,
        3:i32 eventType,
        4:string entityIdentifier,
        5:string description,
        6:EntityProcessedState entityProcessedState,
        7:i64 lastAlertedTime
}

struct SearchFilter {
    1:optional EntityType entityType,
    2:i32 eventType,
    3:optional string entityIdentifier,
    4:optional i64 warnExpiryTime,
    5:optional i64 criticalExpiryTime,
    6:optional EntityProcessedState entityProcessedState
}


service AlertService extends GenericService.GenericService{

        /**
        Create a new tracking object. 
        */
        void scheduleAlert(1:MonitoredEntity entity) throws (1:AlertServiceException e),
        
        /**
        Update previously stored tracking object.
        */ 
        void updateMonitoredObject(1:MonitoredEntity entity) throws (1:AlertServiceException e),
        
        /**
        Stop tracking the entity 
        */ 
        void endMonitoringEntity(1:EntityType entityType, 2:string entityIdentifier) throws (1:AlertServiceException e),
        
        /**
        Get entities with specified conditions in SearchFilter Object
        */
        list<MonitoredEntity> getEntities(1:SearchFilter searchFilter) throws (1:AlertServiceException e)
        
        /**
        Get entities with specified conditions in SearchFilter Object
        */
        list<AlertedEntity> getAlertedEntities(1:SearchFilter searchFilter) throws (1:AlertServiceException e)
        
        /**
        Get alertMap for entityType and eventType
        */
        AlertMapper getAlertMapper(1:EntityType entityType,2:i32 eventType) throws (1:AlertServiceException e)
        
        /**
        Start monitoring entityType or Update monitoring paremeters
        */
        void activateEntityMonitoring(1:EntityType entityType,2:string userIds) throws (1:AlertServiceException e)
        
        /**
        Stop monitoring entityType
        */
        void deActivateEntityMonitoring(1:EntityType entityType) throws (1:AlertServiceException e)
        
        /**
        Add AlertMap values for particular entity and event
        */
        void  registerEventType(1:AlertMapper alertMap) throws (1:AlertServiceException e)
                        
        
}