Order shipping
Last updated
Last updated
Shipping service should be created the same way as the other services were created
Once the service is generated, we can again validate that the generation was successful by deploying it to the local cluster. This time the deployment will be done by using the update
command in the CLI, as the local cluster should already be set up from the previous steps.
After the CLI process has been successfully completed, we can validate the deployment using the kubectl
tool
It should return something like this
Shipping service takes care of collecting customers address and listens to the Order payment reserved event so it can trigger order shipping.
Once the order payment reserved event is received, the shipping service checks for customer address. If customer does not have shipping address registered with the shipping service, order is rejected and Order shipment failed event is broadcasted.
If the shipping address is present, the shipping service logs out the message Order shipped to <address>
and broadcasts Order shipment succeeded event.
Order service has been updated to listen to these events and update Order status accordingly.
Before testing new updates, all services should be updated in the local cluster.
We can test the functionality again by creating the order. Once we call the order details endpoint it should return status failed
To fix this issue we should add a customer address by calling the following endpoint
Now that the customer address has been added we can try creating new order.
The order was now successfully created and now has status shipped! To verify that the order has really been shipped lets take a look at shipping service logs using kubectl logs
command. The log should contain Order shipped message.