Skip to content

Siri Azure Updater

This is a sandbox extension developed by Skånetrafiken that allows OTP to fetch Siri ET & SX messages through Azure Service Bus. It also enables OTP to download historical data from en HTTP endpoint on startup.

Contact Info

Skånetrafiken, Sweden
developer.otp@skanetrafiken.se

Documentation

Documentation available here.

Configuration

To enable the SIRI updater you need to add it to the updaters section of the router-config.json.

Siri Azure ET Updater

Config Parameter Type Summary Req./Opt. Default Value Since
type = "siri-azure-et-updater" enum The type of the updater. Required 1.5
authenticationType enum Which authentication type to use Optional "sharedaccesskey" 2.5
autoDeleteOnIdle duration The time after which an inactive subscription is removed. Optional "PT1H" 2.5
customMidnight integer Time on which time breaks into new day. Optional 0 2.2
feedId string The ID of the feed to apply the updates to. Optional 2.2
fullyQualifiedNamespace string Service Bus fully qualified namespace used for authentication. Optional 2.5
fuzzyTripMatching boolean Whether to apply fuzzyTripMatching on the updates Optional false 2.2
prefetchCount integer The number of messages to fetch from the subscription at a time. Optional 10 2.5
servicebus-url string Service Bus connection used for authentication. Optional 2.2
topic string Service Bus topic to connect to. Optional 2.2
history object Configuration for fetching historical data on startup Optional 2.2
   fromDateTime string Datetime boundary for historical data Optional "-P1D" 2.2
   timeout integer Timeout in milliseconds Optional 300000 na
   url string Endpoint to fetch from Optional na
Parameter details

authenticationType

Since version: 2.5Type: enumCardinality: OptionalDefault value: "sharedaccesskey"
Path: /updaters/[12]
Enum values: sharedaccesskey | federatedidentity

Which authentication type to use

customMidnight

Since version: 2.2Type: integerCardinality: OptionalDefault value: 0
Path: /updaters/[12]

Time on which time breaks into new day.

It is common that operating day date breaks a little bit later than midnight so that the switch happens when traffic is at the lowest point. Parameter uses 24-hour format. If the switch happens on 4 am then set this field to 4.

fullyQualifiedNamespace

Since version: 2.5Type: stringCardinality: Optional
Path: /updaters/[12]

Service Bus fully qualified namespace used for authentication.

Has to be present for authenticationMethod FederatedIdentity.

servicebus-url

Since version: 2.2Type: stringCardinality: Optional
Path: /updaters/[12]

Service Bus connection used for authentication.

Has to be present for authenticationMethod SharedAccessKey. This should be Primary/Secondary connection string from service bus.

Example configuration
// router-config.json
{
  "updaters" : [
    {
      "type" : "siri-azure-et-updater",
      "topic" : "some_topic",
      "authenticationType" : "SharedAccessKey",
      "fullyQualifiedNamespace" : "fully_qualified_namespace",
      "servicebus-url" : "service_bus_url",
      "feedId" : "feed_id",
      "customMidnight" : 4,
      "history" : {
        "url" : "endpoint_url",
        "fromDateTime" : "-P1D",
        "timeout" : 300000
      }
    }
  ]
}

Siri Azure SX Updater

Config Parameter Type Summary Req./Opt. Default Value Since
type = "siri-azure-sx-updater" enum The type of the updater. Required 1.5
authenticationType enum Which authentication type to use Optional "sharedaccesskey" 2.5
autoDeleteOnIdle duration The time after which an inactive subscription is removed. Optional "PT1H" 2.5
customMidnight integer Time on which time breaks into new day. Optional 0 2.2
feedId string The ID of the feed to apply the updates to. Optional 2.2
fullyQualifiedNamespace string Service Bus fully qualified namespace used for authentication. Optional 2.5
fuzzyTripMatching boolean Whether to apply fuzzyTripMatching on the updates Optional false 2.2
prefetchCount integer The number of messages to fetch from the subscription at a time. Optional 10 2.5
servicebus-url string Service Bus connection used for authentication. Optional 2.2
topic string Service Bus topic to connect to. Optional 2.2
history object Configuration for fetching historical data on startup Optional 2.2
   fromDateTime string Datetime boundary for historical data. Optional "-P1D" 2.2
   timeout integer Timeout in milliseconds Optional 300000 na
   toDateTime string Datetime boundary for historical data. Optional "P1D" 2.2
   url string Endpoint to fetch from Optional na
Parameter details

authenticationType

Since version: 2.5Type: enumCardinality: OptionalDefault value: "sharedaccesskey"
Path: /updaters/[11]
Enum values: sharedaccesskey | federatedidentity

Which authentication type to use

customMidnight

Since version: 2.2Type: integerCardinality: OptionalDefault value: 0
Path: /updaters/[11]

Time on which time breaks into new day.

It is common that operating day date breaks a little bit later than midnight so that the switch happens when traffic is at the lowest point. Parameter uses 24-hour format. If the switch happens on 4 am then set this field to 4.

fullyQualifiedNamespace

Since version: 2.5Type: stringCardinality: Optional
Path: /updaters/[11]

Service Bus fully qualified namespace used for authentication.

Has to be present for authenticationMethod FederatedIdentity.

servicebus-url

Since version: 2.2Type: stringCardinality: Optional
Path: /updaters/[11]

Service Bus connection used for authentication.

Has to be present for authenticationMethod SharedAccessKey. This should be Primary/Secondary connection string from service bus.

Example configuration
// router-config.json
{
  "updaters" : [
    {
      "type" : "siri-azure-sx-updater",
      "topic" : "some_topic",
      "servicebus-url" : "service_bus_url",
      "feedId" : "feed_id",
      "customMidnight" : 4,
      "history" : {
        "url" : "endpoint_url",
        "fromDateTime" : "-P1D",
        "toDateTime" : "P1D",
        "timeout" : 300000
      }
    }
  ]
}

Changelog

  • Added configuration for turning off stop arrival time match feature.
  • Initial version (April 2022)
  • Minor changes in logging (November 2022)
  • Retry fetch from history endpoint if it failed (February 2023)
  • Solve a bug in SiriAzureETUpdater and improve error logging (March 2023)
  • Add support with federated identity authentication (February 2024)