| # DMN + Spring Boot example |
| |
| ## Description |
| |
| A simple DMN service to evaluate a traffic violation. |
| |
| ## Installing and Running |
| |
| ### Prerequisites |
| |
| You will need: |
| - Java 1.8.0+ installed |
| - Environment variable JAVA_HOME set accordingly |
| - Maven 3.5.4+ installed |
| |
| ### Compile and Run |
| |
| ``` |
| mvn clean compile spring-boot:run |
| ``` |
| |
| ## Example Usage |
| |
| Once the service is up and running, you can use the following example to interact with the service. |
| |
| ### POST /Traffic Violation |
| |
| Returns penalty information from the given inputs -- driver and violation: |
| |
| ```sh |
| curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"Driver":{"Points":2},"Violation":{"Type":"speed","Actual Speed":120,"Speed Limit":100}}' http://localhost:8080/Traffic%20Violation |
| ``` |
| |
| As response, penalty information is returned. |
| |
| Example response: |
| ```json |
| { |
| "Violation":{ |
| "Type":"speed", |
| "Speed Limit":100, |
| "Actual Speed":120 |
| }, |
| "Driver":{ |
| "Points":2 |
| }, |
| "Fine":{ |
| "Points":3, |
| "Amount":500 |
| }, |
| "Should the driver be suspended?":"No" |
| } |
| ``` |
| |