# Decodable

A video walkthrough can be found below:

{% embed url="<https://youtu.be/hgSFpKwIZGQ>" %}

## Prerequisites

1. WarpStream account - get access to WarpStream by registering [here](https://console.warpstream.com/signup).
2. Decodable account - get access to Decodable by registering [here](https://www.decodable.co/).
3. WarpStream cluster is up and running.

## Step 1: Create a topic in your WarpStream cluster

Obtain the Bootstrap Broker from the WarpStream console by navigating to your cluster and clicking the Connect tab. If you don't have SASL credentials yet, you can also [create a set of credentials](https://docs.warpstream.com/warpstream/kafka/manage-security/sasl-authentication#creating-credentials) from the console.

Store these values as environment variables for easy reference:

```bash
export BOOTSTRAP_HOST=<YOUR_BOOTSTRAP_BROKER> \
SASL_USERNAME=<YOUR_SASL_USERNAME> \
SASL_PASSWORD=<YOUR_SASL_PASSWORD>;
```

Then, create a topic using the WarpStream CLI:

{% code overflow="wrap" %}

```bash
warpstream kcmd -bootstrap-host $BOOTSTRAP_HOST -tls -username $SASL_USERNAME -password $SASL_PASSWORD -type create-topic -topic decodable_demo
```

{% endcode %}

You should see the following output in your Terminal:

`Created topic decodable_demo.`

## Step 2: Produce some records

Using the WarpStream CLI, produce several messages to your topic:

{% code overflow="wrap" %}

```bash
warpstream kcmd -bootstrap-host $BOOTSTRAP_HOST -tls -username $SASL_USERNAME -password $SASL_PASSWORD -type produce -topic decodable_demo --records '{"action": "click", "user_id": "user_0", "page_id": "home"},,{"action": "hover", "user_id": "user_0", "page_id": "home"},,{"action": "scroll", "user_id": "user_0", "page_id": "home"},,{"action": "click", "user_id": "user_1", "page_id": "home"},,{"action": "click", "user_id": "user_1", "page_id": "home"},,{"action": "click", "user_id": "user_2", "page_id": "home"}'
```

{% endcode %}

Note that the WarpStream CLI uses double commas (`,,)` as a delimiter between JSON records.

## Step 3: Connect Decodable to WarpStream

In the Decodable Web Console, under the Start Building heading, click "**Connect to a source**". Select "**Apache Kafka**", and configure Decodable to read from your WarpStream topic.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-690c99a5a8b8405bc016044865940b7c6bd5474a%2FScreenshot%202023-12-22%20at%203.01.20%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

Click **Next.**

Create a new stream named `decodable_demo`:

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-5f15d17b80073730b12f6ec4fc417fb1bac4c62a%2FScreenshot%202023-12-22%20at%203.02.31%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

Specify the schema of our data:

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-729fc254b7c681a6c97272eef265109d408492c7%2FScreenshot%202023-12-22%20at%203.06.14%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

And finally, finish creating the Connection:

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-fcd4656bb9173e687a762098c8a90aa433fffa8e%2FScreenshot%202023-12-22%20at%203.05.48%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

## Step 4: Start the Connection and verify that Decodable is ingesting data from WarpStream

In the upper right corner of the Connection overview screen, click "**Start**", then start the connection with the default settings:

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-f39a300e1506b79b5118e6e39430f3d25f6c5b76%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

After a few moments, the Decodable Connection should transition from **Starting** to **Running**, and the Output Metrics will show that Decodable is consuming from WarpStream:

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-91c6e4284e77ecf556b2f7d4b8fd2c05f391b4ec%2FScreenshot%202023-12-22%20at%203.11.26%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

Navigate to **Streams > decodable\_demo** to view a sample of your data in Decodable.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-30b57749e01549e09537870df647f05d07c664d0%2FScreenshot%202023-12-22%20at%203.13.42%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

## Step 5: Create a Pipeline

In the Decodable Web Console, navigate to **Pipelines > Create your first Pipeline** and select `decodable_demo` from the list of Streams.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-375cbc064de697a5cb622a49f5ffdbc15752f522%2FScreenshot%202023-12-22%20at%203.19.08%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

This query creates a new Stream and inserts only the records that have a `user_id` of `user_0`.

Click **Next**.

Click **Create Stream**, then click **Next.**

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-5442862b7339d02970b4b450885f31f5cd32e843%2FScreenshot%202023-12-22%20at%203.21.02%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

Name your Pipeline and click **Create Pipeline**.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-1f1f07abce42ca6cf5de006222a576d1e0274d72%2FScreenshot%202023-12-22%20at%203.22.18%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

Produce some more records to WarpStream from your Terminal (you can add more records if you want; just remember to use the `,,` delimiter in the WarpStream CLI):

{% code overflow="wrap" %}

```bash
warpstream kcmd -bootstrap-host $BOOTSTRAP_HOST -tls -username $SASL_USERNAME -password $SASL_PASSWORD -type produce -topic decodable_demo --records '{"action": "click", "user_id": "user_0", "page_id": "home"},,{"action": "hover", "user_id": "user_1", "page_id": "home"},,{"action": "scroll", "user_id": "user_1", "page_id": "home"},,{"action": "click", "user_id": "", "page_id": "home"},,{"action": "click", "user_id": "", "page_id": "home"},,{"action": "click", "user_id": "user_0", "page_id": "home"}'
```

{% endcode %}

And then **Start** your Pipeline, configuring it to read from the earliest offset:

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-042bc7a01ddf0e145568847f91173995991df2d3%2FScreenshot%202023-12-22%20at%203.26.21%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

After a few moments, you should be able to observe the Input and Output Metrics, confirming that the Pipeline is working as expected!

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-3b9d34e8385e1947887c2a4d35e55909b4caa300%2FScreenshot%202023-12-22%20at%203.28.43%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

## Next Steps

Congratulations! You've set up a stream processing pipeline between WarpStream and Decodable and created a simple Pipeline that filters data out of a firehose of events.

Next, check out the WarpStream docs for configuring the [WarpStream Agent](https://docs.warpstream.com/warpstream/agent-setup/deploy), or review the [Decodable docs](https://docs.decodable.co/docs) to learn more about what is possible with WarpStream and Decodable!
