The assignment is a solution to the problem statement mentioned in the problem.txt file.
- PublisherSubscriberAssignment
-- PublisherModules: For sending messages
--- publisher.go
-- ConsumerModules: For receiving messages & storing in database
--- helpers: Require library helpers for project
--- confighelpers: Configurations related services
--- dbhelpers: DB connection related services
--- loghelpers: Log related services
--- models: Database related models
--- services: Database related models
--- consumer.go: Application entry point
--- config.json: Consumer related configurations
git clone https://github.com/imwaddy/PublisherSubscriberAssignment
cd PublisherSubscriberAssignment
Note: 1. Please verify the configurations in config.json
before you start.
2. Log file is going to create in PublisherSubscriberAssignment/ConsumerModules/
named consumer.log
cd ConsumerModules
go mod tidy
go run consumer.go
cd PublisherModules
go run publisher.go
Note: Make sure the Consumer is running before you run the Publisher.
A test case is available for database service in PublisherSubscriberAssignment/ConsumerModules/services
named hotelService_test.go
.
To run the test case:
cd PublisherSubscriberAssignment/ConsumerModules/services
go test hotelService_test.go hotelService.go