RocketMQ Message Integration
Consume the four platform message types with thread-safe, idempotent handlers.
Station OpenAPI publishes four message types on the fixed httpRemote topic. Spring Boot applications should use
RocketMQ Starter and delegate message parsing and dispatch to the SDK’s RemoteMessageRouter.
Prerequisites
Section titled “Prerequisites”Contact your assigned technical support representative to confirm:
- The RocketMQ NameServer address for the target environment;
- The
httpRemotetopic is available; - The application is permitted to consume the messages;
- The application host can reach both the NameServer and the Broker addresses and ports returned by it;
- If the platform requires consumer groups to be created in advance, the group name that may be used.
A NameServer normally uses host:port format. It is not the Station HTTP endpoint.
Enable Starter MQ in the Sample
Section titled “Enable Starter MQ in the Sample”MQ is disabled by default in the main Sample. Open:
samples/station-openapi-spring-boot-sample/ station-openapi-sample-spring-boot/ src/main/resources/application.ymlSet the actual values supplied or approved by technical support:
station: openapi: mq: enabled: true consumer-group: station-openapi-sample
rocketmq: name-server: mq-nameserver.example.com:9876Run StationOpenApiSampleApplication in IDEA. HTTP authentication still follows the Sample README. Enabling MQ does not
replace the endpoint and Token/signature configuration.
After the consumer starts, trigger a new platform message. End-to-end delivery is confirmed only when the corresponding Handler writes a business summary log.
Integrate with a Spring Boot Application
Section titled “Integrate with a Spring Boot Application”See Source and Dependency Integration for source and dependency preparation. Use these POMs as the reference Starter dependency combination:
The following commented examples show the recommended structure:
- SampleMqConfiguration.java: validates required properties and creates the Router;
- StarterRemoteMessageListener.java:
receives
MessageExtand delegates to the Router; - SampleRemoteMessageHandlers.java: handles the four typed SDK message models.
The Listener must not parse JSON itself or log the raw message body. The SDK Router converts each supported Tag into the corresponding model.
Supported Messages
Section titled “Supported Messages”Fixed topic: httpRemote.
| Tag | SDK model | Purpose |
|---|---|---|
uploadHttpRemoteTaskStatus | TaskStatusMessage | Task status and progress |
uploadHttpRemoteResult | TaskResultMessage | Inspection point results and files |
uploadHttpRemoteAlarm | DogAlarmMessage | Quadruped robot alarms |
uploadHttpRemoteRoute | RouteMessage | Task inspection route |
uploadHttpRemoteDevicePos is not part of the message scope supported by the SDK. Query real-time position through
client.dog().getPosition(...).
Consumer Groups
Section titled “Consumer Groups”- Instances of the same application in the same environment use the same group, allowing RocketMQ to distribute messages among them.
- Different applications that each need the complete message stream must use different groups.
- The Starter Sample and native MQ Sample must use different groups when run at the same time.
- Do not generate a random group on every startup.
- If a group must be created in advance, ask technical support to confirm it before starting the application.
Message Handling
Section titled “Message Handling”RocketMQ messages may be delivered more than once. Business handlers must be thread-safe and safely process duplicates:
- Locate a task result by
taskExecuteCode + devicePointCode; - Merge file lists by
fileType + filePath; - Return normally after successful processing;
- Throw an exception when processing fails so RocketMQ can redeliver the message;
- Log only the Tag and necessary business identifiers, never the raw message body.
Native Subscriber Sample
Section titled “Native Subscriber Sample”Use station-openapi-sample-native-mq only when RocketMQ Starter is not used.
Set these values in that module’s application.yml:
station: openapi: native-mq: enabled: true name-server: mq-nameserver.example.com:9876 consumer-group: station-openapi-native-sampleThen run NativeMqSampleApplication in IDEA.
The native module demonstrates MQ consumption only. It does not create an HTTP Client and does not require Token or signature credentials. See NativeMqConfiguration.java for lifecycle management and registration of all four handlers.