New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forward URL - loosing data when processing over 30 per second #4132
Comments
I think we should use one of the standard messaging protocol. For example, AMQP or MQTT. Latter might be a better option because it is designed for telemetry data like GPS location and sensor data. Many other GPS tracking and IoT systems support it. |
good point Anton, I totally forgot about MQTT. I guess there is nothing baked into traccar that uses MQTT so would need another dependency? if you know of any I should look at please let me know. I'm a bit confused on the best section to implement this Would I simply add this to config file and create a new class with that name to handle the data to send? |
I guess we need another dependency. Make sure you do investigation on available solutions to ensure that it's well maintained popular library. I think you can implement it similar to existing forwarding handler. |
I'd very much like to see MQTT there, and I believe the Paho Java MQTT implementation is rather solid. We've had excellent experience with MQTT (C, Python, etc.) and greatly appreciate the fact that it's very lightweight and that there are several Open Source brokers to choose from (Mosquitto, VerneMQ and others). It might amuse you to know that we actually currently forward to a program which then publishes to MQTT :-) |
I think Eclipse Paho is the choice https://github.com/eclipse/paho.mqtt.java And, as MQTT is supported by most Queueing systems as an input channel (RabbitMQ, etc.), it can be used with a variety of systems, not only pure MQTT brokers. I would like to support the implementation, but my experience is in C, Python, not Java. But I stand by for testing. Another thought: if we implement MQTT to forward Positions, we should should do likewise for Events. |
Have a look at the last link on this page Does it look like this has already been done? |
Judging by the README, yes, but this looks quite like a way I would not implement it, as re-assembling all the bits on an MQTT subscriber side would be a lot of work.
I'd be much more in favor of having the JSON payloads we currently have in HTTP when a position and an event is POSTed. |
Thanks, so you think each piece of data is being posted via mqtt instead of one payload? I've got it up and running and it looks like its eventually sending everything in one go, but I could be wrong as this is new area for me This is the line that looks like is does the sending: However I get an error
From the googling i've done, it looks like an intelliJ environment issue. |
The error has nothing to do with intelliJ. Looks like you are just missing some templates. |
Thanks Anton |
@quade1664 the example I showed above, taken from the fork's README indicates they are publishing each value individually; no doubt about that. See also: ivanfmartinez/ivanfm-traccar-mqtt#2 I cannot help you with Java stuff whatsoever, but I think I see something like Guesswork. :-) |
Create a file and see what happens: $ mkdir mqtt-alarm
$ echo Hello > mqtt-alarm/unknown.vm |
I found RabbitMQ to be the best solution. Added few lines of code from their site and it is working well |
Thanks @jpmens, i'll check it out |
Hi Anton Are you aware of any documentation or support forums where this might have been covered previously? In intelliJ i've included all dependencies and built the artifacts, but its created 42mb file - which looks too big I assume i'm on the wrong track here |
I usually just package JAR file using maven directly, not from IDE. |
@tananaev can you put the dependancies for AMQP and MQTT so that we can just replace the tracker-server.jar without the error of |
I think you'd better put these dependencies in yourself I assume you have tried publishing with maven as anton suggested, but its not been referenced |
We do have a forwarding queue now and support retries. |
I've noticed a performance issue when forwarding lots of data per second
I've can see all the data in the DB, but not all of it makes it to the other end after being forwarded.
As discussed here
https://www.traccar.org/forums/topic/forward-url-is-there-a-limitperformance-tuning-that-can-be-done/
I would like to suggest an alternative solution of using MSMQ or RABBITMQ to drop the messages, therefore bypassing the performance limitation.
I've been looking into this today, but would like some help on the architecture side, instead of a denied pull request, or just a poorly performant integration.
I'm suggesting the following
Add the config flags
Forward.MessageQueueEnabled (true, false)
Forward.MessageQueueType (MSMQ, RABBIT etc)
Forward.MessageQueueName (name of the queue goes here)
then in this file:
https://github.com/traccar/traccar/blob/master/src/org/traccar/WebDataHandler.java
Edit this method:
protected Position handlePosition(Position position) {}
And have an IF statement
Firstly does the above sound like an ok solution?
Next up is the type of Queue to use
I'm using microsoft message queue, however, thats mainly as i'm doing mostly C#, and I'm not sure how well Java plays with this tech, there are a couple of projects out there with java and msmq, but i'd rather not have to add lots of dependencies in the project
What other types of queues are available that might easily plug into traccar without having to load any/many dependencies ?
any advice or pointer appreciated
alternatively, i could use addDynamicHandlers in BasePipelineFactory
But I cannot find any documentation or forums posts to get me going on this section
The text was updated successfully, but these errors were encountered: