Interface NotificationHandler
-
- All Superinterfaces:
org.springframework.core.Ordered
- All Known Implementing Classes:
DefaultNotificationHandler
,PersistenceMessageNotificationHandler
public interface NotificationHandler extends org.springframework.core.Ordered
Notify the system about a state change for aNotificationStateAware
entity.- Author:
- Jeff Fischer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
afterSuccessfulAcknowledgement(Object nativeId, NotificationStateAware notificationStateAware, NotificationStateRepository repository)
A hook point intended to allow implementations to perform some behavior after a message has been successfully sent and theNotificationState
has been marked as acknowledged.default int
getOrder()
NotificationHandlerResponse
handle(NotificationStateRepository repo, NotificationStateAware notifiable, String messageType)
Notify the system in some way about the state change for the notifiable param.
-
-
-
Method Detail
-
handle
@NonNull NotificationHandlerResponse handle(@NonNull NotificationStateRepository repo, @NonNull NotificationStateAware notifiable, @NonNull String messageType)
Notify the system in some way about the state change for the notifiable param.If the message is successfully sent and the
NotificationState
is successfully updated as acked, thenafterSuccessfulAcknowledgement(Object, NotificationStateAware, NotificationStateRepository)
will be called.- Parameters:
repo
- The repository responsible for making the state change.notifiable
- The Trackable entity that experienced the state change.messageType
- The type of the message. Generally compared against the message type supported by this handler. For example,DefaultNotificationHandler#messageType
.- Returns:
- Whether or not the call was handled and if the handler processing chain should continue
-
afterSuccessfulAcknowledgement
default void afterSuccessfulAcknowledgement(@NonNull Object nativeId, @NonNull NotificationStateAware notificationStateAware, @NonNull NotificationStateRepository repository)
A hook point intended to allow implementations to perform some behavior after a message has been successfully sent and theNotificationState
has been marked as acknowledged.Should not directly mutate the given
notificationStateAware
instance.By default, it does nothing.
- Parameters:
nativeId
- the native id of thenotificationStateAware
entitynotificationStateAware
- the containing entity of the notification state for which a message was successfully sentrepository
- the repository corresponding to thenotificationStateAware
entity
-
getOrder
default int getOrder()
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
-