Proxy that allows a CA to call an external app.
- Source:
Extends
Methods
call(fqn, fromopt, method, args, tokenStropt, maxRetriesopt) → {string}
- Source:
Calls in a transactional way a CA method of an external application.
The action is checkpointed first, executing at least once. Calls do not block message processing for this CA, and responses can be arbitrarily interleaved with new requests.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fqn |
string | A fully qualified CA name for the target, e.g.,
|
|
from |
string |
<optional> |
A client CA name for the request, e.g.,
|
method |
string | The CA's method to invoke. |
|
args |
Array.<jsonType> | Arguments for the method invocation.
When the method requires fewer arguments, the extra arguments are
ignored (if the |
|
tokenStr |
string |
<optional> |
An optional serialized token for the
request that authenticates the client described in |
maxRetries |
number |
<optional> |
Number of retries before giving up. The default is to retry forever. |
Throws:
-
When arguments are invalid.
- Type
- Error
Returns:
A unique identifier to match replies for this request.
- Type
- string
dirtyCall(fqn, fromopt, method, args, tokenStropt, maxRetriesopt) → {Promise.<Array.<Object>>}
- Source:
Calls in a non-transactional way a CA method of an external application.
There is no checkpointing for this action, and this call may never be executed if, e.g., the server fails.
Using await
on the returned promise we can stop processing new
messages for this CA until the response arrives.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fqn |
string | A fully qualified CA name for the target, e.g.,
|
|
from |
string |
<optional> |
A client CA name for the request, e.g.,
|
method |
string | The CA's method to invoke. |
|
args |
Array.<jsonType> | Arguments for the method invocation.
When the method requires fewer arguments, the extra arguments are
ignored (if the |
|
tokenStr |
string |
<optional> |
An optional serialized token for the
request that authenticates the client described in |
maxRetries |
number |
<optional> |
Number of retries before giving up. The default is to retry forever. |
Throws:
-
When arguments are invalid.
- Type
- Error
Returns:
A promise that we can await
to
block further message processing. This array is a tuple using the
standard [Error, jsonType]
CAF.js convention. The Error
has
a boolean field isSystemError
set to true
when the session was
closed with an error, and false
when it was an application error.
- Type
- Promise.<Array.<Object>>
dirtyIsAppRunning(app) → {Promise.<boolean>}
- Source:
Checks whether an app is running.
The check is non-transactional and blocks the processing of the
current message by using await
on the returned promise.
Parameters:
Name | Type | Description |
---|---|---|
app |
string | An app name, e.g., |
Returns:
A promise that resolves to true
if
the app is running, false
otherwise.
- Type
- Promise.<boolean>
setHandleReplyMethod(methodName)
- Source:
Sets the name of the method in this CA that will process reply call messages.
To ignore replies, just set it to null
.
The type of the method is async function(requestId, response)
where:
requestId
: is an unique identifier to match the request.response
is a tuple using the standard[Error, jsonType]
CAF.js convention. TheError
has a boolean fieldisSystemError
set totrue
when the session was closed with an error, andfalse
when it was an application error.
Parameters:
Name | Type | Description |
---|---|---|
methodName |
string | null | The name of this CA's method that process replies. |