Fx.function

Fx.function:函数调用相关的API

1. 同步执行控制器函数

Fx.function.executeFunc(<String functionApiName>, <Map param>)

参数说明

参数 类型 说明
functionApiName String 需要执行的函数apiName
param Map 执行函数时传入的参数

返回值类型

APIResult

返回值说明

Object

Java举例

Map keyValue = Maps.of(
        "key1", "value1",
        "key2", "value2"
);

Map param = Maps.of(
        "map", keyValue
);
final APIResult ret = Fx.function.executeFunc("funcCalled__c", param);
Fx.log.info(ret.getData());

Groovy举例

Map keyValue = [
"key1":"value1",
"key2":"value2"
]

Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.executeFunc("funcCalled__c",param)
Fx.log.info(result)

2. 异步执行控制器函数

Fx.function.executeAsyncFunc(<String functionApiName>, <Map param>)

参数说明

参数 类型 说明
functionApiName String 需要执行的函数apiName
param Map 执行函数时传入的参数

返回值类型

APIResult

返回值说明

String

Java举例

Map keyValue = Maps.of(
        "key1", "value1",
        "key2", "value2"
);

Map param = Maps.of(
        "map", keyValue
);
final APIResult ret = Fx.function.executeAsyncFunc("funcCalled__c",param);
Fx.log.info(ret.getData());

Groovy举例

Map keyValue = [
"key1":"value1",
"key2":"value2"
]

Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.executeAsyncFunc("funcCalled__c",param)
Fx.log.info(result)

3. 顺序执行异步控制器函数

Fx.function.executeOrderlyAsyncFunc(<String functionApiName>, <Map param>)

参数说明

参数 类型 说明
functionApiName String 需要执行的函数apiName
param Map 执行函数时传入的参数

返回值类型

APIResult

返回值说明

String,后台异步任务Id

Java举例

Map keyValue = Maps.of(
        "key1", "value1",
        "key2", "value2"
);

Map param = Maps.of(
        "map", keyValue
);
final APIResult ret = Fx.function.executeOrderlyAsyncFunc("funcCalled__c",param);
Fx.log.info(ret.getData());

Groovy举例

Map keyValue = [
"key1":"value1",
"key2":"value2"
]

Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.executeOrderlyAsyncFunc("funcCalled__c",param)
Fx.log.info(result)

4. 定时执行控制器函数

Fx.function.ontimeFunc(<String functionApiName>, <Map param>, <String runTime>)

参数说明

参数 类型 说明
functionApiName String 需要执行的函数apiName
param Map 执行函数时传入的参数
runTime String 定时执行的时间

返回值类型

APIResult

返回值说明

String,后台异步任务Id

Java举例

Map keyValue = Maps.of(
        "key1", "value1",
        "key2", "value2"
);

Map param = Maps.of(
        "map", keyValue
);
final APIResult ret = Fx.function.ontimeFunc("funcCalled__c",param,"100");

Groovy举例

Map keyValue = [
"key1":"value1",
"key2":"value2"
]

Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.ontimeFunc("funcCalled__c",param,"2021-05-03 00:00:00")

5. 使用独立的队列执行异步任务,不影响其他异步任务的执行(需要单独付费)

Fx.function.asyncOnVipQueue(<String functionApiName>, <Map param>)

参数说明

参数 类型 说明
functionApiName String 需要执行的函数apiName
param Map 执行函数时传入的参数

返回值类型

APIResult

返回值说明

String 函数执行的traceId

Java举例

Map keyValue = Maps.of(
    "a", 123,
    "b", "sdte"
);
Map param = Maps.of(
    "map", keyValue
);
final APIResult ret = Fx.function.executeFunc("func_U4Oqt__c", param);
Fx.log.info(ret.getData());

Groovy举例

Map param = [
  "map":[
    "a": 123,
    "b": "sdte"
  ]
]

def (Boolean error, String traceId, String message) = Fx.function.asyncOnVipQueue("func_U4Oqt__c", param)
if (error) {
  log.info("error :" + message)
}
log.info(traceId)

2023-03-17
4 4