开发者

Best Practises for developing a TCP Communicator

开发者 https://www.devze.com 2023-03-06 04:34 出处:网络
We are developing a Vehicle Tracking System. In this system, we fix a GPS device into the vehicle which sends the location data to our server using TCP communication. There can be more than 1000\'s of

We are developing a Vehicle Tracking System. In this system, we fix a GPS device into the vehicle which sends the location data to our server using TCP communication. There can be more than 1000's of devices sending data at any given time. Please suggest me the best practices I should follow to build t开发者_运维百科he TCP communicator. We are using java as programming language and MySQL as database server.

I need your suggestions on best practices I should follow along with the reasons. e.g. I should follow Thread-per-connection model or Thread-on-event model of multi-threading? Why that model? How should I implement connection pooling? Shall I implement messaging queue?,etc..

Thanks, Saurabh


I have built a similar system. I used Mule3 for the tcp server listener and then after reading the data I just forwarded the data using JMS to an ActiveMQ server.

I had around 10-20 listeners on each queue processing the data, putting it in my database, running rules over the data to determine if alarms need to be sent etc.

This resultet in a very stable an easy to work environment. Small modules with specific tasks.


  1. Use NIO and make full use of multi-threading. If possible use some exisitng libraries like MINA
0

精彩评论

暂无评论...
验证码 换一张
取 消