T
- as Token
typeN
- as notification message type like email, SMS, Voice etc.public abstract class AbstractTokenNotificationListener<T extends Token<T>,N> extends SynchronousTokenChangeEventSupplierBackedListener<T,MessageTokenEvent<T>>
Modifier and Type | Field and Description |
---|---|
protected AbstractNotificationHelper<T> |
notificationHelper |
Constructor and Description |
---|
AbstractTokenNotificationListener() |
Modifier and Type | Method and Description |
---|---|
protected abstract List<N> |
createNotifications(MessageTokenEvent<T> event,
String timeStampId)
Create Notifications N and add to List of final Notifications to send.
|
protected String |
deriveMessageId(MessageTokenEvent<T> e,
T token,
String timeStampId) |
protected abstract void |
dispatch(List<N> messages)
Raw dispatch of messages without
Feedback processing |
protected void |
dispatch(List<N> messages,
List<MessageTokenEvent<T>> events,
TokenEvent<T> parentEvent) |
AbstractNotificationHelper<T> |
getNotificationHelper() |
protected void |
onError(MessageTokenEvent<T> event,
T token,
Throwable err)
On error while sending notification
|
protected void |
onEventSupplierGenEvents(Supplier<List<MessageTokenEvent<T>>> eventsSupplier,
TokenEvent<T> parentEvent) |
protected void |
onSuccess(MessageTokenEvent<T> event,
T token)
On notification successfully sent
|
protected void |
preProcessNotificationEvents(List<MessageTokenEvent<T>> events)
Opportunity to update tokens with things like missing contact
Consumer data etc. |
void |
setNotificationHelper(AbstractNotificationHelper<T> notificationHelper) |
protected abstract T |
tokenFromPayloadException(PayLoadException err)
When calling
dispatch(List) a PartialTransactionException with PartialTransactionException.getFailed()
is a List of PayLoadException . |
getTokenEventSupplier, onSynchChange, setTokenEventSupplier
onChange
protected AbstractNotificationHelper<T extends Token<T>> notificationHelper
protected void preProcessNotificationEvents(List<MessageTokenEvent<T>> events)
Consumer
data etc. in bulk.events
- as List
of MessageTokenEvent
protected void onEventSupplierGenEvents(Supplier<List<MessageTokenEvent<T>>> eventsSupplier, TokenEvent<T> parentEvent)
onEventSupplierGenEvents
in class SynchronousTokenChangeEventSupplierBackedListener<T extends Token<T>,MessageTokenEvent<T extends Token<T>>>
protected abstract List<N> createNotifications(MessageTokenEvent<T> event, String timeStampId)
notifications
- as List
of type event
- as MessageTokenEvent
timeStampId
- as String for batch of notificationsMessageTokenEvent
protected abstract T tokenFromPayloadException(PayLoadException err)
dispatch(List)
a PartialTransactionException
with PartialTransactionException.getFailed()
is a List
of PayLoadException
. This payload object is defined by the overriding class and should contain a reference to the Token
,
hence it knows best how to extract the Token
.err
- as PayLoadException
Token
type protected void dispatch(List<N> messages, List<MessageTokenEvent<T>> events, TokenEvent<T> parentEvent)
protected void onSuccess(MessageTokenEvent<T> event, T token)
event
- as MessageTokenEvent
token
- as Token
type protected void onError(MessageTokenEvent<T> event, T token, Throwable err)
event
- as MessageTokenEvent
token
- as Token
type err
- as Throwable
protected abstract void dispatch(List<N> messages) throws PartialTransactionException, Exception
Feedback
processingmessages
- PartialTransactionException
Exception
protected String deriveMessageId(MessageTokenEvent<T> e, T token, String timeStampId)
public AbstractNotificationHelper<T> getNotificationHelper()
public void setNotificationHelper(AbstractNotificationHelper<T> notificationHelper)
Copyright © 2018. All rights reserved.