registerActivityType method
- required String domain,
- required String name,
- required String version,
- String? defaultTaskHeartbeatTimeout,
- TaskList? defaultTaskList,
- String? defaultTaskPriority,
- String? defaultTaskScheduleToCloseTimeout,
- String? defaultTaskScheduleToStartTimeout,
- String? defaultTaskStartToCloseTimeout,
- String? description,
Registers a new activity type along with its configuration settings in the specified domain. Access Control
You can use IAM policies to control this action's access to Amazon SWF resources as follows:
-
Use a
Resourceelement with the domain name to limit the action to only specified domains. -
Use an
Actionelement to allow or deny permission to call this action. -
Constrain the following parameters by using a
Conditionelement with the appropriate keys.-
defaultTaskList.name: String constraint. The key isswf:defaultTaskList.name. -
name: String constraint. The key isswf:name. -
version: String constraint. The key isswf:version.
-
cause parameter is
set to OPERATION_NOT_PERMITTED. For details and example IAM
policies, see Using
IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF
Developer Guide.
May throw TypeAlreadyExistsFault. May throw LimitExceededFault. May throw UnknownResourceFault. May throw OperationNotPermittedFault.
Parameter domain :
The name of the domain in which this activity is to be registered.
Parameter name :
The name of the activity type within the domain.
The specified string must not start or end with whitespace. It must not
contain a : (colon), / (slash), |
(vertical bar), or any control characters (\u0000-\u001f |
\u007f-\u009f). Also, it must not be the literal
string arn.
Parameter version :
The version of the activity type.
The specified string must not start or end with whitespace. It must not
contain a : (colon), / (slash), |
(vertical bar), or any control characters (\u0000-\u001f |
\u007f-\u009f). Also, it must not be the literal
string arn.
Parameter defaultTaskHeartbeatTimeout :
If set, specifies the default maximum time before which a worker
processing a task of this type must report progress by calling
RecordActivityTaskHeartbeat. If the timeout is exceeded, the
activity task is automatically timed out. This default can be overridden
when scheduling an activity task using the
ScheduleActivityTask Decision. If the activity worker
subsequently attempts to record a heartbeat or returns a result, the
activity worker receives an UnknownResource fault. In this
case, Amazon SWF no longer considers the activity task to be valid; the
activity worker should clean up the activity task.
The duration is specified in seconds, an integer greater than or equal to
0. You can use NONE to specify unlimited
duration.
Parameter defaultTaskList :
If set, specifies the default task list to use for scheduling tasks of
this activity type. This default task list is used if a task list isn't
provided when a task is scheduled through the
ScheduleActivityTask Decision.
Parameter defaultTaskPriority :
The default task priority to assign to the activity type. If not assigned,
then 0 is used. Valid values are integers that range from
Java's Integer.MIN_VALUE (-2147483648) to
Integer.MAX_VALUE (2147483647). Higher numbers indicate
higher priority.
For more information about setting task priority, see Setting Task Priority in the in the Amazon SWF Developer Guide..
Parameter defaultTaskScheduleToCloseTimeout :
If set, specifies the default maximum duration for a task of this activity
type. This default can be overridden when scheduling an activity task
using the ScheduleActivityTask Decision.
The duration is specified in seconds, an integer greater than or equal to
0. You can use NONE to specify unlimited
duration.
Parameter defaultTaskScheduleToStartTimeout :
If set, specifies the default maximum duration that a task of this
activity type can wait before being assigned to a worker. This default can
be overridden when scheduling an activity task using the
ScheduleActivityTask Decision.
The duration is specified in seconds, an integer greater than or equal to
0. You can use NONE to specify unlimited
duration.
Parameter defaultTaskStartToCloseTimeout :
If set, specifies the default maximum duration that a worker can take to
process tasks of this activity type. This default can be overridden when
scheduling an activity task using the ScheduleActivityTask
Decision.
The duration is specified in seconds, an integer greater than or equal to
0. You can use NONE to specify unlimited
duration.
Parameter description :
A textual description of the activity type.
Implementation
Future<void> registerActivityType({
required String domain,
required String name,
required String version,
String? defaultTaskHeartbeatTimeout,
TaskList? defaultTaskList,
String? defaultTaskPriority,
String? defaultTaskScheduleToCloseTimeout,
String? defaultTaskScheduleToStartTimeout,
String? defaultTaskStartToCloseTimeout,
String? description,
}) async {
ArgumentError.checkNotNull(domain, 'domain');
_s.validateStringLength(
'domain',
domain,
1,
256,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
256,
isRequired: true,
);
ArgumentError.checkNotNull(version, 'version');
_s.validateStringLength(
'version',
version,
1,
64,
isRequired: true,
);
_s.validateStringLength(
'defaultTaskHeartbeatTimeout',
defaultTaskHeartbeatTimeout,
0,
8,
);
_s.validateStringLength(
'defaultTaskScheduleToCloseTimeout',
defaultTaskScheduleToCloseTimeout,
0,
8,
);
_s.validateStringLength(
'defaultTaskScheduleToStartTimeout',
defaultTaskScheduleToStartTimeout,
0,
8,
);
_s.validateStringLength(
'defaultTaskStartToCloseTimeout',
defaultTaskStartToCloseTimeout,
0,
8,
);
_s.validateStringLength(
'description',
description,
0,
1024,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'SimpleWorkflowService.RegisterActivityType'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'domain': domain,
'name': name,
'version': version,
if (defaultTaskHeartbeatTimeout != null)
'defaultTaskHeartbeatTimeout': defaultTaskHeartbeatTimeout,
if (defaultTaskList != null) 'defaultTaskList': defaultTaskList,
if (defaultTaskPriority != null)
'defaultTaskPriority': defaultTaskPriority,
if (defaultTaskScheduleToCloseTimeout != null)
'defaultTaskScheduleToCloseTimeout':
defaultTaskScheduleToCloseTimeout,
if (defaultTaskScheduleToStartTimeout != null)
'defaultTaskScheduleToStartTimeout':
defaultTaskScheduleToStartTimeout,
if (defaultTaskStartToCloseTimeout != null)
'defaultTaskStartToCloseTimeout': defaultTaskStartToCloseTimeout,
if (description != null) 'description': description,
},
);
}