public class TokenLoader extends Object
NotificationRouter.
Loads device token batches from a database and queues them for processing inside a message holder.
TokenLoader uses result stream with configured fetch size so that it can split database results into several batches.| Constructor and Description |
|---|
TokenLoader() |
| Modifier and Type | Method and Description |
|---|---|
void |
loadAndQueueTokenBatch(MessageHolderWithVariants msg)
Receives request for processing a
UnifiedPushMessage and loads tokens for devices that match requested parameters from database. |
public void loadAndQueueTokenBatch(@Observes
MessageHolderWithVariants msg)
throws IllegalStateException
UnifiedPushMessage and loads tokens for devices that match requested parameters from database.
Device tokens are loaded in a stream and split to batches of configured size (see SenderConfiguration.batchSize()).
Once the pre-configured number of batches (see SenderConfiguration.batchesToLoad()) is reached, this method resends message to the same queue it took the request from,
so that the transaction it worked in is split and further processing may continue in next transaction.
Additionally it fires BatchLoadedEvent as CDI event (that is translated to JMS event).
When all batches were loaded for the given variant, it fires AllBatchesLoadedEvent.msg - holder object containing the payload and info about the effected variantsIllegalStateExceptionCopyright © 2018 JBoss by Red Hat. All rights reserved.