Skip to content

Commit

Permalink
Merge pull request #5642 from opentripplanner/abyrd/realtime-startup-…
Browse files Browse the repository at this point in the history
…logging

Make logging of MQTT realtime updater more uniform
  • Loading branch information
leonardehrenfried authored Mar 21, 2024
2 parents 2b7a431 + c80651c commit 29b0010
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ public GtfsRealtimeAlertsUpdater(
this.updateHandler.setTransitAlertService(transitAlertService);
this.updateHandler.setFuzzyTripMatcher(fuzzyTripMatcher);
this.otpHttpClient = new OtpHttpClient();
LOG.info(
"Creating real-time alert updater running every {} seconds : {}",
pollingPeriod(),
url
);
LOG.info("Creating real-time alert updater running every {}: {}", pollingPeriod(), url);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.opentripplanner.framework.tostring.ToStringBuilder;
import org.opentripplanner.transit.service.DefaultTransitService;
import org.opentripplanner.transit.service.TransitModel;
import org.opentripplanner.updater.GtfsRealtimeFuzzyTripMatcher;
Expand Down Expand Up @@ -78,6 +79,7 @@ public MqttGtfsRealtimeUpdater(
new GtfsRealtimeFuzzyTripMatcher(new DefaultTransitService(transitModel));
}
this.recordMetrics = TripUpdateMetrics.streaming(parameters);
LOG.info("Creating streaming GTFS-RT TripUpdate updater subscribing to MQTT broker at {}", url);
}

@Override
Expand Down Expand Up @@ -187,4 +189,14 @@ public void messageArrived(String topic, MqttMessage message) {
@Override
public void deliveryComplete(IMqttDeliveryToken token) {}
}

@Override
public String toString() {
return ToStringBuilder
.of(MqttGtfsRealtimeUpdater.class)
.addStr("url", url)
.addStr("topic", topic)
.addStr("feedId", feedId)
.toString();
}
}

0 comments on commit 29b0010

Please sign in to comment.