Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Follow the instructions below to create a data service using a Cassandra data-source.

First, create a simple keyspace and add some columns to work with. Here is the Cassandra-cli commands to perform this tasks:

Code Block
create keyspace Keyspace1;

use Keyspace1;

create column family USER with comparator=UTF8Type and key_validation_class=UTF8Type

and column_metadata=[{column_name: user_id, validation_class: UTF8Type, index_type: KEYS},

{column_name: username, validation_class: UTF8Type},

{column_name: password, validation_class: UTF8Type}];

set USER[user1][username]='dinusha';

set USER[user1][password]='mypwd';

1. Log on to the Data Services Server Management Console.

2. Click the"Main" tab and select the "Create" link under " Data Services."

3. The "Create Data Service" page appears. Fill in the fields and click " Next." The Data Service name is mandatory.

Info

Info:
For more information on Advanced Configurations in creating data services, refer to the Transaction Handling section.

4. The "Data Sources" page appears. Click on the "Add New Data Source" link and add your Data Source details. Then click " Save."

For a Cassandra data source, select the data source type as Cassandra. For example,

Info

Note:

Before saving, you can click on the 'Test Connection' button. If the database connection is successful, you will get a 'connection is successful' message:

5. After saving, the added data source page appears. You can edit or delete the Data Source. To proceed click " Next."

6. The "Queries" page appears.

Initially your service does not include any queries. Click on 'Add New Query' to add a new query, input/output mappings, events etc. to your Data Service.

To extract information you need to create a query relevant to the structure of the response. Give a name to the query, and select the data source which was created in the previous step. Specify the CQL query and parameters and click Save.

Query ID : getUsers

Data Source : CassandraDatasource

CQL : select 'key', 'username', 'password' from USER

To define how the output looks like, click the Add Output Mapping button. For example,

For information on adding validations to input mappings in the query, if any, refer to section Input Validators.

Once you have entered the output mapping details, click on Main Configuration and then the Save button.

7. Once a new query is added, it will be listed as follows:

Image Removed

You have added one query to your data service configuration. You can edit or delete your query. To continue, click " Next."

8. The "Operations" page appears. Click the "Add new operation" link to create an operation.

Select a query to be executed when this operation is called.Click "Save" once done. For example,

Image Removed

9. The operation will be listed in the "operations" page. You can edit or delete your operation. To continue click "Next."

Image Removed

10. The "Resources" page appears. Click "Add new resource" and give your resource details. Click "Save" once done. For example,

Image Removed

11. The resource will be listed in the "Resources" page. You can edit or delete your resource.

The Image Added

Click Save once done.

9. The Data Service configuration is done. Click " Finish. "

Image Removed

12(You can continue to add resources by clicking the Next button if you like)

10. You will be navigated to the "Deployed services" pageServices page where the data service is listed.

Image RemovedImage Added

From here, you can manage your service.