@InterfaceStability.Evolving public interface ApplicationDescriptor<S extends ApplicationDescriptor>
ApplicationDescriptor contains the description of inputs, outputs, state, configuration and the processing
logic for a SamzaApplication.
This is the base ApplicationDescriptor and provides functionality common to all SamzaApplication.
SamzaApplication.describe(S) will provide access to a StreamApplicationDescriptor with additional
functionality for describing High Level API applications. Similarly, SamzaApplication.describe(S) will provide
access to a TaskApplicationDescriptor with additional functionality for describing Low Level API
applications.
Use the ApplicationDescriptor to set the container scope context factory using
withApplicationContainerContextFactory(org.apache.samza.context.ApplicationContainerContextFactory<?>), and task scope context factory using
withApplicationTaskContextFactory(org.apache.samza.context.ApplicationTaskContextFactory<?>). Please note that the terms container and
task here refer to the units of physical and logical parallelism, not the programming API.
| Modifier and Type | Method and Description |
|---|---|
Config |
getConfig()
Get the configuration for the application.
|
S |
withApplicationContainerContextFactory(ApplicationContainerContextFactory<?> factory)
Sets the
ApplicationContainerContextFactory for this application. |
S |
withApplicationTaskContextFactory(ApplicationTaskContextFactory<?> factory)
Sets the
ApplicationTaskContextFactory for this application. |
S |
withDefaultSystem(SystemDescriptor<?> defaultSystemDescriptor)
Sets the
SystemDescriptor for the default system for the application. |
S |
withMetricsReporterFactories(java.util.Map<java.lang.String,MetricsReporterFactory> reporterFactories)
Sets the
MetricsReporterFactorys for creating the MetricsReporters to use for the application. |
S |
withProcessorLifecycleListenerFactory(ProcessorLifecycleListenerFactory listenerFactory)
Sets the
ProcessorLifecycleListenerFactory for this application. |
Config getConfig()
S withDefaultSystem(SystemDescriptor<?> defaultSystemDescriptor)
SystemDescriptor for the default system for the application.
The default system is used by the framework for creating any internal (e.g., coordinator, changelog, checkpoint)
streams. In an StreamApplication, it is also used for creating any intermediate streams; e.g., those
created by the MessageStream.partitionBy(org.apache.samza.operators.functions.MapFunction<? super M, ? extends K>, org.apache.samza.operators.functions.MapFunction<? super M, ? extends V>, org.apache.samza.serializers.KVSerde<K, V>, java.lang.String) and MessageStream.broadcast(org.apache.samza.serializers.Serde<M>, java.lang.String) operators.
If the default system descriptor is set, it must be set before creating any input/output/intermediate streams.
defaultSystemDescriptor - the SystemDescriptor for the default system for the applicationApplicationDescriptorS withApplicationContainerContextFactory(ApplicationContainerContextFactory<?> factory)
ApplicationContainerContextFactory for this application. This will be used to create one instance
of an ApplicationContainerContext for each container. All tasks in the same container will share the same
ApplicationContainerContext instance. The ApplicationContainerContext can be accessed through the
Context.
Setting this is optional.
The provided factory instance must be Serializable.
factory - the ApplicationContainerContextFactory for this applicationApplicationDescriptorS withApplicationTaskContextFactory(ApplicationTaskContextFactory<?> factory)
ApplicationTaskContextFactory for this application. Each task will be given access to a different
instance of the ApplicationTaskContext that this creates. The ApplicationTaskContext can be
accessed through the Context.
Setting this is optional.
The provided factory instance must be Serializable.
factory - the ApplicationTaskContextFactory for this applicationApplicationDescriptorS withProcessorLifecycleListenerFactory(ProcessorLifecycleListenerFactory listenerFactory)
ProcessorLifecycleListenerFactory for this application.
Setting a ProcessorLifecycleListenerFactory is optional to a user application. It allows users to plug in
optional code to be invoked in different stages before/after the main processing logic is started/stopped in the
application.
The provided factory instance must be Serializable.
listenerFactory - the user implemented ProcessorLifecycleListenerFactory that creates lifecycle
listener with callback methods before and after the start/stop of each StreamProcessor in
the applicationApplicationDescriptorS withMetricsReporterFactories(java.util.Map<java.lang.String,MetricsReporterFactory> reporterFactories)
MetricsReporterFactorys for creating the MetricsReporters to use for the application.
The provided MetricsReporterFactory instances must be Serializable.
reporterFactories - a map of MetricsReporter names to their factories.ApplicationDescriptor