Commit ae755bcf authored by Alex Pinto's avatar Alex Pinto

fixed merge conflicts

parents 121ccfc2 fae92463
File deleted
......@@ -3,6 +3,7 @@ target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
.DS_Store
### STS ###
.apt_generated
......
......@@ -17,27 +17,42 @@
---
## Details
#### Schema
### Schemas
#### Warehouse Order
```
{
_id: String
orderId: String
status: String "unfulfilled" (default) > "fulfilled"/"cancelled"
orderObject?: (will have it on initial Kafka message, not sure if we need to store this)
id: String,
orderId: String,
status: String "RECEIVED" (default) > "FULFILLED"/"CANCELLED",
createdAt: Date,
modifiedAt: Date,
orderItems: List<Item>,
address: String,
}
```
#### Workflow
- Warehouse Management (WM) expects an Order object (?) from Order Management (OM) on order placement in Kafka.
- On receipt of an Order object, WM will create a warehouse order entry in database with a status of "unfulfilled."
#### Item
```
{
itemId: String,
itemName: String,
itemQuantity: int,
itemPrice: float,
itemSku: int,
}
```
### Workflow
- Warehouse Management (WM) expects an Order object from Order Management (OM) on order creation in Kafka.
- On receipt of an Order object, WM will create a warehouse order entry in database with a status of **"RECEIVED"**.
- In the WM UI, a warehouse manager will have the ability to fulfill or cancel unfulfilled orders.
- When an order is marked **"fulfilled"** or **"cancelled"**, a Kafka message will be sent to be consumed.
- When an order is marked **"FULFILLED"** or **"CANCELLED"**, a Kafka message will be sent to be consumed.
#### UI
- Login
- Order status update screen mark orders as fulfilled or cancelled
- Order search
- Order information page
### UI
- Login/Logout
- Order Status and Update orders as **"FULFILLED"** or **"CANCELLED"**
- Order Filter and Search
- Order Details
#### API Documentation
https://documenter.getpostman.com/view/7402212/TzRNGATe
......@@ -93,16 +93,17 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger2</artifactId>-->
<!-- <version>2.7.0</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger-ui</artifactId>-->
<!-- <version>2.7.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
......
......@@ -3,24 +3,13 @@ package com.ascendfinalproject.warehouse;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
//@EnableSwagger2
public class WarehouseApplication {
public static void main(String[] args) {
SpringApplication.run(WarehouseApplication.class, args);
}
// @Bean
// public Docket productApi() {
// return new Docket(DocumentationType.SWAGGER_2).select()
// .apis(RequestHandlerSelectors.basePackage("com.ascendfinalproject.warehouse")).build();
// }
}
......@@ -32,6 +32,9 @@ public class KafkaConfig {
@Value("${kafka.consumer.group-id}")
private String groupId;
@Value("${kafka.topic.input}")
private String omsTopic;
@Bean
public Map<String, Object> consumerFactory() {
......@@ -44,10 +47,10 @@ public class KafkaConfig {
}
@Bean
public KafkaReceiver<String, String> kafkaEventReceiver(@Value("${kafka.topic.input}") String topic) {
public KafkaReceiver<String, String> kafkaEventReceiver() {
ReceiverOptions<String, String> receiverOptions = ReceiverOptions.create(consumerFactory());
receiverOptions.maxCommitAttempts(5);
return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator).subscription(Collections.singleton(topic)));
return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator).subscription(Collections.singleton(omsTopic)));
}
......
package com.ascendfinalproject.warehouse.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Order Management PRO")
.build();
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.useDefaultResponseMessages(false)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
}
}
package com.ascendfinalproject.warehouse.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.ResourceHandlerRegistry;
import org.springframework.web.reactive.config.WebFluxConfigurer;
@Configuration
@EnableWebFlux
public class WebFluxConfig implements WebFluxConfigurer
{
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/swagger-ui.html**")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
......@@ -42,11 +42,11 @@ public class WarehouseController {
.defaultIfEmpty(ResponseEntity.status(HttpStatus.NOT_FOUND).body(null));
}
@CrossOrigin
@PostMapping(value = "/kafkaOrders")
public void createOrderKafka(@Valid @RequestBody WarehouseOrderRequest order) {
sender.sendOrder(order);
}
// @CrossOrigin
// @PostMapping(value = "/kafkaOrders")
// public void createOrderKafka(@Valid @RequestBody WarehouseOrderRequest order) {
// sender.sendOrder(order);
// }
@CrossOrigin
@PostMapping(value = "/orders")
......
......@@ -23,21 +23,21 @@ public class Sender {
private KafkaSender<String, WarehouseOrderResponse> kafkaUpdateEventProducer;
private static final String TOPIC = "warehouse_management";
private static final String OMS = "order_management";
public void sendOrder(WarehouseOrderRequest currentOrder) {
ProducerRecord<String, WarehouseOrderRequest> record = new ProducerRecord<>(OMS, currentOrder);
Flux<SenderResult<WarehouseOrderRequest>> sendToKafka = kafkaOMSProducer.send(Mono.just(SenderRecord.create(record, currentOrder)))
.doOnError(throwable -> System.out.println(throwable))
.doOnNext(t -> {
if (null != t.exception()) {
System.out.println("it works!");
}
});
sendToKafka.doOnError(throwable -> log.error("error")).subscribe();
}
private static final String TOPIC = "WMOS_ORDER_UPDATE";
private static final String OMS = "OMS_ORDER_UPDATE";
// public void sendOrder(WarehouseOrderRequest currentOrder) {
// ProducerRecord<String, WarehouseOrderRequest> record = new ProducerRecord<>(TOPIC, currentOrder);
// Flux<SenderResult<WarehouseOrderRequest>> sendToKafka = kafkaOMSProducer.send(Mono.just(SenderRecord.create(record, currentOrder)))
// .doOnError(throwable -> System.out.println(throwable))
// .doOnNext(t -> {
// if (null != t.exception()) {
// System.out.println("it works!");
// }
// });
// sendToKafka.doOnError(throwable -> log.error("error")).subscribe();
// }
public void sendUpdatedOrder(WarehouseOrderResponse currentOrder) {
ProducerRecord<String, WarehouseOrderResponse> record = new ProducerRecord<>(TOPIC, currentOrder);
......
......@@ -9,15 +9,14 @@ import lombok.ToString;
@ToString
public class Address {
public Address() {
}
private String street;
private String city;
private String state;
private String zip;
public Address() {
}
public Address(String street, String city, String state, String zip) {
this.street = street;
this.city = city;
......
......@@ -14,10 +14,13 @@ public class Item {
private String itemId;
private String itemName;
private int itemQuantity;
private double itemPrice;
private int itemSku;
private float itemPrice;
private String itemSku;
public Item(String itemId, String itemName, int itemQuantity, double itemPrice, int itemSku) {
public Item() {
}
public Item(String itemId, String itemName, int itemQuantity, float itemPrice, String itemSku) {
this.itemId = itemId;
this.itemName = itemName;
this.itemQuantity = itemQuantity;
......@@ -25,7 +28,5 @@ public class Item {
this.itemSku = itemSku;
}
public Item() {
}
}
......@@ -8,6 +8,7 @@ import org.springframework.data.annotation.Id;
@Setter
public class Session {
@Id
private String token;
private User user;
}
package com.ascendfinalproject.warehouse.models;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class User {
private String email;
private String familyName;
private String givenName;
private String googleId;
private String imageUrl;
private String name;
public User() {
}
}
......@@ -8,4 +8,9 @@ server.port=8080
kafka.producer.bootstrap-servers: localhost:9092
kafka.producer.acks: all
kafka.consumer.group-id: WAREHOUSE_MANAGEMENT
kafka.topic.input: order_management
\ No newline at end of file
kafka.topic.input: OMS_ORDER_UPDATE
#kafka.topic.input: OMS_ORDER_UPDATE
server.port=8081
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment