AMQP Concepts AMQP Concepts Confustion between Connection and Channel A Connection represents a real TCP connection to the message broker, whereas a Channel is a virtual connection (AMPQ connection) inside it. This way you can use as many (virtual) connections as you want inside your application without overloading the broker with TCP connections. You can use one Channel for everything. However, if you have multiple threads, it’s suggested to use a different Channel for each thread.

Read More…

As we known, standard httprouter func has 3 parameters like below: func ViewIndex(w http.ResponseWriter, r *http.Request, ps httprouter.Params){} Sometimes, we need pass additional arguments to httprouter handle func, like: func ViewIndex(w http.ResponseWriter, r *http.Request, ps httprouter.Params, settings map[string]string){} There are two ways to achive this target: Use a wrapper func getIndexWithSettings2(s Settings) httprouter.Handle { return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { // // Settings is in the scope and ps httprouter.

Read More…

Docker Cheatsheet

2018-01-12

Delete all images for i in `docker images | awk 'NR>1{print $1":"$2}'`;do docker rmi $i;done Aliyun docker accelerator /etc/docker/daemon.json {"registry-mirrors": ["https://5s93w9me.mirror.aliyuncs.com"]}