-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add a MQTT GTFS-RT trip update updater #2516
Conversation
LOG.debug("Connected"); | ||
client.subscribe(topic, qos); | ||
} catch (MqttException e) { | ||
LOG.warn("Could not subsctibe to: " + topic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"subscribe"
@hannesj Somewhat off topic (apologies) - would you be willing to share the URL of your MQTT feed when available so we can add support for this transport method in the GTFS-realtime validator? I've opened an issue here for topic if you'd like to continue the discussion there - CUTR-at-USF/gtfs-realtime-validator#317. |
@barbeau sure! Just a correction, the GTFS-RT feed is still encoded as protobufs, they are just transported as MQTT messages, instead of polling from a server or using websocket as the transport. |
@hannesj Ah, gotcha, that makes sense (you can tell I haven't worked with MQTT before ;) ). But the MQTT messages contain full messages with |
I told some of you today about our ITxPT standardisation for messages between vehicles and backend. the message transport is also here based on MQTT and protobuf. Let's see if we should use MQTT/protobuf for our SIRI updaters as well, @t2gran |
@barbeau we would be differential messages in order to better preserve the history in OTP. Also the size difference would be quite considerable, as we push updated predictions with up to 1/s frequency |
@hannesj Interesting - GTFS-rt says the following about differential messages:
Just curious if you have additional design documentation to specify some of this behavior? If so and it works well in practice it may be worth trying to get some of this officially adopted into the spec. I'm looking at this from the GTFS-realtime validation point of view too. Right now there are no validation rules for differential feeds because of the above. If we're seeing these in production in the wild it would be good to try and formalize some of the common behavior being used. |
The specification may say that it's unsupported, but that text has been around for a long time, and significant practical work has been done toward demonstrating how this mode could/should work. As part of a Dutch transportation ministry project in 2013, OpenTripPlanner was modified to consume a continuous stream of GTFS-RT messages in differential mode over websockets. The transport protocol was chosen over our own initial choice (ZeroMQ) to conform to existing practice in One Bus Away and following advice from other developers who had experimented with the same thing. The Plannerstack platform is providing OTP-based routing on a complete open data set for the Netherlands, with updates at least once a minute from every vehicle in the country. This is all being done with differential GTFS-RT over Websockets interfacing with One Bus Away modules. We have well-established semantics and implementations for these ideas that have been around for several years. If there is still ambiguity about this we can certainly document the way this existing system interprets the spec. |
It's actually pretty simple. To summarize, our differential GTFS-RT uses trip-level granularity, and the effects of successive messages about the same trip do not accumulate. An update about a trip is always cleanly applied to the base trip from the original static feed, with no consideration for any previously received message. The differential effect comes from accumulating changes to different trips across the whole data set. |
If people in Norway and Finland are using these same rules (which is probably the case if we're all using OTP just with different transport layers) then we can create a joint document promoting this interpretation of differential mode. |
Thanks @abyrd! Yes, I'd love to get this behavior documented and adopted into the spec. I've opened an issue at google/transit#84 where we can start tracking documentation related to differential messages, with the goal of creating a proposal to get the documented behavior into the GTFS-realtime spec. Anyone, please feel free to comment more there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR itself looks good to me, the main remaining action is to make this widely-accepted definition of differential GTFS-RT official, and @barbeau has already created an issue for that elsewhere.
FYI - GTFS-rt issue for formalizing |
If anyone wants to test the implementation using HSL real-time data, it is available with the following updater configuration. This is in conjunction with this GTFS file
|
Thanks for the config @hannesj, we should indeed test this out before merging just as a matter of good procedure. |
Thanks @hannesj! Could you share URLs to your feed (and any documentation) as well as links to the user-facing deployment of OTP that consumes this feed in the GTFS-realtime issue google/transit#84? |
The GTFS-RT-feed is published on |
@barbeau did you ever get a chance to test this PR? I'm going to change the base to the new |
Oh, looks like it no longer compiles when updated to dev-1.x. But it might be a quick fix. |
@abyrd said:
Unfortunately not yet. |
301b3cf
to
695de81
Compare
* <pre> | ||
* bessersmith.type = mqtt-gtfs-rt-updater | ||
* bessersmith.feedId = hsl | ||
* bessersmith.url = ssl://mqtt.hsl.fi:443 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented for OTP2 in #3094 |
The GTFS-RT standard doesn't limit the transport method for the protobufs for the realtime messages. We are in the process of implementing a MQTT-based transport and have created the required GTFS-RT updater for that based on the Apache Paho library.