Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

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()

void onStart(com.amazon.kepler.runtime.IComponentInstance* instance, com.amazon.kepler.messaging.IMessage* message)
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.

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()

void onStop(com.amazon.kepler.runtime.IComponentInstance* instance)
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.

Parameters

instance
com.amazon.kepler.runtime.IComponentInstance* — Required An object representing this instance of the component.

onNewLaunch()

void onNewLaunch(com.amazon.kepler.runtime.IComponentInstance* instance, com.amazon.kepler.messaging.IMessage* message)
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.

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.
Last modified on October 29, 2026