├── .dockerignore ├── .github └── workflows │ ├── build.yml │ ├── early-access.yml │ └── release.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── VERSION ├── app ├── architecture.svg ├── brewdis-api │ ├── brewdis-api.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── redislabs │ │ │ └── demo │ │ │ └── brewdis │ │ │ ├── BrewdisApplication.java │ │ │ ├── BrewdisField.java │ │ │ ├── Config.java │ │ │ ├── DataLoader.java │ │ │ ├── InventoryDemand.java │ │ │ ├── InventoryManager.java │ │ │ ├── InventorySupply.java │ │ │ ├── WebController.java │ │ │ ├── WebSocketConfig.java │ │ │ ├── WebSocketPublisher.java │ │ │ └── web │ │ │ ├── BrewerySuggestion.java │ │ │ ├── Category.java │ │ │ ├── Query.java │ │ │ ├── ResultsPage.java │ │ │ └── Style.java │ │ └── resources │ │ ├── application.properties │ │ ├── banner.txt │ │ ├── english_stopwords.txt │ │ └── stores.csv └── brewdis-ui │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── brewdis-ui.gradle │ ├── browserslist │ ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.json │ ├── gradle.properties │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── proxy.conf.json │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── availability │ │ │ ├── availability.component.css │ │ │ ├── availability.component.html │ │ │ ├── availability.component.spec.ts │ │ │ └── availability.component.ts │ │ ├── catalog │ │ │ ├── catalog.component.css │ │ │ ├── catalog.component.html │ │ │ ├── catalog.component.spec.ts │ │ │ ├── catalog.component.ts │ │ │ └── dialog │ │ │ │ ├── dialog.component.css │ │ │ │ ├── dialog.component.html │ │ │ │ ├── dialog.component.spec.ts │ │ │ │ └── dialog.component.ts │ │ ├── inventory │ │ │ ├── inventory.component.css │ │ │ ├── inventory.component.html │ │ │ ├── inventory.component.spec.ts │ │ │ └── inventory.component.ts │ │ ├── material.module.ts │ │ ├── search.service.spec.ts │ │ └── search.service.ts │ ├── assets │ │ ├── .gitkeep │ │ ├── brewdis.svg │ │ ├── favicon.ico │ │ ├── map-marker.png │ │ ├── redis.svg │ │ ├── redislabs.png │ │ ├── redislabs.svg │ │ ├── store-high.svg │ │ ├── store-low.svg │ │ └── store-medium.svg │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.d.ts │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.css │ ├── test.ts │ └── theme.scss │ ├── start-ng.sh │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── tslint.json ├── app_preview_image.png ├── brewdis.png ├── build.gradle ├── data ├── .gitattributes ├── README.adoc ├── brewerydb.tgz ├── jq-process.sh ├── load.sh ├── stores.csv └── stores.numbers ├── docker-compose.yml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jreleaser.yml ├── lombok.config ├── marketplace.json └── settings.gradle /.dockerignore: -------------------------------------------------------------------------------- 1 | data 2 | docs 3 | brewdis-ui/node_modules 4 | brewdis-ui/dist 5 | brewdis-ui/build 6 | brewdis-api/build 7 | .git 8 | .gitignore -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | build: 8 | name: Build 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | os: [ ubuntu-latest, macos-latest, windows-latest ] 13 | runs-on: ${{ matrix.os }} 14 | if: startsWith(github.event.head_commit.message, 'Releasing version') != true 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up Java 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 11 23 | 24 | - uses: actions/cache@v2 25 | with: 26 | path: ~/.gradle/caches 27 | key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} 28 | restore-keys: | 29 | ${{ runner.os }}-gradle- 30 | 31 | - uses: actions/cache@v2 32 | with: 33 | path: ~/.gradle/wrapper 34 | key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }} 35 | restore-keys: | 36 | ${{ runner.os }}-gradlew- 37 | 38 | - name: Build 39 | run: ./gradlew build -S 40 | 41 | - name: Show Reports 42 | uses: actions/upload-artifact@v1 43 | if: failure() 44 | with: 45 | name: reports-${{ runner.os }} 46 | path: build/ 47 | -------------------------------------------------------------------------------- /.github/workflows/early-access.yml: -------------------------------------------------------------------------------- 1 | name: EarlyAccess 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | jobs: 8 | earlyaccess: 9 | name: EarlyAccess 10 | if: github.repository == 'redis-developer/brewdis' && startsWith(github.event.head_commit.message, 'Releasing version') != true 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2 15 | with: 16 | fetch-depth: 0 17 | 18 | - name: Set up Java 19 | uses: actions/setup-java@v1 20 | with: 21 | java-version: 11 22 | 23 | - uses: actions/cache@v2 24 | with: 25 | path: ~/.gradle/caches 26 | key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} 27 | restore-keys: | 28 | ${{ runner.os }}-gradle- 29 | 30 | - uses: actions/cache@v2 31 | with: 32 | path: ~/.gradle/wrapper 33 | key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }} 34 | restore-keys: | 35 | ${{ runner.os }}-gradlew- 36 | 37 | - name: Build 38 | run: ./gradlew -Prelease=true build -S 39 | 40 | - name: Version 41 | id: vars 42 | run: echo ::set-output name=version::$(cat VERSION) 43 | 44 | - name: Assemble 45 | uses: jreleaser/release-action@v1 46 | with: 47 | arguments: assemble 48 | env: 49 | JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }} 50 | JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | 52 | - name: Release 53 | uses: jreleaser/release-action@v1 54 | with: 55 | arguments: full-release 56 | env: 57 | JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }} 58 | JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 59 | JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 60 | JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} 61 | JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} 62 | JRELEASER_DOCKER_DEFAULT_PASSWORD: ${{ secrets.JRELEASER_DOCKER_PASSWORD }} 63 | 64 | - name: JReleaser output 65 | if: always() 66 | uses: actions/upload-artifact@v2 67 | with: 68 | name: artifact 69 | path: | 70 | out/jreleaser/trace.log 71 | out/jreleaser/output.properties 72 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: "Release version" 8 | required: true 9 | jobs: 10 | release: 11 | name: Release 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | with: 16 | fetch-depth: 0 17 | 18 | - name: Set up Java 19 | uses: actions/setup-java@v1 20 | with: 21 | java-version: 11 22 | 23 | - uses: actions/cache@v2 24 | with: 25 | path: ~/.gradle/caches 26 | key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} 27 | restore-keys: | 28 | ${{ runner.os }}-gradle- 29 | 30 | - uses: actions/cache@v2 31 | with: 32 | path: ~/.gradle/wrapper 33 | key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }} 34 | restore-keys: | 35 | ${{ runner.os }}-gradlew- 36 | 37 | - name: Set release version 38 | run: | 39 | VERSION=${{ github.event.inputs.version }} 40 | echo $VERSION > VERSION 41 | sed -i -e "s/^\:project-version\:\ .*/:project-version: $VERSION/g" README.adoc 42 | git add VERSION 43 | git add README.adoc 44 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 45 | git config --global user.name "GitHub Action" 46 | git commit -a -m "Releasing version $VERSION" 47 | git push origin master 48 | 49 | - name: Build 50 | env: 51 | GITHUB_USERNAME: jruaux 52 | GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} 53 | GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} 54 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 55 | run: | 56 | ./gradlew -Prelease=true -Pfull-release=true build -S 57 | 58 | - name: Assemble 59 | uses: jreleaser/release-action@v1 60 | with: 61 | arguments: assemble 62 | env: 63 | JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} 64 | JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 65 | 66 | - name: Release 67 | uses: jreleaser/release-action@v1 68 | with: 69 | arguments: full-release 70 | env: 71 | JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} 72 | JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 73 | JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 74 | JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} 75 | JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} 76 | JRELEASER_DOCKER_DEFAULT_PASSWORD: ${{ secrets.JRELEASER_DOCKER_PASSWORD }} 77 | JRELEASER_SLACK_WEBHOOK: ${{ secrets.JRELEASER_SLACK_WEBHOOK }} 78 | 79 | - name: JReleaser output 80 | if: always() 81 | uses: actions/upload-artifact@v2 82 | with: 83 | name: artifact 84 | path: | 85 | out/jreleaser/trace.log 86 | out/jreleaser/output.properties 87 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | *.log 4 | /data/products.json.gz 5 | /data/products.json 6 | /data/brewerydb/all/ 7 | .gradle 8 | build 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:13-jdk-slim AS build 2 | WORKDIR /app 3 | COPY . /app 4 | RUN ./gradlew build --no-daemon 5 | 6 | #### Stage 2: A minimal docker image with command to run the app 7 | FROM openjdk:13-jdk-slim 8 | 9 | EXPOSE 8080 10 | 11 | RUN mkdir /app 12 | 13 | COPY --from=build /app/app/brewdis-api/build/libs/*.jar /app/brewdis.jar 14 | 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app/brewdis.jar"] 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Brewdis 2 | 3 | 4 | Real-time inventory demo based on data from [https://brewerydb.com](brewerydb.com). 5 | 6 | ## Tech Stack 7 | 8 | 9 | - Spring Boot 10 | - Gradle 6.8.3 11 | - Kordamp Gradle plugins 0.46.0. 12 | - Redis 13 | - Redis Search 14 | 15 | 16 | 17 | ## Architecture 18 | 19 | ![image](https://raw.githubusercontent.com/redis-developer/brewdis/master/app/architecture.svg) 20 | 21 | 22 | 23 | 24 | 25 | ## Run the demo 26 | 27 | ``` 28 | git clone https://github.com/redis-developer/brewdis.git 29 | cd brewdis 30 | docker-compose up 31 | ``` 32 | 33 | Access the demo at http://localhost 34 | 35 | ## Demo Steps 36 | 37 | 38 | 39 | ## Products 40 | 41 | Launch `redis-cli` 42 | 43 | ### Show number of documents inRedis Searchindex: 44 | 45 | ``` 46 | FT.INFO products 47 | ``` 48 | 49 | ### Run simple keyword search: 50 | 51 | ``` 52 | FT.SEARCH products chambly 53 | ``` 54 | 55 | TIP: `name`, `description`, `breweryName` are phonetic text fields so you will notice results containing words that sound similar. 56 | 57 | ### Run prefix search: 58 | 59 | ``` 60 | `FT.SEARCH products chamb*` 61 | ``` 62 | 63 | - Open http://localhost[] 64 | - Enter a simple keyword search, e.g. `chambly`. Note highlighted matches. 65 | - Expand the filter panel by clicking on the filter button (image:https://pic.onlinewebfonts.com/svg/img_3152.png[width=24]) 66 | - Enter some characters in the Brewery field to retrieve suggestions fromRedis Search(e.g. `Unib`) 67 | - Click the `Submit` button 68 | - Refine the search by adding a constraint on the alcohol content (ABV field): 69 | 70 | ``` 71 | `@abv:[7 9]` 72 | ``` 73 | - Change the sort-by field to `ABV` and click `Submit` 74 | 75 | 76 | ### Availability 77 | 78 | Click `Availability` on one of the search results. This takes you to the availability map for that product. 79 | . The map shows stores near you where the selected product is currently available. 80 | . Stores in `green` have more than 20 in stock, `amber`: 10 to 20, `red`: less than 10 81 | 82 | ### Inventory 83 | 84 | - Click on a store and then on the link that pops up 85 | - This takes you to the real-time inventory for that store 86 | - The *Available to Promise* field is updated in real-time based on current difference between supply (*On Hand*) and demand (*Reserved + Allocated + Virtual Hold*). 87 | 88 | 89 | ### Configuration 90 | 91 | The app server is built with Spring Boot which can be configured different ways: [Spring Boot Externalized Configuration](https://docs.spring.io/spring-boot/docs/2.2.x/reference/html/spring-boot-features.html#boot-features-external-config) 92 | 93 | Depending on the way you're running the demo you can either: 94 | 95 | - create a `application.properties` file based on the [one that ships with Brewdis](https://github.com/redis-developer/brewdis/blob/master/demo/brewdis-api/src/main/resources/application.properties) 96 | - specify JVM arguments like this: 97 | 98 | 99 | ``` 100 | java -jar brewdis.jar --spring.redis.host=localhost --spring.redis.port=6379 ... 101 | ``` 102 | 103 | - use environment variables: 104 | 105 | 106 | ``` 107 | export spring.redis.host=localhost 108 | export spring.redis.port=8080 109 | export ... 110 | java -jar brewdis.jar 111 | ``` 112 | 113 | Here are the most common configuration options for this demo: 114 | 115 | - `spring.redis.host`: Redis database hostname (default: `localhost`) 116 | - `spring.redis.port`: Redis database port (default: `6379`) 117 | - `stomp.host`: Websocket server hostname (default: `localhost`) 118 | - `stomp.port`: Websocket server port (default: `8080`) 119 | - `stomp.protocol`: Websocket protocol (default: `ws`). Use `wss` for secure websockets 120 | - `inventory.generator.rate`: duration in millis the generator should sleep between inventory updates (default: `100`) 121 | - `availability-radius`: radius to find in-store availability (default: `25 mi`) 122 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.2.1-SNAPSHOT 2 | -------------------------------------------------------------------------------- /app/brewdis-api/brewdis-api.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation 'org.springframework.boot:spring-boot-starter-web' 3 | implementation 'org.springframework.boot:spring-boot-starter-websocket' 4 | implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive' 5 | implementation 'com.redislabs:spring-redis-modules:1.3.2' 6 | implementation ('com.redislabs:riot-core:2.11.5') { 7 | exclude group: 'org.slf4j', module: 'slf4j-jdk14' 8 | } 9 | implementation ('com.redislabs:riot-file:2.11.5') { 10 | exclude group: 'org.slf4j', module: 'slf4j-jdk14' 11 | } 12 | compileOnly 'org.projectlombok:lombok' 13 | annotationProcessor 'org.projectlombok:lombok' 14 | implementation project(':brewdis-ui') 15 | testImplementation('org.springframework.boot:spring-boot-starter-test') { 16 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/brewdis-api/gradle.properties: -------------------------------------------------------------------------------- 1 | project_description = Brewdis API 2 | -------------------------------------------------------------------------------- /app/brewdis-api/src/main/java/com/redislabs/demo/brewdis/BrewdisApplication.java: -------------------------------------------------------------------------------- 1 | package com.redislabs.demo.brewdis; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.ApplicationArguments; 5 | import org.springframework.boot.ApplicationRunner; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.scheduling.annotation.EnableScheduling; 9 | 10 | @SpringBootApplication 11 | @EnableScheduling 12 | public class BrewdisApplication implements ApplicationRunner { 13 | 14 | @Autowired 15 | private DataLoader loader; 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(BrewdisApplication.class, args); 19 | } 20 | 21 | @Override 22 | public void run(ApplicationArguments args) throws Exception { 23 | loader.execute(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/brewdis-api/src/main/java/com/redislabs/demo/brewdis/BrewdisField.java: -------------------------------------------------------------------------------- 1 | package com.redislabs.demo.brewdis; 2 | 3 | public class BrewdisField { 4 | 5 | public static final String ALLOCATED = "allocated"; 6 | public static final String AVAILABLE_TO_PROMISE = "availableToPromise"; 7 | public static final String BREWERY_ICON = "breweryIcon"; 8 | public static final String BREWERY_ID = "brewery"; 9 | public static final String BREWERY_NAME = "breweryName"; 10 | public static final String CATEGORY_ID = "category"; 11 | public static final String CATEGORY_NAME = "categoryName"; 12 | public static final String COUNT = "count"; 13 | public static final String DELTA = "delta"; 14 | public static final String EPOCH = "epoch"; 15 | public static final String FOOD_PAIRINGS = "foodPairings"; 16 | public static final String PRODUCT_LABEL = "label"; 17 | public static final String LEVEL = "level"; 18 | public static final String LOCATION = "location"; 19 | public static final String ON_HAND = "onHand"; 20 | public static final String PRODUCT_DESCRIPTION = "description"; 21 | public static final String PRODUCT_ID = "sku"; 22 | public static final String PRODUCT_NAME = "name"; 23 | public static final String RESERVED = "reserved"; 24 | public static final String STORE_ID = "store"; 25 | public static final String STYLE_ID = "style"; 26 | public static final String STYLE_NAME = "styleName"; 27 | public static final String TIME = "time"; 28 | public static final String VIRTUAL_HOLD = "virtualHold"; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/brewdis-api/src/main/java/com/redislabs/demo/brewdis/Config.java: -------------------------------------------------------------------------------- 1 | package com.redislabs.demo.brewdis; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import java.io.Serializable; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | @Configuration 13 | @ConfigurationProperties(prefix = "") 14 | @EnableAutoConfiguration 15 | @Data 16 | public class Config { 17 | 18 | private String keySeparator; 19 | private long streamPollTimeout = 100; 20 | private StompConfig stomp = new StompConfig(); 21 | private String availabilityRadius; 22 | private ProductConfig product = new ProductConfig(); 23 | private StoreConfig store = new StoreConfig(); 24 | private InventoryConfig inventory = new InventoryConfig(); 25 | private SessionConfig session = new SessionConfig(); 26 | 27 | @Data 28 | public static class SessionConfig { 29 | private String cartAttribute = "cart"; 30 | private String coordsAttribute = "coords"; 31 | } 32 | 33 | @Data 34 | public static class StoreConfig { 35 | private String index; 36 | private String keyspace; 37 | private String url; 38 | private long count; 39 | private Map inventoryMapping = new HashMap<>(); 40 | } 41 | 42 | @Data 43 | public static class ProductConfig { 44 | private String index; 45 | private String keyspace; 46 | private String url; 47 | private Map inventoryMapping = new HashMap<>(); 48 | private ProductLoadConfig load = new ProductLoadConfig(); 49 | private FoodPairingsConfig foodPairings = new FoodPairingsConfig(); 50 | private BreweryConfig brewery = new BreweryConfig(); 51 | } 52 | 53 | @Data 54 | public static class BreweryConfig { 55 | private String index; 56 | private boolean fuzzy; 57 | } 58 | 59 | @Data 60 | public static class FoodPairingsConfig { 61 | private long limit; 62 | private String index; 63 | private boolean fuzzy; 64 | } 65 | 66 | @Data 67 | public static class ProductLoadConfig { 68 | private long count; 69 | } 70 | 71 | @Data 72 | public static class InventoryConfig { 73 | private String updateStream; 74 | private String stream; 75 | private String index; 76 | private String keyspace; 77 | private int searchLimit; 78 | private int levelLow; 79 | private int levelMedium; 80 | private InventoryGeneratorConfig generator = new InventoryGeneratorConfig(); 81 | private InventoryRestockConfig restock = new InventoryRestockConfig(); 82 | private InventoryCleanupConfig cleanup = new InventoryCleanupConfig(); 83 | 84 | public String level(int quantity) { 85 | if (quantity <= levelLow) { 86 | return "low"; 87 | } 88 | if (quantity <= levelMedium) { 89 | return "medium"; 90 | } 91 | return "high"; 92 | } 93 | } 94 | 95 | @Data 96 | public static class InventoryRestockConfig { 97 | private int delayMin; 98 | private int delayMax; 99 | private int threshold; 100 | private int deltaMin; 101 | private int deltaMax; 102 | } 103 | 104 | @Data 105 | public static class InventoryCleanupConfig { 106 | private int searchLimit; 107 | private long ageThreshold; 108 | private long streamTrimCount; 109 | } 110 | 111 | @Data 112 | public static class InventoryGeneratorConfig { 113 | private int onHandMin; 114 | private int onHandMax; 115 | private int deltaMin; 116 | private int deltaMax; 117 | private int allocatedMin; 118 | private int allocatedMax; 119 | private int reservedMin; 120 | private int reservedMax; 121 | private int virtualHoldMin; 122 | private int virtualHoldMax; 123 | private long requestDurationInSeconds; 124 | private long skusMax; 125 | private long storesMax; 126 | } 127 | 128 | @Data 129 | public static class StompConfig implements Serializable { 130 | private static final long serialVersionUID = -623741573410463326L; 131 | private String protocol; 132 | private String host; 133 | private int port; 134 | private String endpoint; 135 | private String destinationPrefix; 136 | private String inventoryTopic; 137 | } 138 | 139 | public String concat(String... keys) { 140 | return String.join(keySeparator, keys); 141 | } 142 | 143 | public String tag(String field, String value) { 144 | return "@" + field + ":{" + value + "}"; 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /app/brewdis-api/src/main/java/com/redislabs/demo/brewdis/DataLoader.java: -------------------------------------------------------------------------------- 1 | package com.redislabs.demo.brewdis; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.redislabs.demo.brewdis.web.BrewerySuggestion; 6 | import com.redislabs.demo.brewdis.web.Category; 7 | import com.redislabs.demo.brewdis.web.Style; 8 | import com.redislabs.mesclun.RedisModulesAsyncCommands; 9 | import com.redislabs.mesclun.RedisModulesCommands; 10 | import com.redislabs.mesclun.StatefulRedisModulesConnection; 11 | import com.redislabs.mesclun.search.AggregateOptions; 12 | import com.redislabs.mesclun.search.AggregateResults; 13 | import com.redislabs.mesclun.search.CreateOptions; 14 | import com.redislabs.mesclun.search.Field; 15 | import com.redislabs.mesclun.search.IndexInfo; 16 | import com.redislabs.mesclun.search.Order; 17 | import com.redislabs.mesclun.search.RediSearchCommands; 18 | import com.redislabs.mesclun.search.RediSearchUtils; 19 | import com.redislabs.mesclun.search.SugaddOptions; 20 | import com.redislabs.mesclun.search.aggregate.GroupBy; 21 | import com.redislabs.mesclun.search.aggregate.Limit; 22 | import com.redislabs.mesclun.search.aggregate.SortBy; 23 | import com.redislabs.mesclun.search.aggregate.reducers.CountDistinct; 24 | import com.redislabs.riot.ProcessorOptions; 25 | import com.redislabs.riot.RedisOptions; 26 | import com.redislabs.riot.file.FileImportCommand; 27 | import com.redislabs.riot.file.RiotFile; 28 | import com.redislabs.riot.redis.HsetCommand; 29 | import io.lettuce.core.LettuceFutures; 30 | import io.lettuce.core.RedisCommandExecutionException; 31 | import io.lettuce.core.RedisFuture; 32 | import lombok.Getter; 33 | import lombok.extern.slf4j.Slf4j; 34 | import org.apache.commons.pool2.impl.GenericObjectPool; 35 | import org.springframework.beans.factory.InitializingBean; 36 | import org.springframework.beans.factory.annotation.Autowired; 37 | import org.springframework.beans.factory.annotation.Value; 38 | import org.springframework.boot.autoconfigure.data.redis.RedisProperties; 39 | import org.springframework.core.io.Resource; 40 | import org.springframework.expression.Expression; 41 | import org.springframework.expression.spel.standard.SpelExpressionParser; 42 | import org.springframework.stereotype.Component; 43 | 44 | import java.io.BufferedReader; 45 | import java.io.InputStreamReader; 46 | import java.nio.charset.StandardCharsets; 47 | import java.util.ArrayList; 48 | import java.util.Arrays; 49 | import java.util.Collections; 50 | import java.util.Comparator; 51 | import java.util.HashMap; 52 | import java.util.LinkedHashMap; 53 | import java.util.List; 54 | import java.util.Map; 55 | import java.util.stream.Collectors; 56 | import java.util.stream.Stream; 57 | 58 | import static com.redislabs.demo.brewdis.BrewdisField.*; 59 | 60 | @Component 61 | @Slf4j 62 | public class DataLoader implements InitializingBean { 63 | 64 | @Value("classpath:english_stopwords.txt") 65 | private Resource stopwordsResource; 66 | @Autowired 67 | private StatefulRedisModulesConnection connection; 68 | @Autowired 69 | private GenericObjectPool> pool; 70 | @Autowired 71 | private Config config; 72 | @Autowired 73 | private RedisProperties redisProperties; 74 | @Getter 75 | private List categories; 76 | @Getter 77 | private Map> styles = new HashMap<>(); 78 | private List stopwords; 79 | 80 | @Override 81 | public void afterPropertiesSet() throws Exception { 82 | this.stopwords = new BufferedReader( 83 | new InputStreamReader(stopwordsResource.getInputStream(), StandardCharsets.UTF_8)).lines() 84 | .collect(Collectors.toList()); 85 | } 86 | 87 | public void execute() throws Exception { 88 | loadStores(); 89 | loadProducts(); 90 | loadBreweries(); 91 | loadCategoriesAndStyles(); 92 | loadFoodPairings(); 93 | } 94 | 95 | @SuppressWarnings("unchecked") 96 | private void loadStores() throws Exception { 97 | RediSearchCommands commands = connection.sync(); 98 | String index = config.getStore().getIndex(); 99 | try { 100 | IndexInfo info = RediSearchUtils.getInfo(commands.indexInfo(index)); 101 | if (info.getNumDocs() >= config.getStore().getCount()) { 102 | log.info("Found {} stores - skipping load", Math.round(info.getNumDocs())); 103 | return; 104 | } 105 | commands.dropIndex(index); 106 | } catch (RedisCommandExecutionException e) { 107 | if (!e.getMessage().equals("Unknown Index name")) { 108 | throw e; 109 | } 110 | } 111 | commands.create(index, CreateOptions.builder().prefix(config.getStore().getKeyspace() + config.getKeySeparator()).build(), Field.tag(STORE_ID).sortable(true).build(), Field.text("description").build(), 112 | Field.tag("market").sortable(true).build(), Field.tag("parent").sortable(true).build(), 113 | Field.text("address").build(), Field.text("city").sortable(true).build(), 114 | Field.tag("country").sortable(true).build(), Field.tag("inventoryAvailableToSell").sortable(true).build(), 115 | Field.tag("isDefault").sortable(true).build(), Field.tag("preferred").sortable(true).build(), 116 | Field.numeric("latitude").sortable(true).build(), Field.geo(LOCATION).build(), 117 | Field.numeric("longitude").sortable(true).build(), Field.tag("rollupInventory").sortable(true).build(), 118 | Field.tag("state").sortable(true).build(), Field.tag("type").sortable(true).build(), 119 | Field.tag("postalCode").sortable(true).build()); 120 | RiotFile file = new RiotFile(); 121 | configure(file.getRedisOptions()); 122 | FileImportCommand command = new FileImportCommand(); 123 | command.setApp(file); 124 | command.setFiles(Collections.singletonList(config.getStore().getUrl())); 125 | command.getOptions().setHeader(true); 126 | ProcessorOptions processorOptions = new ProcessorOptions(); 127 | SpelExpressionParser parser = new SpelExpressionParser(); 128 | Map fields = new LinkedHashMap<>(); 129 | fields.put(LOCATION, parser.parseExpression("#geo(longitude,latitude)")); 130 | processorOptions.setSpelFields(fields); 131 | command.setProcessorOptions(processorOptions); 132 | HsetCommand hset = new HsetCommand(); 133 | hset.setKeyspace(config.getStore().getKeyspace()); 134 | hset.setKeys(new String[]{STORE_ID}); 135 | command.setRedisCommands(Collections.singletonList(hset)); 136 | command.execute(); 137 | } 138 | 139 | @SuppressWarnings("unchecked") 140 | private void loadProducts() throws Exception { 141 | RediSearchCommands commands = connection.sync(); 142 | String index = config.getProduct().getIndex(); 143 | try { 144 | IndexInfo info = RediSearchUtils.getInfo(commands.indexInfo(index)); 145 | if (info.getNumDocs() >= config.getProduct().getLoad().getCount()) { 146 | log.info("Found {} products - skipping load", Math.round(info.getNumDocs())); 147 | return; 148 | } 149 | commands.dropIndex(index); 150 | } catch (RedisCommandExecutionException e) { 151 | if (!e.getMessage().equals("Unknown Index name")) { 152 | throw e; 153 | } 154 | } 155 | commands.create(index, CreateOptions.builder().prefix(config.getProduct().getKeyspace() + config.getKeySeparator()).build(), Field.tag(PRODUCT_ID).sortable(true).build(), 156 | Field.text(PRODUCT_NAME).sortable(true).build(), 157 | Field.text(PRODUCT_DESCRIPTION).matcher(Field.Text.PhoneticMatcher.English).build(), 158 | Field.tag(PRODUCT_LABEL).build(), 159 | Field.tag(CATEGORY_ID).sortable(true).build(), 160 | Field.text(CATEGORY_NAME).build(), 161 | Field.tag(STYLE_ID).sortable(true).build(), 162 | Field.text(STYLE_NAME).build(), 163 | Field.tag(BREWERY_ID).sortable(true).build(), 164 | Field.text(BREWERY_NAME).build(), 165 | Field.text(FOOD_PAIRINGS).sortable(true).build(), 166 | Field.tag("isOrganic").sortable(true).build(), 167 | Field.numeric("abv").sortable(true).build(), 168 | Field.numeric("ibu").sortable(true).build()); 169 | RiotFile file = new RiotFile(); 170 | configure(file.getRedisOptions()); 171 | FileImportCommand command = new FileImportCommand(); 172 | command.setApp(file); 173 | command.setFiles(Collections.singletonList(config.getProduct().getUrl())); 174 | ProcessorOptions processorOptions = new ProcessorOptions(); 175 | SpelExpressionParser parser = new SpelExpressionParser(); 176 | Map fields = new LinkedHashMap<>(); 177 | fields.put(PRODUCT_ID, parser.parseExpression("id")); 178 | fields.put(PRODUCT_LABEL, parser.parseExpression("containsKey('labels')")); 179 | fields.put(CATEGORY_ID, parser.parseExpression("style.category.id")); 180 | fields.put(CATEGORY_NAME, parser.parseExpression("style.category.name")); 181 | fields.put(STYLE_NAME, parser.parseExpression("style.shortName")); 182 | fields.put(STYLE_ID, parser.parseExpression("style.id")); 183 | fields.put(BREWERY_ID, parser.parseExpression("containsKey('breweries')?breweries[0].id:null")); 184 | fields.put(BREWERY_NAME, parser.parseExpression("containsKey('breweries')?breweries[0].nameShortDisplay:null")); 185 | fields.put(BREWERY_ICON, parser.parseExpression("containsKey('breweries')?breweries[0].containsKey('images')?breweries[0].get('images').get('icon'):null:null")); 186 | processorOptions.setSpelFields(fields); 187 | command.setProcessorOptions(processorOptions); 188 | HsetCommand hset = new HsetCommand(); 189 | hset.setKeyspace(config.getProduct().getKeyspace()); 190 | hset.setKeys(new String[]{PRODUCT_ID}); 191 | command.setRedisCommands(Collections.singletonList(hset)); 192 | command.execute(); 193 | } 194 | 195 | private void configure(RedisOptions redisOptions) { 196 | redisOptions.setHost(redisProperties.getHost()); 197 | redisOptions.setPort(redisProperties.getPort()); 198 | if (redisProperties.getClientName() != null) { 199 | redisOptions.setClientName(redisProperties.getClientName()); 200 | } 201 | redisOptions.setDatabase(redisProperties.getDatabase()); 202 | if (redisProperties.getPassword() != null) { 203 | redisOptions.setPassword(redisProperties.getPassword().toCharArray()); 204 | } 205 | redisOptions.setTls(redisProperties.isSsl()); 206 | } 207 | 208 | private void loadCategoriesAndStyles() { 209 | log.info("Loading categories"); 210 | RediSearchCommands commands = connection.sync(); 211 | String index = config.getProduct().getIndex(); 212 | AggregateResults results = commands.aggregate(index, "*", 213 | AggregateOptions.builder().load(CATEGORY_NAME) 214 | .operation(GroupBy.properties(CATEGORY_ID, CATEGORY_NAME) 215 | .reducer(CountDistinct.property(PRODUCT_ID).as(COUNT).build()).build()) 216 | .build()); 217 | this.categories = results.stream() 218 | .map(r -> Category.builder().id((String) r.get(CATEGORY_ID)).name((String) r.get(CATEGORY_NAME)).build()) 219 | .sorted(Comparator.comparing(Category::getName, Comparator.nullsLast(Comparator.naturalOrder()))) 220 | .collect(Collectors.toList()); 221 | log.info("Loading styles"); 222 | this.categories.forEach(category -> { 223 | AggregateResults styleResults = commands.aggregate(index, 224 | config.tag(CATEGORY_ID, category.getId()), 225 | AggregateOptions.builder().load(STYLE_NAME) 226 | .operation(GroupBy.properties(STYLE_ID, STYLE_NAME) 227 | .reducer(CountDistinct.property(PRODUCT_ID).as(COUNT).build()).build()) 228 | .build()); 229 | List 61 | 63 | 71 | 72 | 73 | 98 | 103 | 108 | 111 | 115 | 117 | 123 | 129 | 135 | 141 | 147 | 153 | 154 | 155 | 160 | 165 | 171 | 176 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/app/brewdis-ui/src/assets/favicon.ico -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/map-marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/app/brewdis-ui/src/assets/map-marker.png -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/redis.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 28 | 48 | 50 | 80 | 82 | 88 | 89 | 90 | 92 | 96 | 98 | 104 | 110 | 116 | 122 | 128 | 134 | 135 | 136 | 141 | 146 | 152 | 157 | 162 | 163 | 169 | 175 | 176 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/redislabs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/app/brewdis-ui/src/assets/redislabs.png -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/redislabs.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/store-high.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 61 | 63 | 71 | 72 | 73 | 98 | 103 | 108 | 111 | 115 | 117 | 123 | 129 | 135 | 141 | 147 | 153 | 154 | 155 | 160 | 165 | 171 | 176 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/store-low.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 61 | 63 | 71 | 72 | 73 | 98 | 103 | 108 | 111 | 115 | 117 | 123 | 129 | 135 | 141 | 147 | 153 | 154 | 155 | 160 | 165 | 171 | 176 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/assets/store-medium.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 61 | 63 | 71 | 72 | 73 | 98 | 103 | 108 | 111 | 115 | 117 | 123 | 129 | 135 | 141 | 147 | 153 | 154 | 155 | 160 | 165 | 171 | 176 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/app/brewdis-ui/src/favicon.ico -------------------------------------------------------------------------------- /app/brewdis-ui/src/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'googlemaps'; -------------------------------------------------------------------------------- /app/brewdis-ui/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Brewdis 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | /*************************************************************************************************** 61 | * APPLICATION IMPORTS 62 | */ 63 | import 'hammerjs/hammer'; 64 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import "~@angular/material/prebuilt-themes/purple-green.css"; 3 | @import 'https://fonts.googleapis.com/icon?family=Material+Icons'; 4 | 5 | body { 6 | font-family: Roboto, "Helvetica Neue", sans-serif; 7 | margin: 0; 8 | } -------------------------------------------------------------------------------- /app/brewdis-ui/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /app/brewdis-ui/src/theme.scss: -------------------------------------------------------------------------------- 1 | @import '~@angular/material/theming'; 2 | // Plus imports for other components in your app. 3 | 4 | // Include the common styles for Angular Material. We include this here so that you only 5 | // have to load a single css file for Angular Material in your app. 6 | // Be sure that you only ever include this mixin once! 7 | @include mat-core(); 8 | 9 | // Define the palettes for your theme using the Material Design palettes available in palette.scss 10 | // (imported above). For each palette, you can optionally specify a default, lighter, and darker 11 | // hue. Available color palettes: https://material.io/design/color/ 12 | 13 | $brewdis-app-primary: mat-palette($mat-cyan, 900, 500, 100); 14 | $brewdis-app-accent: mat-palette($mat-orange, A200, A100, A400); 15 | 16 | // The warn palette is optional (defaults to red). 17 | $brewdis-app-warn: mat-palette($mat-orange); 18 | 19 | // Create the theme object (a Sass map containing all of the palettes). 20 | $brewdis-app-theme: mat-light-theme($brewdis-app-primary, $brewdis-app-accent, $brewdis-app-warn); 21 | 22 | // Include theme styles for core and each component used in your app. 23 | // Alternatively, you can import and @include the theme mixins for each component 24 | // that you are using. 25 | @include angular-material-theme($brewdis-app-theme); -------------------------------------------------------------------------------- /app/brewdis-ui/start-ng.sh: -------------------------------------------------------------------------------- 1 | ng serve --proxy-config proxy.conf.json -------------------------------------------------------------------------------- /app/brewdis-ui/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ], 14 | "angularCompilerOptions": { 15 | "enableIvy": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/brewdis-ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | }, 22 | "angularCompilerOptions": { 23 | "fullTemplateTypeCheck": true, 24 | "strictInjectionParameters": true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/brewdis-ui/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ], 18 | "angularCompilerOptions": { 19 | "enableIvy": true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/brewdis-ui/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "array-type": false, 5 | "arrow-parens": false, 6 | "deprecation": { 7 | "severity": "warning" 8 | }, 9 | "component-class-suffix": true, 10 | "contextual-lifecycle": true, 11 | "directive-class-suffix": true, 12 | "directive-selector": [ 13 | true, 14 | "attribute", 15 | "app", 16 | "camelCase" 17 | ], 18 | "component-selector": [ 19 | true, 20 | "element", 21 | "app", 22 | "kebab-case" 23 | ], 24 | "import-blacklist": [ 25 | true, 26 | "rxjs/Rx" 27 | ], 28 | "interface-name": false, 29 | "max-classes-per-file": false, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-consecutive-blank-lines": false, 47 | "no-console": [ 48 | true, 49 | "debug", 50 | "info", 51 | "time", 52 | "timeEnd", 53 | "trace" 54 | ], 55 | "no-empty": false, 56 | "no-inferrable-types": [ 57 | true, 58 | "ignore-params" 59 | ], 60 | "no-non-null-assertion": true, 61 | "no-redundant-jsdoc": true, 62 | "no-switch-case-fall-through": true, 63 | "no-var-requires": false, 64 | "object-literal-key-quotes": [ 65 | true, 66 | "as-needed" 67 | ], 68 | "object-literal-sort-keys": false, 69 | "ordered-imports": false, 70 | "quotemark": [ 71 | true, 72 | "single" 73 | ], 74 | "trailing-comma": false, 75 | "no-conflicting-lifecycle": true, 76 | "no-host-metadata-property": true, 77 | "no-input-rename": true, 78 | "no-inputs-metadata-property": true, 79 | "no-output-native": true, 80 | "no-output-on-prefix": true, 81 | "no-output-rename": true, 82 | "no-outputs-metadata-property": true, 83 | "template-banana-in-box": true, 84 | "template-no-negated-async": true, 85 | "use-lifecycle-interface": true, 86 | "use-pipe-transform-interface": true 87 | }, 88 | "rulesDirectory": [ 89 | "codelyzer" 90 | ] 91 | } -------------------------------------------------------------------------------- /app_preview_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/app_preview_image.png -------------------------------------------------------------------------------- /brewdis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/brewdis.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | config { 2 | info { 3 | description = 'Brewdis Demo' 4 | inceptionYear = '2020' 5 | vendor = 'Redis Labs' 6 | tags = ['redis', 'redisearch', 'inventory', 'real-time', 'retail'] 7 | links { 8 | website = "https://github.com/redis-developer/${project.rootProject.name}" 9 | issueTracker = "https://github.com/redis-developer/${project.rootProject.name}/issues" 10 | scm = "https://github.com/redis-developer/${project.rootProject.name}.git" 11 | } 12 | scm { 13 | url = "https://github.com/redis-developer/${project.rootProject.name}" 14 | connection = "scm:git:https://github.com/redis-developer/${project.rootProject.name}.git" 15 | developerConnection = "scm:git:git@github.com:redis-developer/${project.rootProject.name}.git" 16 | } 17 | specification { 18 | enabled = true 19 | } 20 | implementation { 21 | enabled = true 22 | } 23 | people { 24 | person { 25 | id = 'jruaux' 26 | name = 'Julien Ruaux' 27 | roles = ['developer', 'author'] 28 | } 29 | } 30 | publishing { 31 | signing { 32 | enabled = true 33 | } 34 | } 35 | } 36 | licensing { 37 | enabled = false 38 | licenses { 39 | license { 40 | id = 'Apache-2.0' 41 | } 42 | } 43 | } 44 | docs { 45 | javadoc { 46 | autoLinks { 47 | enabled = false 48 | } 49 | } 50 | sourceHtml { 51 | enabled = false 52 | } 53 | } 54 | } 55 | 56 | allprojects { 57 | repositories { 58 | gradlePluginPortal() 59 | mavenCentral() 60 | mavenLocal() 61 | } 62 | tasks.withType(GenerateModuleMetadata) { 63 | enabled = false 64 | } 65 | } 66 | 67 | subprojects { 68 | config { 69 | info { 70 | description = project.project_description 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /data/.gitattributes: -------------------------------------------------------------------------------- 1 | *.tgz filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /data/README.adoc: -------------------------------------------------------------------------------- 1 | = Retail Data Load 2 | 3 | == Products 4 | 5 | `jq '[.[] | . + {"sku": .id} | del(.id)]'` 6 | -------------------------------------------------------------------------------- /data/brewerydb.tgz: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:7e7041b9563913bd2d0a97943cb9837f88e78ee09f1de73a8607ecb16603cb1f 3 | size 78125362 4 | -------------------------------------------------------------------------------- /data/jq-process.sh: -------------------------------------------------------------------------------- 1 | cat beers.json | jq '.[] | select(.labels != null) | select(.labels.contentAwareLarge != null) | { abv, category: .style.category.name, description, id, label: .labels.contentAwareLarge, name, organic: .isOrganic, style: .style.name, styleId}' -------------------------------------------------------------------------------- /data/load.sh: -------------------------------------------------------------------------------- 1 | redis-cli flushall 2 | echo "Creating stores index" 3 | redis-cli FT.CREATE stores SCHEMA \ 4 | store TAG SORTABLE \ 5 | description TEXT \ 6 | market TAG SORTABLE \ 7 | parent TAG SORTABLE \ 8 | address TEXT \ 9 | city TEXT SORTABLE \ 10 | country TAG SORTABLE \ 11 | inventoryAvailableToSell TAG SORTABLE \ 12 | isDefault TAG SORTABLE \ 13 | preferred TAG SORTABLE \ 14 | latitude NUMERIC SORTABLE \ 15 | location GEO \ 16 | longitude NUMERIC SORTABLE \ 17 | rollupInventory TAG SORTABLE \ 18 | state TAG SORTABLE \ 19 | type TAG SORTABLE \ 20 | postalCode TAG SORTABLE 21 | riot file-import --file stores.csv --header --proc "location=#geo(longitude,latitude)" --index stores --keyspace store --keys store 22 | 23 | echo "Creating products index" 24 | redis-cli FT.CREATE products SCHEMA \ 25 | sku TAG SORTABLE \ 26 | name TEXT \ 27 | description TEXT PHONETIC dm:en \ 28 | category TAG SORTABLE \ 29 | categoryName TEXT \ 30 | style TAG SORTABLE \ 31 | styleName TEXT \ 32 | brewery TAG SORTABLE \ 33 | breweryName TEXT \ 34 | isOrganic TAG SORTABLE \ 35 | abv NUMERIC SORTABLE \ 36 | label TAG SORTABLE \ 37 | ibu NUMERIC SORTABLE 38 | riot file-import --file products.json.gz --proc "sku=id" "label=containsKey('labels')" "category=style.category.id" "categoryName=style.category.name" "styleName=style.shortName" "style=style.id" "brewery=containsKey('breweries')?breweries[0].id:null" "breweryName=containsKey('breweries')?breweries[0].nameShortDisplay:null" "breweryIcon=containsKey('breweries')?breweries[0].containsKey('images')?breweries[0].get('images').get('icon'):null:null" --index products --keyspace product --keys sku 39 | 40 | echo "Creating inventory index" 41 | redis-cli FT.CREATE inventory SCHEMA \ 42 | id TAG SORTABLE \ 43 | store TAG SORTABLE \ 44 | sku TAG SORTABLE \ 45 | location GEO \ 46 | availableToPromise NUMERIC SORTABLE \ 47 | onHand NUMERIC SORTABLE \ 48 | allocated NUMERIC SORTABLE \ 49 | reserved NUMERIC SORTABLE \ 50 | virtualHold NUMERIC SORTABLE \ 51 | epoch NUMERIC SORTABLE -------------------------------------------------------------------------------- /data/stores.numbers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/data/stores.numbers -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | services: 4 | server: 5 | build: 6 | context: ./ 7 | dockerfile: Dockerfile 8 | restart: always 9 | ports: 10 | - "80:8080" 11 | depends_on: 12 | - redisearch 13 | environment: 14 | SPRING_REDIS_HOST: redisearch 15 | STOMP_PORT: 80 16 | 17 | redisearch: 18 | image: redislabs/redisearch 19 | restart: always 20 | ports: 21 | - "6379:6379" 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | group=com.redislabs 2 | kordampPluginVersion=0.46.0 3 | redislabsBuildVersion=0.1.0 4 | protobufVersion=3.14.0 5 | googleHttpVersion=1.38.0 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis-developer/brewdis/cc6eedaea0ebc64f3ec04ba17b057a40a7aeeea4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /jreleaser.yml: -------------------------------------------------------------------------------- 1 | project: 2 | name: brewdis 3 | description: Brewdis Demo 4 | longDescription: Real-time inventory demo using Redis 5 | website: https://github.com/redis-developer/brewdis 6 | authors: 7 | - Julien Ruaux 8 | license: Apache-2.0 9 | java: 10 | groupId: com.redislabs 11 | version: 8 12 | multiProject: true 13 | extraProperties: 14 | inceptionYear: 2020 15 | 16 | release: 17 | github: 18 | branch: master 19 | username: jruaux 20 | overwrite: true 21 | changelog: 22 | sort: DESC 23 | formatted: ALWAYS 24 | format: '- {{commitShortHash}} {{commitTitle}}' 25 | labelers: 26 | - label: 'feature' 27 | title: 'Resolves #' 28 | body: 'Resolves #' 29 | - label: 'issue' 30 | title: 'Fixes #' 31 | body: 'Fixes #' 32 | - label: 'issue' 33 | title: 'Relates to #' 34 | body: 'Relates to #' 35 | - label: 'task' 36 | title: '[chore]' 37 | - label: 'dependencies' 38 | title: '[deps]' 39 | categories: 40 | - title: '🚀 Features' 41 | labels: 42 | - 'feature' 43 | - title: '✅ Issues' 44 | labels: 45 | - 'issue' 46 | - title: '🧰 Tasks' 47 | labels: 48 | - 'task' 49 | - title: '⚙️ Dependencies' 50 | labels: 51 | - 'dependencies' 52 | replacers: 53 | - search: '\[chore\] ' 54 | replace: '' 55 | - search: '\[deps\] ' 56 | replace: '' 57 | 58 | distributions: 59 | brewdis: 60 | type: SINGLE_JAR 61 | artifacts: 62 | - path: app/brewdis-api/build/libs/brewdis-api-{{projectVersion}}.jar 63 | docker: 64 | active: never 65 | registries: 66 | - serverName: DEFAULT 67 | username: jruaux 68 | labels: 69 | 'org.opencontainers.image.title': 'brewdis' 70 | 71 | files: 72 | artifacts: 73 | - path: VERSION 74 | -------------------------------------------------------------------------------- /lombok.config: -------------------------------------------------------------------------------- 1 | config.stopBubbling = true 2 | lombok.addLombokGeneratedAnnotation = true 3 | -------------------------------------------------------------------------------- /marketplace.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_name": "Brewdis", 3 | "description": "Real-time Brewery Inventory built using Redis ", 4 | "type": "Building Block", 5 | "contributed_by": "Redis", 6 | "repo_url": "https://github.com/redis-developer/brewdis", 7 | "preview_image_url": "https://raw.githubusercontent.com/redis-developer/brewdis/master/app_preview_image.png", 8 | "download_url": "https://github.com/redis-developer/brewdis/archive/refs/heads/master.zip", 9 | "hosted_url": "", 10 | "quick_deploy": "false", 11 | "deploy_buttons": [], 12 | "language": [ 13 | "Java" 14 | ], 15 | "redis_commands": [ 16 | "FT.CREATE", 17 | "HSET", 18 | "FT.SEARCH" 19 | ], 20 | "redis_use_cases": [ 21 | "Caching" 22 | ], 23 | "redis_features": [ 24 | "Search and Query" 25 | ], 26 | "app_image_urls": [ 27 | "https://raw.githubusercontent.com/redis-developer/brewdis/master/brewdis.png" 28 | ], 29 | "youtube_url": "", 30 | "special_tags": [ 31 | "Hackathon" 32 | ], 33 | "verticals": [ 34 | "Retail" 35 | ], 36 | "markdown": "https://raw.githubusercontent.com/redis-developer/brewdis/master/README.md" 37 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | gradlePluginPortal() 4 | mavenCentral() 5 | mavenLocal() 6 | } 7 | dependencies { 8 | classpath "com.redislabs.gradle:redislabs-parentbuild:$redislabsBuildVersion" 9 | classpath "org.kordamp.gradle:java-project-gradle-plugin:$kordampPluginVersion" 10 | classpath "org.kordamp.gradle:guide-gradle-plugin:$kordampPluginVersion" 11 | classpath "org.springframework.boot:spring-boot-gradle-plugin:2.5.3" 12 | classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE" 13 | classpath "com.github.node-gradle:gradle-node-plugin:3.0.1" 14 | } 15 | } 16 | 17 | apply plugin: 'com.redislabs.gradle.redislabs-parentbuild' 18 | 19 | rootProject.name = 'brewdis' 20 | 21 | projects { 22 | directories = ['app'] 23 | 24 | plugins { 25 | all { 26 | id 'idea' 27 | } 28 | path(':') { 29 | id 'org.kordamp.gradle.java-project' 30 | } 31 | path(':brewdis-ui') { 32 | id 'java-library' 33 | id 'com.github.node-gradle.node' 34 | } 35 | path(':brewdis-api') { 36 | id 'java-library' 37 | id 'org.springframework.boot' 38 | id 'io.spring.dependency-management' 39 | } 40 | } 41 | } 42 | 43 | enforce { 44 | mergeStrategy = 'append' 45 | 46 | rule(enforcer.rules.ForceDependencies) { r -> 47 | r.dependencies.addAll "com.redislabs:mesclun:1.3.2", 48 | "com.google.guava:guava:30.0-android", 49 | "com.google.errorprone:error_prone_annotations:2.4.0", 50 | "com.google.http-client:google-http-client:$googleHttpVersion", 51 | "com.google.http-client:google-http-client-jackson2:$googleHttpVersion", 52 | "com.google.api.grpc:proto-google-common-protos:2.0.1", 53 | "com.google.api:gax:1.60.1", 54 | "io.grpc:grpc-context:1.34.0", 55 | "com.google.protobuf:protobuf-java:$protobufVersion", 56 | "com.google.protobuf:protobuf-java-util:$protobufVersion", 57 | "org.hdrhistogram:HdrHistogram:2.1.12", 58 | "com.google.code.findbugs:jsr305:3.0.2" 59 | } 60 | } 61 | --------------------------------------------------------------------------------