Functions
getDeadline | I Returns the deadline value as |
getHeader | I Returns the header value with the specified header name. |
getHeaders | I Gets all the transport headers with the specified header name. |
isCancelled | I Checks whether the deadline is already exceeded or not. |
setDeadline | I Enables the deadline by adding the |
getDeadline
Returns the deadline value as time:Utc
. This can be used to get the deadline and propagate it to subsequent internal calls.
1time:Utc?|time:Error deadline = grpc:getDeadline(map<string|string[]> headerMap);
Return Type
(Utc? | Error)deadline
value when the deadline is correctly specified, ()
when the deadline is not specified, or else a time:Error
when a deadline
-parsing error occurred
getHeader
Returns the header value with the specified header name. If there are more than one header values for the specified header name, the first value is returned.
1map<string|string[]> headerMap = request.headers;2string|grpc:Error result = grpc:getHeader(headerMap, "content-type");
Parameters
- headerName string
The header name
getHeaders
Gets all the transport headers with the specified header name.
1map<string|string[]> headerMap = request.headers;2string[]|grpc:Error result = grpc:getHeaders(headerMap, "content-type");
Parameters
- headerName string
The header name
isCancelled
Checks whether the deadline is already exceeded or not.
1boolean|time:Error isCancelled = grpc:isCancelled(map<string|string[]> headerMap);
Return Type
(boolean | Error)true
when the deadline is exceeded, false
when the deadline is not exceeded, or else a time:Error
when a deadline
-parsing error occurred
setDeadline
function setDeadline(Utc deadline, map<string | string[ ]> headerMap) returns map<string | string[ ]>
Enables the deadline by adding the deadline
header to the given headers.
1time:Utc current = time:utcNow();2time:Utc deadline = time:utcAddSeconds(current, 300);3map<string|string[]> headers = grpc:setDeadline(deadline);
Parameters
- deadline Utc
The deadline time value (this should be a specific time and not a duration)