<commit_before>---
title: The RSS reader tutorial
template: post.html
date: 2018-08-13
author: Sammers21
draft: true
--- 

# The RSS reader tutorial

This tutorial is dedicated for users who'd like to know how to use the Eclipse Vert.x Cassandra client with in practice.

# Before you start this tutorial

Before starting, you should :

* be familiar with [Eclipse Vert.x](https://vertx.io/). If you are not, here is the [guide for Java developers](https://vertx.io/docs/guide-for-java-devs/).

* have some basic understanding of databases. Extended knowledge of Cassandra is not required.

You also may find it useful to read [the RSS 2.0](https://validator.w3.org/feed/docs/rss2.html) specification, because the resulted app is, basically, a storage of RSS 2.0 feeds.

To give you an idea of what the App is about, here is how it looks like from the fronted side:

![see how it looks](https://i.imgur.com/QnLieKA.png)

On the image we see that browser space is split into 2 parts:

1. Saved feed names
2. List of articles for the selected feed

Here you also can enter a link to a new feed, so the App will fetch and parse the feed. 
After that, it will appear in the left column along with other saved feeds.

# Requirements

For completing this tutorial you need:

* Java 8 or higher
* Git
* 1 hour of your time
* You favorite code editor

For running the example you should ensure that Cassandra service is running locally on port 9042.
As an option, you can run Cassandra with [ccm](https://github.com/riptano/ccm#installation)(Cassandra Cluster Manager).
Follow [this](https://github.com/riptano/ccm#installation) instructions for installing ccm.
After installing you will be able to run a single node cluster:

```bash
ccm create rss_reader -v 3.11.2 -n 1 -s
ccm start
```

For now, [Eclipse Vert.x Cassandra client](https://github.com/Sammers21/vertx-cassandra-client) is not available in maven central, it means that you have to build and install it locally:

```bash
git clone https://github.com/Sammers21/vertx-cassandra-client
cd vertx-cassandra-client
mvn clean install -Dmaven.test.skip=true -s .travis.maven.settings.xml 
```

Before completing this step make sure that you have successfully cloned the RSS reader repository and checked out the `step_1` branch:

```bash
git clone https://github.com/Sammers21/rss-reader
cd rss-reader
git checkout step_1
```

Now you can try to tun this example and see if it works:
```bash
./gradlew vertxRun  
```

## Schema

If you are familiar with [Apache Cassandra](http://cassandra.apache.org/) you 
should know that the way your data is stored in Cassandra is dependent on queries 
you are running. It means that you need first to figure out what kind of queries 
you will be running, and then you can produce a storage scheme.

In our case we'd like our application to have 3 endpoints:

1. POST /user/{user_id}/rss_link - for adding links to a user's feed
2. GET /user/{user_id}/rss_channels - for retrieving information about RSS channels a user subscribed on
3. GET /articles/by_rss_link?link={rss_link} - for retrieving information about articles on a specific RSS channel

For implementing this endpoints the schema should look in this way:<commit_msg>updates link to cassandra client repo<commit_after>---
title: The RSS reader tutorial
template: post.html
date: 2018-08-13
author: Sammers21
draft: true
--- 

# The RSS reader tutorial

This tutorial is dedicated for users who'd like to know how to use the Eclipse Vert.x Cassandra client with in practice.

# Before you start this tutorial

Before starting, you should :

* be familiar with [Eclipse Vert.x](https://vertx.io/). If you are not, here is the [guide for Java developers](https://vertx.io/docs/guide-for-java-devs/).

* have some basic understanding of databases. Extended knowledge of Cassandra is not required.

You also may find it useful to read [the RSS 2.0](https://validator.w3.org/feed/docs/rss2.html) specification, because the resulted app is, basically, a storage of RSS 2.0 feeds.

To give you an idea of what the App is about, here is how it looks like from the fronted side:

![see how it looks](https://i.imgur.com/QnLieKA.png)

On the image we see that browser space is split into 2 parts:

1. Saved feed names
2. List of articles for the selected feed

Here you also can enter a link to a new feed, so the App will fetch and parse the feed. 
After that, it will appear in the left column along with other saved feeds.

# Requirements

For completing this tutorial you need:

* Java 8 or higher
* Git
* 1 hour of your time
* You favorite code editor

For running the example you should ensure that Cassandra service is running locally on port 9042.
As an option, you can run Cassandra with [ccm](https://github.com/riptano/ccm#installation)(Cassandra Cluster Manager).
Follow [this](https://github.com/riptano/ccm#installation) instructions for installing ccm.
After installing you will be able to run a single node cluster:

```bash
ccm create rss_reader -v 3.11.2 -n 1 -s
ccm start
```

For now, [Eclipse Vert.x Cassandra client](https://github.com/vert-x3/vertx-cassandra-client) is not available in maven central, it means that you have to build and install it locally:

```bash
git clone https://github.com/vert-x3/vertx-cassandra-client
cd vertx-cassandra-client
mvn clean install -Dmaven.test.skip=true -s .travis.maven.settings.xml 
```

Before completing this step make sure that you have successfully cloned the RSS reader repository and checked out the `step_1` branch:

```bash
git clone https://github.com/Sammers21/rss-reader
cd rss-reader
git checkout step_1
```

Now you can try to tun this example and see if it works:
```bash
./gradlew vertxRun  
```

## Schema

If you are familiar with [Apache Cassandra](http://cassandra.apache.org/) you 
should know that the way your data is stored in Cassandra is dependent on queries 
you are running. It means that you need first to figure out what kind of queries 
you will be running, and then you can produce a storage scheme.

In our case we'd like our application to have 3 endpoints:

1. POST /user/{user_id}/rss_link - for adding links to a user's feed
2. GET /user/{user_id}/rss_channels - for retrieving information about RSS channels a user subscribed on
3. GET /articles/by_rss_link?link={rss_link} - for retrieving information about articles on a specific RSS channel

For implementing this endpoints the schema should look in this way:
{'fraction_non_alphanumeric': 0.07749535027898326, 'fraction_numerical': 0.012709237445753255, 'mean_word_length': 4.097156398104265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5105451', 'n_tokens_mistral': 1967, 'n_tokens_neox': 1825, 'n_words': 910}