June 2017
Intermediate to advanced
400 pages
10h 32m
English
This recipe creates a framework for processing requests in a fan-out async way using a single client. It will attempt to retrieve as many URLs as you specify as quickly as it can. In many cases, you'd want to restrict this further with something like a worker pool. It may also make sense to handle these async Go routines outside of the client and for specific storage or retrieval interfaces.
This recipe also explores using a case statement to switch on multiple channels. We handle the locking problem since we know how many responses we'll receive and we complete only after receiving them all. Another option would be a timeout if we were okay with dropping certain responses.
Read now
Unlock full access