Interface ITaskManager2
interface ITaskManager2
Extends ITaskManager
Extension of ITaskManager with operations scoped to a running Task instance.
Provides methods to retrieve the IMessage that triggered a Task and to submit
execution results.
Methods
tryGetMessageTrigger()
Get thecom.amazon.kepler.messaging.IMessage?tryGetMessageTrigger(TaskExecutionInfo*taskExecutionInfo)
IMessage that triggered this Task. The Task must have been scheduled with a Message
trigger constraint. Any payload supplied by the sender can be retrieved from the message’s
attachment.
Note that payloads are not persisted across restarts or reboots.
Note that once a terminal TaskCompletionStatus has been submitted via submitResult, the
triggering IMessage is not guaranteed to remain available; callers should retrieve any
needed payload before submitting a terminal result.
Parameters
taskExecutionInfo
TaskExecutionInfo* — Required
The TaskExecutionInfo identifying the running Task.
Returns
com.amazon.kepler.messaging.IMessage?
The return value is optional and might be absent.
The optional IMessage that triggered this Task, null if it was not triggered by a
Message.
Throws
com.amazon.apmf.InvalidArgumentError— If the taskExecutionInfo is invalid.com.amazon.apmf.SecurityError— If the client is not allowed to query the task.com.amazon.apmf.BaseError— For all other errors.
submitResult()
Submit the result of Task execution to the Task Manager. It is required to post a terminalvoidsubmitResult(TaskExecutionInfo*taskExecutionInfo,ITaskResult*taskResult)
TaskCompletionStatus to indicate that the Task is done.
Note that this call is idempotent with respect to terminal results: once a terminal
TaskCompletionStatus has been submitted for a Task, submitting a further result for the same
TaskExecutionInfo is a silent no-op and does not throw.
Parameters
taskExecutionInfo
TaskExecutionInfo* — Required
The TaskExecutionInfo identifying the running Task.
taskResult
ITaskResult* — Required
The intermediate or final Task Result.
Throws
com.amazon.apmf.InvalidArgumentError— If the taskExecutionInfo or taskResult is invalid.com.amazon.apmf.SecurityError— If the client is not allowed to submit the task.com.amazon.apmf.BaseError— For all other errors.

