This repository explores the usage of go routines in GoLang.
The examples demonstrate practical applications using channels, context and concurrency management.
Make sure that you have installed go 1.22.1 or higher to run these examples.
The booking process ensures that room booking proceeds only if the room is available. Otherwise, it cancels all booking processes.
To run the booking process, execute the following command:
go run booking/main.go
The server component runs a backend server capable of processing or rejecting requests based on the request context.
To run the server, execute the following command:
go run server/main.go
To test this server as a client, use the following command:
curl localhost:8080
This example demonstrates a client application utilizing context with a timeout to enforce a request failure if the context deadline is exceeded.
To run this client example, execute the following command:
go run client/main.go
For a comprehensive demonstration, run this client alongside the server/main.go
. This setup will illustrate the expected results for each side, showcasing the timeout behavior and its impact on request handling.
This example demonstrates a execution of parallel tasks utilizing channels and waiting groups.
To run this client example, execute the following command:
go run channel/main.go