# Generate sample data

This guide explains how you can generate sample data using the bash script
provided in the release package.

## Before you begin

Make sure to apply the [default configuration package](https://docs.cloud.google.com/manufacturing-data-engine/docs/deployment/default-config-package.md.txt)
or create relevant message classes, types, and parsers.

## Execute the script to generate sample data

Find the bash script in the deployment package in the file
`/testing/send-data-to-mde.sh`. This script requires two arguments:

1. The project ID.
2. The type of data to send. This can be either `numeric` or `discrete`.

When sending data the timestamp is automatically injected and the rest of the
values are the same. If you want to send a different payload edit the
bash script.

For example to send `numeric` data use the following command:

```bash
   ./send-data-to-mde.sh PROJECT_ID numeric
```

You will see a similar response:

```bash
   send-data-to-mde.sh: ***** Welcome to the MDE Data Generator *****
                     This script will send numeric data to MDE so that you can
                     validate that the entire pipeline is working
                     PROJECT_ID set to PROJECT_ID
                     You're authenticated as USER_EMAIL
                     Do you want to start sending data [Y/n]? Y

   Sending messages every 5 seconds
   Press [CTRL+C] to stop..
   Sent:
   {
   "tagName": "mde-test-numeric",
   "timestamp": "1695643807000",
   "value": 10
   }
   messageIds:
   - '8840355690320815'
```

To send `discrete` data use the following command:

```bash
   ./send-data-to-mde.sh PROJECT_ID discrete
```

You will see a similar response:

```bash
   send-data-to-mde.sh: ***** Welcome to the MDE Data Generator *****
                     This script will send discrete data to MDE so that you can
                     validate that the entire pipeline is working
                     PROJECT_ID set to PROJECT_ID
                     You're authenticated as USER_EMAIL
                     Do you want to start sending data [Y/n]? Y

   Sending messages every 5 seconds
   Press [CTRL+C] to stop..
   Sent:
   {
   "tagName": "mde-test-discrete",
   "timestamp": "1695643827000",
   "value": {
      "test1": true,
      "test2": "someValue"
   }
   }
   messageIds:
   - '9223124765272389'
```