Class CommitterService<T>
java.lang.Object
com.norconex.committer.core.service.CommitterService<T>
- Type Parameters:
T- type of committed objects
- All Implemented Interfaces:
Closeable,AutoCloseable
Wrapper around multiple Committers so they can all be handled as one
and facilitating integration with various clients.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CommitterService.CommitterServiceBuilder<T> builder()protected booleanvoidclean()Cleans all registered committers.voidclose()Closes all registered committers.Deletes an object using all accepting committers.boolean@NonNull Function<T, DeleteRequest> Decides, before each upsert or delete, whether the object may be sent to committers.@NonNull Function<T, UpsertRequest> inthashCode()voidinit(CommitterContext baseContext) booleantoString()Updates or inserts an object using all accepting committers.upsert(T object, @NonNull BiConsumer<Committer, String> onWithheld) Updates or inserts an object using all accepting committers, telling the caller about each committer that withheld it (see the request'swithheldReason), so the caller can try it again later.
-
Method Details
-
isOperative
public boolean isOperative() -
init
- Throws:
CommitterServiceException
-
upsert
Updates or inserts an object using all accepting committers.- Parameters:
object- the object to upsert- Returns:
- committers having accepted and upserted the object
- Throws:
CommitterServiceException- wrapper around operation failure one or more of the registered committers (wraps last exception captured)
-
upsert
public List<Committer> upsert(T object, @NonNull @NonNull BiConsumer<Committer, String> onWithheld) throws CommitterServiceExceptionUpdates or inserts an object using all accepting committers, telling the caller about each committer that withheld it (see the request'swithheldReason), so the caller can try it again later.- Parameters:
object- the object to upsertonWithheld- called with the committer and its reason, for each committer that accepted the object but withheld it- Returns:
- committers having accepted the object, whether they upserted it or withheld it
- Throws:
CommitterServiceException- wrapper around operation failure one or more of the registered committers (wraps last exception captured)
-
delete
Deletes an object using all accepting committers.- Parameters:
object- the object to delete- Returns:
- committers having accepted and deleted the object
- Throws:
CommitterServiceException- wrapper around operation failure one or more of the registered committers (wraps last exception captured)
-
close
Closes all registered committers.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
CommitterServiceException- wrapper around operation failure one or more of the registered committers (wraps last exception captured)
-
clean
Cleans all registered committers.- Throws:
CommitterServiceException- wrapper around operation failure one or more of the registered committers (wraps last exception captured)
-
toString
-
builder
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getCommitters
-
getEventManager
-
getUpsertRequestBuilder
-
getDeleteRequestBuilder
-
getSendCondition
Decides, before each upsert or delete, whether the object may be sent to committers. When it says no, the object is not sent, no event is fired, and an empty list is returned. Everything is sent by default.
-