Skip to content

Commit

Permalink
adding model jar
Browse files Browse the repository at this point in the history
  • Loading branch information
piomin committed Jun 9, 2021
1 parent c8d80ea commit c013a29
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
43 changes: 43 additions & 0 deletions saga/model-saga/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>saga</artifactId>
<groupId>pl.piomin.samples</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>model-saga</artifactId>

<dependencies>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<source>11</source>
<target>11</target>
</configuration>
</plugin>

</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package pl.piomin.samples.quarkus.serverless.model;

import lombok.*;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "orders")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Order implements Serializable {

@Id
@GeneratedValue
private Long id;
private Integer customerId;
private Integer productId;
private int amount;
private int productCount;
@Enumerated
private OrderStatus status = OrderStatus.NEW;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package pl.piomin.samples.quarkus.serverless.model;

public enum OrderStatus {
NEW, REJECTED, CONFIRMED, IN_PROGRESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// camel-k: dependency=mvn:org.apache.camel.quarkus:camel-quarkus-jackson
// camel-k: dependency=mvn:io.quarkus:quarkus-jdbc-h2
// camel-k: dependency=mvn:org.projectlombok:lombok:1.18.16
// camel-k: build-property=quarkus.package.type=uber-jar

@ApplicationScoped
public class OrderRoute extends RouteBuilder {
Expand All @@ -40,6 +39,7 @@ public void configure() throws Exception {
.post("/confirm").consumes("application/json").type(Order.class)
.route()
.unmarshal(format)
// .unmarshal().json(JsonLibrary.Jackson, Data.class)
.toD("jpa:" + Order.class.getName() + "?query=select o from Order o where o.id= ${body.id}")
.log("Status: ${body[0].status.toString()}")
.choice()
Expand Down

0 comments on commit c013a29

Please sign in to comment.