هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Cloud Delivering Messages to Edge Nodes

Updated on 2023-11-24 GMT+08:00

Scenario

IEF can deliver messages from SystemREST in the cloud to SystemEventBus (MQTT broker) on edge nodes.

To be specific, IEF calls the open REST gateway interface to send messages to SystemEventBus on an edge node based on the node ID and custom topic. Your end devices can receive messages from the cloud by subscribing to custom topics.

The procedure is as follows:

  1. Creating a Route
  2. Sending a Message
  3. Receiving a Message

Creating a Route

SystemREST and SystemEventBus are default endpoints and do not need to be created. SystemREST indicates the REST gateway interface of IEF in the region. SystemEventBus indicates the MQTT broker of an edge node.

  1. Log in to the IEF console, and click Switch Instance on the Dashboard page to select a platinum service instance.
  2. In the navigation pane, choose Edge-Cloud Messages > Routes.
  3. Click Create Route in the upper right corner.
  4. Set parameters.

    Figure 1 Creating a route
    • Name: Enter a route name, for example, SystemREST2SystemEventBus.
      CAUTION:

      Message routes and system subscriptions are of the same resource type. Their names cannot conflict with each other.

    • Source Endpoint: Select SystemREST.
    • Source Endpoint Resource: Enter a URL path starting with a slash (/). You can use {} for fuzzy match. For example, /aaa/{any-str}/bbb can match /aaa/ccc/bbb or /aaa/ddd/bbb. The specified source resource is used as a matching field for calling the REST interface.
    • Destination Endpoint: Select SystemEventBus.
    • Destination Endpoint Resource: Enter the topic name prefix used when the message is forwarded to the MQTT broker.
    NOTE:

    If both Source Endpoint Resource and Destination Endpoint Resource are set to /, IEF will forward all messages sent to the REST interface to the MQTT broker of the corresponding edge nodes. The topic name contained in the messages is the same as the request URL.

  5. Click Create.

    The created route is displayed in the message route list.

    Figure 2 Routes

Sending a Message

To deliver a message from SystemREST in the cloud to SystemEventBus on an edge node, obtain the SystemREST endpoint property, construct a request, and send the request to SystemEventBus through a route.

  1. Obtain the SystemREST endpoint property.

    1. Log in to the IEF console, and click Switch Instance on the Dashboard page to select a platinum service instance.
    2. In the navigation pane, choose Edge-Cloud Messages > Endpoints. In the row where SystemREST is located, the value of public in the Property column is the endpoint of SystemREST, as shown in the following figure.
      Figure 3 SystemREST endpoint property

  2. Construct a request and send it.

    An HTTPS request needs to be constructed and sent to SystemREST. The details are as follows:

    • Method: POST
    • URL: https://{rest_endpoint}/{node_id}/{topic}. In the URL, {rest_endpoint} is the endpoint obtained in 1, {node_id} is the edge node ID, and {topic} is the message topic, that is, the source endpoint resource defined in Creating a Route.
    • Body: content of the message to be sent, which is user-defined.
    • Header: X-Auth-Token, which is a valid token obtained from IAM. For details on how to obtain a token, see Obtaining a User Token.

    For example, use Postman to send the following message:

    Figure 4 Sending a message

Receiving a Message

  1. Log in to the edge node.
  2. Use the MQTT client to receive messages.

    Currently, edge nodes support two types of MQTT brokers.

    • Built-in MQTT broker (using port 8883): To use this type of MQTT broker, edge nodes must pass certificate authentication and subscribe to corresponding topics. For details about certificate authentication, see Performing Security Authentication Using Certificate.
    • External MQTT broker (using port 1883): To use this type of MQTT broker, install a third-party MQTT broker on edge nodes and enable edge nodes to subscribe to corresponding topics.

    This section describes how to use an external MQTT broker, for example, Mosquitto, to receive messages. The procedure is as follows:

    • In the Ubuntu OS, run the following commands to install Mosquitto:
      apt-get install mosquitto
      systemctl start mosquitto
      systemctl enable mosquitto
    • In the CentOS OS, run the following commands to install Mosquitto:
      yum install epel-release
      yum install mosquitto
      systemctl start mosquitto
      systemctl enable mosquitto

    After the installation is complete, run the topic subscription command. If a message is sent after the subscription, the edge node will receive the message. In the following command, # indicates that any topic is subscribed to. You can replace # with a specified topic, for example, /aaa or /bbb.

    [root@ief-node ~]# mosquitto_sub -t '#' -d 
    Client mosq-m02iwjsp4j2ISMw6rw sending CONNECT 
    Client mosq-m02iwjsp4j2ISMw6rw received CONNACK (0)
    Client mosq-m02iwjsp4j2ISMw6rw sending SUBSCRIBE (Mid: 1, Topic: #, QoS: 0, Options: 0x00) 
    Client mosq-m02iwjsp4j2ISMw6rw received SUBACK 
    Subscribed (mid: 1): 0
    Client mosq-m02iwjsp4j2ISMw6rw received PUBLISH (d0, q0, rQ, mQ, '/aaa', ... (31 bytes))
    {
        "test-key": "test-value"
    }

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback