Using the Cassandra Insert Rows Activity
Use the Insert Rows Activity to insert records in the existing tables in Cassandra.
About this task
Use this task to insert rows in the Cassandra. The call to this Activity is a synchronous call where the input data is sent to the Activity for processing and the response is sent back to the orchestration.
Procedure
- In an active orchestration, open the Activities tab and expand the Cassandra folder contents.
- Drag the Insert Rows activity icon onto the orchestration. Select the activity. The Cassandra Insert Activity Checklist is displayed.
- In the checklist, click Summary.
- Review the contents of the Activity Name field, and make the required changes.
- In the checklist, click Pick Endpoint.
- Click Browse and use the Project Explorer dialog box to select the relevant Cassandra endpoint.
- Optional: You can create the endpoint by clicking New and specifying the required connection details. Click OK to save and use the endpoint for this configuration.
- To make required changes to the selected endpoint configuration, click Edit to access the options in a separate window. Any changes you make globally affects all uses of the endpoint in active orchestrations.
- In the checklist, click Configure.
- Under Configure, click PickTable and provide
Keyspace name. Click Browse to dynamically select a
table from the current list of tables in the database specified by the Endpoint.
To select a table, choose one of the following options:
- Click on a table in the list and click OK.
- Provide the table name in the ‘Filter Table’ section and click on search button.
Note: In the Pick Table section the checkbox ‘Update row if row already exists (not applicable for batch)’ helps to update the existing values in the table. If the checkbox is checked then, if a record with same key already exists, it would get updated. The same is not applicable when batch is enabled in delivery rules section. - Review that all the columns of selected table are displayed in the grid.
- Encoding UTF-8 is a standard character encoding for Unicode. This is the default encoding.
- If in case you have added/updated/deleted the existing columns in the table, use
Refresh button to get the updated column details for the selected
table. Note:
- To insert only one row in the database, directly select the Map Inputs section.
- To insert multiple records, the user needs to select the option of Delivery Rules and enable the checkbox for Batch.
- Under Delivery Rules, select Enable Batch
checkbox and define the number of rows you want to insert at a time.
- Once the checkbox is selected, the Batch Type will be populated in the drop down section which
is as follows:
- LOGGED
- UNLOGGED
- Select any one of the above batch type.
- The default value in the ‘Write Consistency Level’ dropdown is the one which is selected while creating the endpoint in the test connection. User can change the value by selecting any of the consistency level.
- Once the checkbox is selected, the Batch Type will be populated in the drop down section which
is as follows:
- Select the Map Inputs in the Checklist. The XML Schemas generated from the selected table of
the Insert Rows Activity are displayed as nodes under the request input parameter in the To Activity
panel.
For Column type map<?,?> , the schema would contain key, value as a recursive element node.
The sample input request for Map data type:
<to_do> <key>Delivery</key> <value>Cassandra</value> </to_do> <to_do> <key>QA</key> <value>SharePoint</value> </to_do>
For Column type set<?> and List<?> the schema would contain a recursive element node.
The sample input request for Set, List data type:
<email>john_0@abc.com</email> <email>john_1@abc.com</email> <email>john_2@abc.com</email> <projects>Cassandra</projects> <projects>MailChimp</projects> <projects>SharePoint</projects>
- Create a map between the orchestration variables and the input parameter of the activity. Note: Values must be provided at run time for any mandatory elements of the input structure. A value can be provided by specifying a default value for element or by mapping the element with an input node. During run time if no value is provided for a mandatory element, the Activity throws an exception, which is reported by the Web Management Console. If a value is not provided at run time for an optional input parameter, no exception is thrown during run time.
- Select the Map Outputs in the Checklist. The XML Schema generated to hold the response of the activity is displayed as nodes under the response output parameter in the From Activity panel.
- Create a map between the output parameters and orchestration variables.
Results
You can add more than one object as input to this activity. To add more than one object as input, right click the Object Name (For example: Filter) field in the To Activity pane of Map Inputs, and select Expand Occurrences.