Google Pubsub is one of the leading Queue engine used to collect data from the publisher or MQTT Application for better data analytics. Integration of Bevywise MQTT Broker with Google Pubsub helps you push data from your IoT & IIoT edge devices via MQTT Broker to google pubsub.
Google Pubsub is accessible from your Google cloud services account. You can follow the Google Pubsub document to create Google Pubsub with a publish topic.
We will be running the Bevywise MQTT Broker on the Ubuntu instance which was created in Google Cloud. Refer to the Google help document for creating the Ubuntu instance in Google cloud.
Once you created an Ubuntu instance, login to that instance and install the below dependencies.
cd /usr/local/lib/python2.7/dist-packages/PyInstaller/hooks/
sudo vim hook-google.cloud.py
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata(‘google-cloud-core’)
datas += copy_metadata(‘google-api-core’)
datas += copy_metadata(‘google-cloud-pubsub’)
import os
import sys
import json
from google.cloud import pubsub_v1
sys.path.append(os.getcwd()+’/lib’)
sys.path.append(‘/usr/local/lib/python2.7/dist-packages’)
project_Id = ‘project_name’
broker_Id = ‘testing’
def handle_Received_Payload(data):
global pubsub_v1
global project_Id
global broker_Id
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path(project_Id, ‘broker’)
data = json.dumps(data)
data = data.encode(‘utf-8’)
publisher.publish(topic_path, data=data, device=broker_Id)
CUSTOMSTORAGE = ENABLED
If you want to run the MQTTBroker with authentication, then follow the steps
AUTHENTICATION_ENABLED = YES
sudo vim environment
export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=”usr/local/lib/python2.7/dist-packages /grpc/_cython/_credentials/roots.pem”
sudo sh runbroker.sh
Now Bevywise MQTTBroker collects the data from your edge device and send to the Google pub/sub via Custom store. From Google Pub/Sub, you can hook and send the data to your data analytics tool.
Get started your data analytics by trying our MQTT broker at FREE of cost.