need tcp listner code with thread module

ak20159 years ago

Hi,
Can anyone suggest me how can i separate TCP listener code with thread module from traccar. I want to use separate database structure to store position data, So i need this.

Anton Tananaev9 years ago

Traccar can be configured to be use any database. There is no need to separate any code.

ak20159 years ago

@Anton, Actually I want to learn how Netty NIO and TCP listener works together So I have decided to start from one Data parser and Netty Thread.Please let me know how can I do this. I don't want to deploy whole code.

Anton Tananaev9 years ago

If you want to learn about Netty, I would recommend to look at official documentation. I still don't see any reason for not deploying whole Traccar server. It's pretty light-weight.

ak20159 years ago

@Anton, Can u give me some hints how many sql queries are being used by TCP module,Actually I want to replace these with my own table .
As I know there are 3-4 queries
1- To select all device
2- Insert Position
3- Update Position
Is there any other ? Plz let me know..

Anton Tananaev9 years ago

Basically you need only two queries:

  • database.selectDevicesAll
  • database.insertPosition

There seems to be a problem with latest release where it doesn't work properly without some other queries. I'm aware of the issue and I'm working to fix it.

ak20159 years ago

Thnks Anton for your quick reply.I am using old source code(which I downloaded around 26 feb 2016), while I was checking queries,I found there is a query to update last positionId in device Table.Can I comment this query and use some trigger to update another table.and replace deviceAll and InsertPostion query with my own. I am following OpenGts format, using two table EventData and LiveData to store lat lon.

Anton Tananaev9 years ago

Yes, you can comment out "database.updateLatestPosition".