Interface ITaskComponent
interface ITaskComponent
Extends com.amazon.apmf.IStandard
A task lifecycle component, like a service component, runs work in the background which is not
visible to the user but does so in a “run to completion” manner.
Methods
onStart()
This callback is invoked after a component instance has been successfully launched. Task components begin their work when this callback is invoked. If the component is unable to complete its callback successfully, it may throw an exception. Exceptions lead to application termination.voidonStart(com.amazon.kepler.runtime.IComponentInstance*instance,com.amazon.kepler.messaging.IMessage*message)
Parameters
instance
com.amazon.kepler.runtime.IComponentInstance* — Required
An object representing this instance of the component.
message
com.amazon.kepler.messaging.IMessage* — Required
The message which resulted in this instance of the component being launched.
onStop()
This callback is invoked when a component instance is going to be stopped; its process may be terminated at any point after this callback is invoked. Note that under most circumstances the component receives this callback before termination, but under some circumstances the process may be forcefully killed before this callback can be invoked. For instance, a component may be forcefully killed if the device is under critical memory pressure and needs to quickly reclaim resources or if the component fails to respond to callbacks in a timely manner. If the component is unable to complete its callback successfully, it may throw an exception. Exceptions lead to application termination.voidonStop(com.amazon.kepler.runtime.IComponentInstance*instance)
Parameters
instance
com.amazon.kepler.runtime.IComponentInstance* — Required
An object representing this instance of the component.
onNewLaunch()
This callback is invoked when a request to launch a task component is received while an instance of the task component is already running. If the component is unable to complete its callback successfully, it may throw an exception. Exceptions lead to application termination.voidonNewLaunch(com.amazon.kepler.runtime.IComponentInstance*instance,com.amazon.kepler.messaging.IMessage*message)
Parameters
instance
com.amazon.kepler.runtime.IComponentInstance* — Required
An object representing this instance of the component.
message
com.amazon.kepler.messaging.IMessage* — Required
The message which resulted in this instance of the component being re-launched.

