com.hotels.road:road-model-rest

Classes and enums for REST API models

License

License

GroupId

GroupId

com.hotels.road
ArtifactId

ArtifactId

road-model-rest
Last Version

Last Version

6.0.21
Release Date

Release Date

Type

Type

jar
Description

Description

Classes and enums for REST API models
Project Organization

Project Organization

Hotels.com (Data Platform Team)

Download road-model-rest

How to add to project

<!-- https://jarcasting.com/artifacts/com.hotels.road/road-model-rest/ -->
<dependency>
    <groupId>com.hotels.road</groupId>
    <artifactId>road-model-rest</artifactId>
    <version>6.0.21</version>
</dependency>
// https://jarcasting.com/artifacts/com.hotels.road/road-model-rest/
implementation 'com.hotels.road:road-model-rest:6.0.21'
// https://jarcasting.com/artifacts/com.hotels.road/road-model-rest/
implementation ("com.hotels.road:road-model-rest:6.0.21")
'com.hotels.road:road-model-rest:jar:6.0.21'
<dependency org="com.hotels.road" name="road-model-rest" rev="6.0.21">
  <artifact name="road-model-rest" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.hotels.road', module='road-model-rest', version='6.0.21')
)
libraryDependencies += "com.hotels.road" % "road-model-rest" % "6.0.21"
[com.hotels.road/road-model-rest "6.0.21"]

Dependencies

compile (5)

Group / Artifact Type Version
org.apache.avro : avro jar 1.8.2
com.fasterxml.jackson.core : jackson-annotations jar
com.fasterxml.jackson.core : jackson-core jar
com.fasterxml.jackson.core : jackson-databind jar
io.springfox : springfox-swagger2 Optional jar 2.8.0

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar

test (4)

Group / Artifact Type Version
org.mockito : mockito-core jar 2.8.47
junit : junit jar
org.hamcrest : hamcrest-all jar 1.3
ch.qos.logback : logback-classic jar 1.2.2

Project Modules

There are no modules declared in this project.

Data Highway

Start using

Maven Central GitHub license Build Coverage Status

Overview

What is Data Highway?

The Data Highway is a service that allows data to be easily produced and consumed via JSON messages over HTTPS/WSS. Data is first defined using a schema and a "road" is created which will accept messages that conform to this schema. Producers of data sets thus only need to define the structure of their data and are then able to send their data to a REST endpoint and not be concerned with what happens next. Data Highway will ensure that this data is made available for streaming consumption and also stored reliably in a "data lake" in the cloud for access by end users.

Architecture

Data Highway Architecture

Paver

Paver is Data Highway's administration endpoint. It provides the following features:

  • Road (Synonymous with Kafka topic) creation.
  • Schema registration and (soft) deletion.
  • Data-at-rest to Hive/S3 configuration.
  • Road-level producer and consumer authorisation.
Onramp

Onramp is Data Highway's producer endpoint. It allows users to submit messages to roads in JSON format over HTTPS.

Offramp

Offramp is Data Highway's consumer endpoint. It allows users to consume message from roads in JSON format over WSS.

Tollbooth

Tollbooth is the core of Data Highway. It provides the mechanism by which mutations to a road's model are persisted. Mutations can come from users (Paver) or internal agents. Anything wishing to make a mutation submit's a JSON Patch onto a deltas Kafka topic. Tollbooth consumes this topic, continuously applying patches to models and persisting them back onto the main Model (compact) topic.

Traffic Control

Traffic Control is the Kafka Agent. It is primarily responsible for managing Kafka topics in response to changes in models.

Loading Bay / Truck Park

Loading Bay is responsible for orchestrating the landing of data to S3 on a configured interval and managing Hive tables - creation, schema mutation and the addition of partitions.

Try it out

Try Test Drive, an in-memory version of Data Highway that exposes all the public facing endpoints in a single Spring Boot application or Docker container.

docker run -p 8080:8080 hotelsdotcom/road-test-drive:<tag>

Examples

Using a local instance of Test Drive, try creating road, registering a schema and producing and consuming messages using the build in user account user:pass.

Note: For the example below, cURL will prompt for a password which is pass.

Create a road

curl -sk \
  -u user \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
  "name": "my_road", 
  "description": "My Road",
  "teamName": "TEAM", 
  "contactEmail": "[email protected]",
  "partitionPath": "$.foo",
  "enabled": true,
  "authorisation": {
    "onramp": {
      "cidrBlocks": ["0.0.0.0/0"],
      "authorities": ["*"]
    },
    "offramp": {
      "authorities": {
        "*": ["PUBLIC"]
      }
    }
  }
}' https://localhost:8080/paver/v1/roads

Register a schema

curl -sk \
  -u user\
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
  "type" : "record",
  "name" : "my_record",
  "fields" : [
    {"name":"foo","type":"string"},
    {"name":"bar","type":"string"}
  ]
}' https://localhost:8080/paver/v1/roads/my_road/schemas

Produce messages

curl -sk \
  -u user\
  -H "Content-Type: application/json" \
  -d '[{"foo":"foo1","bar":"bar1"}]' \
  https://localhost:8080/onramp/v1/roads/my_road/messages

Consume messages

echo '{"type":"REQUEST","count":1}' |\
  websocat -nk wss://localhost:8080/offramp/v2/roads/my_road/streams/my_stream/messages?defaultOffset=EARLIEST

See: websocat

Building

Build and load docker images to the local docker daemon:

mvn clean package -Djib.goal=dockerBuild

Build without docker images:

mvn clean package -Djib.skip

Build and push docker images to a repo:

mvn clean package -Ddocker.repo=my.docker.repo

Contributors

Special thanks to the following for making data-highway possible!

Dave Maughan
Dave Maughan

๐Ÿ’ป ๐ŸŽจ ๐Ÿ‘€ ๐Ÿ“–
James Grant
James Grant

๐Ÿ’ป ๐ŸŽจ ๐Ÿ‘€ ๐Ÿ“– ๐Ÿ“ข
Elliot West
Elliot West

๐Ÿ’ป ๐ŸŽจ ๐Ÿ‘€ ๐Ÿ“– ๐Ÿ“ข
Adrian Woodhead
Adrian Woodhead

๐Ÿ’ป ๐ŸŽจ ๐Ÿ‘€ ๐Ÿ“–
Konrad Dowgird
Konrad Dowgird

๐Ÿ’ป ๐ŸŽจ ๐Ÿ‘€ ๐Ÿ“–
Riccardo Freixo
Riccardo Freixo

๐Ÿ’ป ๐ŸŽจ ๐Ÿ‘€ ๐Ÿ“– ๐Ÿš‡
Monica Nicoara
Monica Nicoara

๐Ÿค” ๐Ÿ“‹
Kyriakos Sideris
Kyriakos Sideris

๐Ÿ’ป
Sandeep Solanki
Sandeep Solanki

๐Ÿ’ป

This project follows the all-contributors specification.

Legal

This project is available under the Apache 2.0 License.

Copyright 2019 Expedia, Inc.

com.hotels.road

Hotels.com

Hotels.com open source contributions

Versions

Version
6.0.21
6.0.20
6.0.18
6.0.17
6.0.16
6.0.15
6.0.14
6.0.13
6.0.12
6.0.11
6.0.10
6.0.9
6.0.8
6.0.7
6.0.6
6.0.5
6.0.4
6.0.3
6.0.2
6.0.1