Skip to Main Content
Hands-On Software Architecture with Golang
book

Hands-On Software Architecture with Golang

by Jyotiswarup Raiturkar
December 2018
Intermediate to advanced content levelIntermediate to advanced
500 pages
12h 19m
English
Packt Publishing
Content preview from Hands-On Software Architecture with Golang

Reservation

Once the payment callback is fired, we need to create a reservation entity in our booking database. The booking workflow will go through various stages, and this persistent entity will be responsible for maintaining the reservation status for all the microservices involved in the workflow.

The booking service is a REST API, and we will implement it using Gin (which we covered in Chapter 5, Going Distributed). The createReservation API, which is called during the Payment Callback, is defined in the following code:

func createReservation(c *gin.Context) {    var (        reservationDTO HotelReservationDTO        err error        )    if err = c.ShouldBindJSON(&reservationDTO); err == nil {        fmt.Printf("In createReservation : %+v\n", reservationDTO) err = persistReservation(&reservationDTO) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Event-Driven Architecture in Golang

Event-Driven Architecture in Golang

Michael Stack

Publisher Resources

ISBN: 9781788622592Supplemental Content