{"id":21042697,"url":"https://github.com/yugabytedb-samples/market-orders-app","last_synced_at":"2026-02-06T09:37:25.852Z","repository":{"id":38682645,"uuid":"473208133","full_name":"YugabyteDB-Samples/market-orders-app","owner":"YugabyteDB-Samples","description":"Storing and processing real-time data streams with YugabyteDB","archived":false,"fork":false,"pushed_at":"2024-05-21T18:39:01.000Z","size":244,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T00:12:11.337Z","etag":null,"topics":["demos","distributed-database","mysql","postgresql","pubnub","streaming","yugabytedb"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YugabyteDB-Samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-23T13:48:25.000Z","updated_at":"2024-05-21T18:39:05.000Z","dependencies_parsed_at":"2024-05-21T19:11:31.278Z","dependency_job_id":null,"html_url":"https://github.com/YugabyteDB-Samples/market-orders-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/YugabyteDB-Samples/market-orders-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fmarket-orders-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fmarket-orders-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fmarket-orders-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fmarket-orders-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YugabyteDB-Samples","download_url":"https://codeload.github.com/YugabyteDB-Samples/market-orders-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fmarket-orders-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29157427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T07:18:23.844Z","status":"ssl_error","status_checked_at":"2026-02-06T07:13:32.659Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demos","distributed-database","mysql","postgresql","pubnub","streaming","yugabytedb"],"created_at":"2024-11-19T14:08:42.995Z","updated_at":"2026-02-06T09:37:25.815Z","avatar_url":"https://github.com/YugabyteDB-Samples.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Market Orders Streaming to YugabyteDB\n\nThe application subscribes to the [PubNub's market orders stream](https://www.pubnub.com/developers/realtime-data-streams/financial-securities-market-orders/) and stores the market trades in an underlying database. You can switch between MySQL, PostgreSQL and YugabyteDB with no need to update the application logic.\n\n## Start Database\n \n* Start a MySQL instance and load sample data:\n    ```shell\n    docker-compose -f docker-compose-mysql.yml up\n    ```\n\n    Use port `3307` for connections from the host machine.\n\n* or start a PostgreSQL database instead:\n    ```shell\n    docker-compose -f docker-compose-postgres.yml up\n    ```\n\n    Use port `5438` for connections from the host machine.\n\n* or start a [YugabyteDB Managed](https://docs.yugabyte.com/latest/yugabyte-cloud/cloud-quickstart/) instance, and load the schema (`./schema/schema_postgres.sql`) and sample data (`./schema/data.sql`).\n\n## Build and run Java app\n\n* Build and package the app:\n    ```shell\n    mvn clean package \n    ```\n* Run the app by connecting to the selected database:\n\n    * Connect to Postgres (`./properties/postgres.properties`):\n    ```shell\n    java -jar target/market-orders-app.jar connectionProps=./properties/postgres.properties loadScript=./schema/schema_postgres.sql tradeStatsInterval=2000\n    ```\n    * Connect to MySQL (`./properties/mysql.properties`):\n    ```shell\n    java -jar target/market-orders-app.jar connectionProps=./properties/mysql.properties loadScript=./schema/schema_mysql.sql tradeStatsInterval=2000\n    ``` \n    * Connect to YugabyteDB Managed after providing connecting settings in the `./properties/yugabyte-template.properties` file:\n    ```shell\n    java -jar target/market-orders-app.jar connectionProps=./properties/yugabyte.properties loadScript=./schema/schema_postgres.sql tradeStatsInterval=2000\n    ```    \n\nThe `tradeStatsInterval` (measured in milliseconds) instructs the `TradeStats.java` service to query trade-related statistics from the database within the specified interval. If the interval is \u003c= `0` or not set, then the statistics will not be collected.\n\n## Advanced Demo \n\nThe app can be used to demonstrate the migration from PostreSQL/MySQL to YugabyteDB as well as high-avalability and scalability capabilities of YugabyteDB. \nFollow [this page](./demo/demo_sript.md) for more details.\n\n## Run in Docker\n\n1. Build the app:\n    ```shell\n    mvn clean package \n    ```\n2. Create an image:\n    ```shell\n    docker rmi market-orders-app\n    docker build -t market-orders-app .\n    ```\n\n3. Start the app inside a container:\n    ```shell\n    docker run --name market-orders-instance --net custom-network \\\n    market-orders-app:latest \\\n    java -jar /home/target/market-orders-app.jar \\\n    connectionProps=/home/yugabyte-docker.properties \\\n    loadScript=/home/schema_postgres.sql \\\n    tradeStatsInterval=2000\n    ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugabytedb-samples%2Fmarket-orders-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyugabytedb-samples%2Fmarket-orders-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugabytedb-samples%2Fmarket-orders-app/lists"}