Skip to content

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.

Contact your assigned technical support representative to confirm:

  • The RocketMQ NameServer address for the target environment;
  • The httpRemote topic 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.

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.yml

Set 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:9876

Run 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.

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:

The Listener must not parse JSON itself or log the raw message body. The SDK Router converts each supported Tag into the corresponding model.

Fixed topic: httpRemote.

TagSDK modelPurpose
uploadHttpRemoteTaskStatusTaskStatusMessageTask status and progress
uploadHttpRemoteResultTaskResultMessageInspection point results and files
uploadHttpRemoteAlarmDogAlarmMessageQuadruped robot alarms
uploadHttpRemoteRouteRouteMessageTask inspection route

uploadHttpRemoteDevicePos is not part of the message scope supported by the SDK. Query real-time position through client.dog().getPosition(...).

  • 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.

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.

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-sample

Then 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.