Scenario: Creating a container in Azure Storage - 6.3

Talend Open Studio for Big Data Components Reference Guide

EnrichVersion
6.3
EnrichProdName
Talend Open Studio for Big Data
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

In this scenario, a four-component Job uses Azure Storage components to create a container in a given Azure Storage system and check whether this container is successfully created.

Before replicating this scenario, you must have appropriate rights and permissions to read and write files in the Azure storage account to be used. For further information, see Microsoft's documentation for Azure Storage: http://azure.microsoft.com/en-us/documentation/services/storage/.

Linking the components

  1. In the Integration perspective of the Studio, create an empty Job, named azureTalend for example, from the Job Designs node in the Repository tree view.

    For further information about how to create a Job, see Talend Studio User Guide.

  2. Drop tAzureStorageConnection, tAzureStorageContainerCreate, tAzureStorageContainerExist and tJava onto the workspace.

  3. Connect them using the Trigger > OnSubjobOk link.

Connecting to an Azure storage account

  1. Double-click tAzureStorageConnection to open its Component view.

  2. In the Account name field, enter the name of the storage account to be connected to. In this example, it is talendstorage, an account that has been created for demonstration purposes.

  3. In the Account key field, paste the primary or the secondary key associated with the storage account to be used. These keys can be found in the Manage Access Key dashboard in the Azure Storage system to be connected to.

  4. From the Protocol list, select the protocol for the endpoint of the storage account to be used. In this example, it is HTTPS.

Creating a container

  1. Double-click tAzureStorageContainerCreate to open its Component view.

  2. Select the Use an existing connection check box and then select the connection you have configured earlier. In this example, it is tAzureStorageConnection_1.

  3. In the Container name field, enter the name of the container you need to create. If a container using the same name exists, that container will be overwritten at runtime.

  4. From the Access control list, select the access restriction level for the container to be created. In this example, select Private.

Verifying the creation

  1. Double-click tAzureStorageContainerExist to open its Component view.

  2. Select the Use an existing connection check box and then select the connection you have configured earlier. In this example, it is tAzureStorageConnection_1.

  3. In the Container name field, enter the name of the container you need to check whether it exists.

  4. Double-click tJava to open its Component view.

  5. In the Code field, enter

    System.out.println();
  6. In the Outline panel, which, by default, is found to the left side of the Component view, expand the tAzureStorageContainerExist node.

  7. From the Outline panel, drop the CONTAINER_EXSIT global variable into the parentheses in the code in the Component view in order to make the code read:

    System.out.println(((Boolean)globalMap.get("tAzureStorageContainerExist_1_CONTAINER_EXIST")));

Executing the Job

  • Press F6 to run this Job.

Once done, the Run view is opened automatically, where you can check the execution result.

You can read that the Job returns true as the verification result, that is to say, the talendcontainer container has been created in the storage account being used.

In the web console of the Azure storage account, you can read as well that the talendcontainer container has been created.