Outbound Adapter for Cloud Storage
A business operation in an interoperability production can use the outbound adapter to delete a blob from cloud storage or upload a new blob. Like all business operations, the business operation performs these actions by calling one of the adapter's methods. For information about the properties of the adapter that allow it to connect to the cloud storage provider, see More About Adapters.
The ObjectScript class of the outbound adapter is EnsLib.CloudStorage.OutboundAdapterOpens in a new tab.
A business operation deletes an blob from cloud storage by calling the DeleteBlobOpens in a new tab method of the outbound adapter. For example, the business operation could call:
Set tSC = ..Adapter.DeleteBlob(..BucketName, request.BlobName)
In this example, the business operation uses a property to identify the cloud storage bucket and the production uses a request message to provide the name of the blob being deleted.
The outbound adapter provides three different methods for uploading blobs, depending on the source or data type of the data:
UploadBlobFromStreamOpens in a new tab — Accepts data as a %Stream.Object
UploadBlobFromStringOpens in a new tab — Accepts data as a String
UploadBlobFromFileOpens in a new tab — Retrieves data from the file system
The first two parameters of each method specify the bucket name and blob name. The third parameter of each method is used to receive the data or location of the data from the business operation. For example, a business operation that receives a message containing data as a Stream could call:
Set tSC = ..Adapter.UploadBlobFromStream(..BucketName, request.BlobName, request.Content)
Creating a Business Operation
Most properties used to connect to cloud storage are defined in the outbound adapter. However, the actual bucket name that the production wants to work with must be defined in the business operation and passed to the adapter methods. Commonly, the business operation uses a property that appears in the Management Portal to define the bucket name.
If you need general guidance on developing a custom business operation, see Defining Business Operations.
For your convenience, InterSystems provides a simple business operation, EnsLib.CloudStorage.BusinessOperationOpens in a new tab, that demonstrates how to delete a blob and upload a blob from a stream. This sample business operation uses two simple message classes, EnsLib.CloudStorage.DeleteRequest and EnsLib.CloudStorage.UploadRequest to delete and upload blobs.