workflow.activity
Modules
Module workflow.activity
ballerina/workflow.activity Ballerina library
Functions
callRestAPI
function callRestAPI(Client connection, RestMethod method, string path, Request|map<json>|json|xml|string|byte[]? message, map<string|string[]>? headers, typedesc<anydata> t) returns t|errorCalls a REST API as a workflow activity.
The connection argument must be a module-level final http:Client
variable in the user's program. The compiler plugin generates the wiring
that makes it available on the activity worker side.
Parameters
- connection Client - The HTTP client to use for the call
- method RestMethod - HTTP method to invoke
- path string (default "") - Resource path appended to the client's base URL
- t typedesc<anydata> (default <>) - Expected payload type (inferred from context). The HTTP client performs data binding into this type.
Return Type
- t|error - Response payload as
t, or an error
callSoapAPI
function callSoapAPI(Client|Client connection, xml body, string? action, map<string|string[]> headers, string path) returns xml|errorCalls a SOAP endpoint as a workflow activity.
The connection argument must be a module-level final soap11:Client or
soap12:Client variable in the user's program. Both SOAP 1.1 and 1.2 clients
are supported. The action parameter is required for SOAP 1.1 and optional
for SOAP 1.2.
sendEmail
function sendEmail(SmtpClient connection, string|string[] to, string subject, string 'from, string body, EmailOptions? options) returns error?Sends an email as a workflow activity.
The connection argument must be a module-level final email:SmtpClient
variable in the user's program. The activity sends the email using the
email:SmtpClient.send() method.
Parameters
- connection SmtpClient - The SMTP client to use for sending
- subject string - Subject line of the email
- 'from string - From address of the email
- body string - Plain-text body of the email
- options EmailOptions? (default ()) - Optional email fields:
htmlBody,contentType,headers,cc,bcc,replyTo, andsender
Return Type
- error? - An error if sending fails, otherwise
()
Enums
workflow.activity: RestMethod
HTTP method supported by the callRestAPI builtin activity.
Members
Records
workflow.activity: EmailOptions
Additional email options for sendEmail.
Maps to the email:Options inclusive record accepted by email:SmtpClient.send().
All fields are optional; omitting a field leaves that aspect of the email unset.
Fields
- htmlBody? string - Optional HTML body (sent alongside the plain-text body)
- contentType? string - MIME content type override (default:
text/plain)
- sender? string - Sender address (used when the envelope sender differs from
From)
Import
import ballerina/workflow.activity;Metadata
Released date: 5 days ago
Version: 0.10.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.13.6
GraalVM compatible: No
Pull count
Total: 10919
Current verison: 418
Weekly downloads
Keywords
workflow
Type/Library
Contributors