Before each device is able to send data to the application it needs to communicate with the mobile network to ensure that the data is allowed to be sent over the network. The EMnify DataStreamer makes connectivity metadata available in real-time to your cloud platform for detailed insights on the event and usage data of your devices.
Hint: users who wish to use the gcloud SDK instead of the Google Cloud web console may skip to Configuring via gcloud SDK.
To create a Pub/Sub topic and subscription, users need to have an associated project. We will create a project from scratch in this guide for illustrative purposes.
In the Google Cloud console,
Log in to the EMnify portal and navigate to the Technical Settings page:
Click Add New Stream and under Google Pub/Sub click ADD
Newly-created data streams are immediately active and should show a green Running status indicating a 200 HTTP response code when correctly configured.
If the configuration is invalid, a warning message will be displayed indicating incorrect configuration.
Upon successful creation, event data arrives directly into Google Pub/Sub for further processing by other services:
For users who already use the gcloud SDK, setting up the topic, adding EMnify publish permissions, creating a subscription and checking the incoming messages can be done directly from the CLI in the following four steps:
# Create the topic 'emnify-device-data' and allow EMnify publish permissions
gcloud pubsub topics create emnify-device-data
gcloud pubsub topics add-iam-policy-binding emnify-device-data \
# ! Note: the data stream must be activated via EMnify API at this step !
# Create a subscription for the 'emnify-device-data' topic and pull published messages
gcloud pubsub subscriptions create my_subscription --topic=emnify-device-data
gcloud pubsub subscriptions pull my_subscription
When incoming messages are successfully sent to a Pub/Sub topic, clicking on view messages allows to preview incoming data.
More details of the events can be inspected by expanding the columns icon on the right and selecting message attributes to be previewed: