public interface ApplicationTaskContext
ApplicationTaskContext
instance can be used for holding per-task runtime state and objects and managing
their lifecycle in an SamzaApplication
Use ApplicationDescriptor.withApplicationTaskContextFactory(org.apache.samza.context.ApplicationTaskContextFactory<?>)
to provide the
ApplicationTaskContextFactory
. Use Context.getApplicationTaskContext()
to get the created
ApplicationTaskContext
instance for the current task.
A unique instance of ApplicationTaskContext
is created for each task in a container. Use the
ApplicationTaskContextFactory
to create any runtime state and objects, and the
start()
and stop()
methods to manage their lifecycle.
Use ApplicationContainerContext
to hold runtime state and objects shared across all tasks within a container.
Use TaskContext
to access framework-provided context for a task.
Unlike its ApplicationTaskContextFactory
, an implementation does not need to be Serializable
.
Modifier and Type | Method and Description |
---|---|
void |
start()
Starts this
ApplicationTaskContext after its task is initialized but before any messages are processed. |
void |
stop()
Stops this
ApplicationTaskContext after processing ends but before its task is closed. |
void start()
ApplicationTaskContext
after its task is initialized but before any messages are processed.
If this throws an exception, the container will fail to start.
void stop()
ApplicationTaskContext
after processing ends but before its task is closed.
If this throws an exception, the container will fail to fully shut down.