Spire Maritime AIS Source Data Integration now Generally Available

By  Sara Menefee

 24 May 2023

We are excited to announce general availability of the source data integration withSpire Maritime AIS. Meroxa customers can stream maritime activity from theSpire Maritime 2.0 GraphQL API, transform that data using function code, and deliver to any downstream destination in real-time.

This is a first of its kind source data integration with Spire Maritime AIS that works natively with a stream-processing data platform.

Spire Maritime AIS delivers real-time global maritime activity information by using a constellation of satellites and terrestrial sensors that track and transmit vessel and ship signals to provide their location, routes, and movements.

Organizations worldwide analyze and process insights from the Spire AIS APIs and TCP stream to help with global logistics, collision avoidance, surveillance, fishery management, and environmental monitoring.

Meroxa is a Stream Processing Data Application Platform as a Service that enables developers to build and run stream-processing data applications that respond to real-time data and events while managing all of the underlying infrastructure required to scale stream-processing workloads.

The Meroxa platform manages the underlying infrastructure required to scale stream-processing data applications and was designed to work natively with our own in-house designed, easy-to-use application framework called Turbine. Turbine enables developers to quickly build using popular programming languages, such as Python, JavaScript, Ruby, and Go, without needing to write domain-specific code.

Getting started with Spire Maritime AIS on Meroxa

To stream maritime activity from Spire Maritime AIS on the Meroxa Platform, you must have an existing Spire AIS client account. If you are not already a client and wish to purchase Spire AIS products, you should contact the Spire AIS team directly.

Once you have a unique API token, login to your Meroxa account and create a Spire Maritime AIS resource. Don’t have a Meroxa account? Contact us to get started.

Create a Spire Maritime AIS Resource

In order for a Turbine streaming application to securely connect with the Spire Maritime 2.0 GraphQL API as a source, a Resource must be created.

Resources are used by the Meroxa platform to abstract sensitive credentials away from the Turbine application code. In this section, we’ll guide you through the steps on how to create Spire Maritime AIS Resources.

As mentioned earlier, we require a unique Spire Maritime 2.0 GraphQL API token to create a Meroxa resource. This can be acquired by contacting a representative at Spire AIS. Once you have received your API token, login to your Meroxa account and create a Spire Maritime AIS resource in one of two ways:

Meroxa CLI

In the following example, we create a Spire Maritime AIS resource named my-spire-ais. Resources names may contain lowercase letters, numbers, underscores, and hyphens. We recommend that you choose something easy to identify as this will be used to refer to your Spire Maritime AIS resource when writing your Turbine application code.

Using the Meroxa CLI by running the following command:

meroxa resource create my-spire-ais \
--type spire_maritime_ais \

Replace the $SPIRE_MARITIME_AIS_API_TOKEN placeholder in the example command above with the API token provided by the Spire AIS team. When you’re ready, simply hit return and wait for confirmation through the Meroxa CLI that the resource has been successfully created.

Meroxa Dashboard

Below are the steps required to create a Spire Maritime AIS resource using the Meroxa Dashboard:

  1. Navigate to theResources tab.
  2. Click the Add a Resource button.
  3. Search for Spire Maritime AIS using the search bar.
  4. Click the Add Resource button forSpire Maritime AIS.
  5. Confirm you are on the Add a resource form withSpire Maritime AIS selected.
  6. Provide a valid Resource Name (e.g.,my-spire-ais,myspire,spire123).
  7. Provide a valid and unique Spire Maritime AIS API token.
  8. Click the Save button.

Resources can be updated in the Meroxa dashboard by going to theResources tab in the dashboard and clicking on theSpire Maritime resource you’d like to update. You can update

We do not display credentials, such as the API token, in any of our interfaces. However, if you need to update the API token at any time, you can do so in the Meroxa Dashboard or the Meroxa CLI.

A notification in the dashboard will appear once your Spire Maritime AIS resource has been successfully created.

Using Spire Maritime AIS as a Source with Turbine

Now that a Spire Maritime AIS resource has been created, you can use the Turbine application framework to stream and transform data in real-time directly from the Spire Maritime 2.0 GraphQL API to any destination. To do this, you must have the Meroxa CLI installed.

In the following examples, we will demonstrate how to do this with JavaScript using TurbineJs.

First, initialize a Turbine streaming app by running the following command in the Meroxa CLI:

meroxa app init my-spire-app --lang javascript

A printed confirmation will let you know when you have successfully initialized your Turbine streaming app, meaning the application project files will be created in your current local directory. You may also include a --path argument at the end of the command to provide an alternative local path.

Next, run a command to get to the root of the Turbine application project:

cd my-spire-app

Within the project directory, you will find an app.js file. Open this with your preferred code editor. There you will see self-documented boilerplate code with a custom function written in JavaScript to execute against the example data record set provided in the fixtures directory.

To use the Spire Maritime AIS resource, directly pass its name (my-spire-ais)as the only argument to theresources method.

To represent the source data stream, a records method is used. Because there is no concept of a collection of data with the Spire Maritime 2.0 GraphQL API, simply pass through an empty string:

exports.App = class App {
  async run(turbine) {
    let source = await turbine.resources("my-spire-ais");
    let records = await source.records("*");

That’s all it takes to get real-time maritime data streaming into your Turbine application.

There are a couple of additional configurations that can be defined in your Turbine application code.

Source Configurations

The following source configurations are supported:

Configuration Required? Example Description
batchSize No, optional. Default is 100. 100 Sets the maximum number of results to retrieve from the Spire Maritime 2.0 GraphQL API.
### query No, optional. See Data Record Format for default queried data. GraphQL query. Send a custom GraphQL query to the Spire Maritime 2.0 GraphQL API.

What’s Next?

All that is left is for you to write function code to transform your Spire Maritime AIS stream data and event records to a downstream set of data stores, databases, or third-party APIs. Imagine what you can do with the power of Spire Maritime AIS at your fingertips.

Need potential ideas for Turbine streaming apps? Check out our example Turbine app examples to get started. But don’t let these examples hinder you. There is no limit to what you and your team can achieve using Spire Maritime AIS and the power of the Meroxa platform.

We can’t wait to see what you build! 🚀

As always, if you need help, have questions, or just want to chat:

     Meroxa, Data Streaming, Spire

Sara Menefee

Sara Menefee

Product Manager