Original problem description is found here: https://saladtech.notion.site/Salad-s-Technical-Interview-2e7e8c19c4284c61975fd3d4eba3bfbe
Configuration is managed with the following environment variables
The URL for the message router.
Example: data.salad.com:5000
Default:
Required: Yes
Timeout control for open TCP connections. If set to 0, no timeout is set
Example: 30s
Default: 1m
Required: No
Maximum number of times to try opening a connection to the server before exiting. -1 means there's no maximum.
Example: 10
Default: 5
Required: No
The starting duration to wait between retrying TCP connections. This value will increase exponentially for each retry.
Example: 3s
Default: 1s
Required: No
Level for the logger Available log level values are as follows:
- Debug: 0
- Info: 1
- Warn: 2
- Error: 3
- Fatal: 4
- Panic: 5
Example: 2
Default: 1
Required: No
go test ./...
go build ./cmd/processor/main.go
go run ./cmd/processor/main.go
For just checking out the functionality first start up the server:
go run ./cmd/server/main.go
Then set your server URL and run the processor:
# linux
SALAD_MESSAGEROUTER_URL=127.0.0.1:5000 go run ./cmd/processor/main.go
# powershell
$env:SALAD_MESSAGEROUTER_URL="127.0.0.1:5000"; go run ./cmd/processor/main.go
- The problem says the float64 fields have a size of 4 bytes. This obviously doesn't work, but the example does contain enough bytes.
- I made a simple TCP server which just gives a valid response. It can be run using:
go run ./cmd/server/main.go
. Then set the SALAD_MESSAGEROUTER_URL environment variable to127.0.0.1:5000
.