Commit 69b7b1a4 authored by lemin's avatar lemin

commit

parent dad95263
...@@ -24,7 +24,7 @@ import static org.axonframework.modelling.command.AggregateLifecycle.apply; ...@@ -24,7 +24,7 @@ import static org.axonframework.modelling.command.AggregateLifecycle.apply;
public class WMSAggregate { public class WMSAggregate {
@AggregateIdentifier @AggregateIdentifier
private String id; private String whId;
private int quantiy; private int quantiy;
...@@ -35,20 +35,20 @@ public class WMSAggregate { ...@@ -35,20 +35,20 @@ public class WMSAggregate {
} }
@EventSourcingHandler @EventSourcingHandler
public void createProduct(InventoryCreatedEvent event) { public void createInventory(InventoryCreatedEvent event) {
this.id = event.getProductId(); this.whId = event.getWhId();
this.quantiy = event.getQuantity(); this.quantiy = event.getQuantity();
} }
@CommandHandler @CommandHandler
public void changeQuantity(ChangeInventoryQuantityCommand command) { public void changeInventoryQuantity(ChangeInventoryQuantityCommand command) {
log.info("[@CommandHandler ProductchangeQuantity]"); log.info("[@CommandHandler ProductchangeQuantity]");
if(this.quantiy < command.getQuantity()) throw new IllegalArgumentException("tfy "); if(this.quantiy < command.getQuantity()) throw new IllegalArgumentException("tfy ");
apply(new InventoryQuantityChangedEvent(command.getProductId(), this.quantiy - command.getQuantity())); apply(new InventoryQuantityChangedEvent(command.getProductId(), this.quantiy - command.getQuantity()));
} }
@EventSourcingHandler @EventSourcingHandler
public void changeQuantity(InventoryQuantityChangedEvent event) { public void changeInventoryQuantity(InventoryQuantityChangedEvent event) {
this.quantiy = event.getQuantity(); this.quantiy = event.getQuantity();
} }
......
...@@ -11,5 +11,5 @@ public class InventoryCreatedEvent { ...@@ -11,5 +11,5 @@ public class InventoryCreatedEvent {
private String whId; private String whId;
private String productId; private String productId;
private String whName; private String whName;
private int quantity; private Integer quantity;
} }
...@@ -18,7 +18,7 @@ public class InventoryEventHandler { ...@@ -18,7 +18,7 @@ public class InventoryEventHandler {
private final InventoryRepository inventoryRepository; private final InventoryRepository inventoryRepository;
@EventHandler @EventHandler
protected void saveProduct(InventoryCreatedEvent inventoryCreatedEvent) { protected void saveInventory(InventoryCreatedEvent inventoryCreatedEvent) {
log.info("InventoryCreatedEvent 이벤트 받음?"); log.info("InventoryCreatedEvent 이벤트 받음?");
log.info("InventoryEventHandler > [InventoryCreatedEvent] productCreatedEvent"); log.info("InventoryEventHandler > [InventoryCreatedEvent] productCreatedEvent");
...@@ -33,7 +33,7 @@ public class InventoryEventHandler { ...@@ -33,7 +33,7 @@ public class InventoryEventHandler {
} }
@EventHandler @EventHandler
protected void changeQuantity(InventoryQuantityChangedEvent inventoryQuantityChangedEvent) { protected void changeInventoryQuantity(InventoryQuantityChangedEvent inventoryQuantityChangedEvent) {
log.info("InventoryQuantityChangedEvent 이벤트 받음?"); log.info("InventoryQuantityChangedEvent 이벤트 받음?");
log.info("[InventoryQuantityChangedEvent]"); log.info("[InventoryQuantityChangedEvent]");
InventoryEntity inventoryEntity = inventoryRepository.findById(inventoryQuantityChangedEvent.getProductId()).get(); InventoryEntity inventoryEntity = inventoryRepository.findById(inventoryQuantityChangedEvent.getProductId()).get();
......
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