Skip to content

Commit

Permalink
updating logs
Browse files Browse the repository at this point in the history
  • Loading branch information
salaboy committed Feb 11, 2025
1 parent c82c75d commit aef4814
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ public Integer getAmount() {
public void setAmount(Integer amount) {
this.amount = amount;
}

@Override
public String toString() {
return "Order{" + "id='" + id + '\'' + ", item='" + item + '\'' + ", amount=" + amount + '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public class OrdersRestController {
@Autowired
private DaprMessagingTemplate<Order> messagingTemplate;

/**
* Store orders from customers.
* @param order from the customer
*/
@PostMapping("/orders")
public void storeOrder(@RequestBody Order order) {
logger.info("Storing Order: " + order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public Object run(WorkflowActivityContext ctx) {
customer = customerStore.getCustomer(customer.getCustomerName());
customer.setFollowUp(true);
customerStore.addCustomer(customer);
logger.info("Customer: " + customer.getCustomerName() + " follow-up.");
logger.info("Customer: " + customer.getCustomerName() + " follow-up done.");
return customer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import io.dapr.Topic;
import io.dapr.client.domain.CloudEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -14,12 +16,12 @@ public class TestSubscriberRestController {

private List<CloudEvent> events = new ArrayList<>();

private final Logger logger = LoggerFactory.getLogger(TestSubscriberRestController.class);

@PostMapping("subscribe")
@Topic(pubsubName = "pubsub", name = "topic")
public void subscribe(@RequestBody CloudEvent<Order> cloudEvent){
System.out.println("CONSUME +++++ " + cloudEvent);
System.out.println("ORDER +++++ " + cloudEvent.getData());
logger.info("Order Event Received: " + cloudEvent.getData());
events.add(cloudEvent);
}

Expand Down

0 comments on commit aef4814

Please sign in to comment.