This repository contains a simple sample endpoint implementation for Bid Valuator.
It will accept POST requests from bid valuator on /valuate, and exposes a health check at /healthz.
/valuate will accept the following formats: Binary Protobuf (Content-Type: application/protobuf) Protobuf Text Encoding (Content-Type: text/protobuf) JSON (Content-Type: application/json)
No matter the encoding, the POST request content is expected to be an OpenRTB bid request with MediaMath extensions. The protobuf schema can be found at src/main/proto/google/openrtb/openrtb.proto.
/winnotice will accept the following formats: Binary Protobuf (Content-Type: application/protobuf) JSON (Content-Type: application/json)
No matter the encoding, the POST request content is expected to be a Win Notification request. The protobuf schema can be found at src/main/proto/winnotice/winnotice.proto.
The endpoint will listen on all available interfaces, on port 4567.
The response fields are randomly generated by selecting one of the candidate strategies (found under ext->mm_ext->SelectedEntities
in the bid request). The CPM is increased by 5% if the detected device is present in the WURFL data contained in the
MediaMath enrichments (ext->mm_ext->SelectedEntities[]->CompanionData->TargetValues->29->1->targeted
, see the
WURFL Helper Class implementation and documentation for
further details).
Further information and details can be found in the source code documentation. You may build the javadoc locally by running the following (see Building and Running, below):
$ ./gradlew javadoc
The documentation will be placed in build/docs/javadoc
This project uses the gradle build system, and provides a wrapper script. As long as you have a Java 8 JDK available, you do not need to install any other build dependencies.
To see all build tasks available:
$ ./gradlew tasks
Google jib is used to package the application as a docker container. You
can change the destination image name by editing gradle.properties or creating a gradle.properties
in $HOME/.gradle/gradle.properties and setting bidValuatorImage to the image name you would like to use. The resulting
image can be used by docker run
to launch the containerized endpoint.
To build the docker image via jib:
$ ./gradlew jibDockerBuild
To run the service in the foreground, forwarding local port 4567 to container port 4567 (replace my-bid-valuator-endpoint with your own image name if you changed it):
$ docker run -p 4567:4567 my-bid-valuator-endpoint
Alternatively, you may create a bundle containing everything needed to run the endpoint standalone as a tar or zip:
$ ./gradlew disttar
or
$ ./gradlew distZip
The resulting bundles may then be found in build/distributions
.
To run, extract the distribution, and in the resulting directory:
$ bin/bid-valuator-endpoint
$ ./gradlew test