Category Archives: Development



Consumer Dispatcher

by Jacky Hung

TNC has open sourced a project called Consumer Dispatcher recently at github.

We ‘ve been using Consumer Dispatcher for more than 2 years which helps to consume 100 millions jobs each day. (not a great number of jobs, but consumer dispatcher wont be your bottle neck.)

What is Consumer Dispatcher and Why

Consumer Dispatcher works as a proxy between RabbitMQ and your consumers. Let you scale out and maintain consumers easily.

It can work with all http-based interfaces in any language.

Why

  • You can utilize the functionalities Consumer Dispatcher provides (see next section).
  • When you are using MVC implementation for your project, it makes you easier to write consumer code, scale them out and maintain the consumers. Since Consumer Dispatcher calls your consumer code by sending http request (how does it workhttp request format), you could reuse your infrastructure (like nginx + php) and reuse most of your code to process the business logic (still in MVC way).

The functionalities it provides

functionality list

Please go to What and Why part for each functionality explanation.

How it works

classic way
  • Your publisher publishes jobs to a specific queue inside RabbitMQ. same as classic way
  • Consumer Dispatcher fetches jobs from each queue defined in config file then dispatches each job to your consumer code by sending http requests (http request format).
  • Consumer Dispatcher waits (timeout for each request is configurable) until it gets http response from your consumer code. then Consumer Dispatcher acknowledges the job to the queue if it gets ok (case insensitive) as the content of HTTP response or resends the job if it gets anything else (like 502 HTTP status, or anything other than ok).
  • If you need to speed up consuming one specific queue, you can open Consumer Dispatcher admin interface to add more working executors so that more number of jobs will be fetched from that queue at a time and be consumed.

How to use it

please go to How to use it for the guide.

Consumer Dispatcher Resources

 

There definitely a lot of rooom to improve. Any suggestion is appreciated. Thank you for your support.

Installing and Configuring Behat with Mink and Sahi Headlessly

by Han

Acceptance testing is a valuable tool which should be alongside unit and functional testing in your toolbox. By testing the behavior of the application instead of just the logic in the code, you can find out problems with UI before your users do. It’s a much more concrete, “real world” analysis about the correctness of your application. Even better, you can get the full spectrum of stakeholders involved since it’s much less technical.

Continue reading →

Java at TheNetCircle

by Jacky Hung

Java is a programing language and computing platform. It is the underlying or frontend technology that powers the programs including utilities, games, business applications and etc in many company. Java is fast, reliable and across-platfloms.

Continue reading →

Better code reviews

by Tom

One of the great things about working at The NetCircle is the freedom you are given to improve processes. I realised quickly that one of the things nobody in the team enjoyed is code reviews.

Code reviews benefit everyone involved in them; other developers who have been working on a different feature of the application get to see what you’ve produced (or refactored), and sysadmins get a preview of the code that will be running on their servers, for example. Feedback on .

Continue reading →

Using Riak at The NetCircle

by Joseph

At The NetCircle, we build great software for our clients’ communities and building great communities means that users want to talk to each other, a lot. For several of our clients’ communities, we have started outgrowing the ability of our current messaging systems to handle new data easily. Database sharding, adding new machines and changing data structures have helped get our system to where it is today, but maintaining this system comes at a cost (several system admins have gone nearly bald!).

At The NetCircle, we are always on the lookout for new technologies that could help improve our clients’ communities by expanding the user base or improving the user experience. In the case of our messaging system, not only are we looking at a way to help it grow in the future (stably!), but also create a central system that all our clients’ communities can use as a service rather than having different systems and data storage for each community.
 
Continue reading →

Join Our Team in Shanghai

Now hiring PHP Developer in Shanghai