Class DefaultTaskRepository
java.lang.Object
com.mulesoft.connectors.a2a.internal.server.agent.repository.DefaultTaskRepository
- All Implemented Interfaces:
TaskRepository
Default implementation of TaskRepository that manages task data and push notification configs.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTaskRepository(org.mule.runtime.api.store.ObjectStore<TaskRepositoryItem> taskObjectStore, org.mule.runtime.api.lock.LockFactory lockFactory, String ownerConfigName) -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies a function to a task within a transactional context, ensuring thread-safe access to the task data.voidclose()voidvoidupsert(String taskId, TaskRepositoryItem item)
-
Constructor Details
-
DefaultTaskRepository
public DefaultTaskRepository(org.mule.runtime.api.store.ObjectStore<TaskRepositoryItem> taskObjectStore, org.mule.runtime.api.lock.LockFactory lockFactory, String ownerConfigName)
-
-
Method Details
-
upsert
public void upsert(String taskId, TaskRepositoryItem item) throws org.mule.runtime.api.store.ObjectStoreException - Specified by:
upsertin interfaceTaskRepository- Throws:
org.mule.runtime.api.store.ObjectStoreException
-
get
public Optional<TaskRepositoryItem> get(String taskId) throws org.mule.runtime.api.exception.ObjectNotFoundException, org.mule.runtime.api.store.ObjectStoreException - Specified by:
getin interfaceTaskRepository- Throws:
org.mule.runtime.api.exception.ObjectNotFoundExceptionorg.mule.runtime.api.store.ObjectStoreException
-
remove
- Specified by:
removein interfaceTaskRepository- Throws:
org.mule.runtime.api.store.ObjectStoreException
-
apply
Description copied from interface:TaskRepositoryApplies a function to a task within a transactional context, ensuring thread-safe access to the task data. This method provides atomic operations on task data by executing the provided function within a synchronized block or transaction boundary.The apply method is designed to handle concurrent access scenarios where multiple operations might need to read, modify, and write task data atomically. It ensures that the entire operation (read-modify-write cycle) is executed as a single unit, preventing race conditions and data inconsistencies.
- Specified by:
applyin interfaceTaskRepository- Parameters:
taskId- the unique identifier of the task to operate on. Must not be null or empty.function- the function to execute within the transactional context. The function will be executed with exclusive access to the specified task, ensuring thread safety. Must not be null.
-
close
public void close()- Specified by:
closein interfaceTaskRepository
-