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…

There is a Hugo official example which describe how to implement a navigation breadcrump here: Example: Breadcrumb Navigation Anyway I didn’t make it work as I expected. I think it may not work if we oragnize contents use nested subdir.However I will implement a breadcrumb based on Hugo contains function. (1) Precondition Hugo where contains function has been integratedHugo “contains” operator implementation in “where” function, and have a section template like below:

Read More…