Skip to content

[ISSUE #11325] fix(docs): rewrite Example_OpenMessaging for the shipped 0.3.1-alpha API - #11342

Open
chennaji9 wants to merge 1 commit into
apache:developfrom
chennaji9:cnj/docs-openmessaging-api
Open

chennaji9 wants to merge 1 commit into
apache:developfrom
chennaji9:cnj/docs-openmessaging-api

Conversation

@chennaji9

@chennaji9 chennaji9 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #11325

Brief Description

Rewrites the three snippets in docs/en/Example_OpenMessaging.md to the API of the OpenMessaging implementation this repository actually ships (io.openmessaging:openmessaging-api 0.3.1-alpha, pom.xml:114), mirroring the runnable examples in example/.../openmessaging/:

  • OMS.getMessagingAccessPoint("oms:rocketmq://localhost:9876/default:default") instead of MessagingAccessPointFactory + the old openmessaging: URL scheme;
  • createBytesMessage instead of createBytesMessageToTopic;
  • Future + listener instead of Promise/PromiseListener;
  • pull consumer: receive()/ack/sysHeaders/Message.BuiltinKeys instead of poll()/headers()/MessageHeader; OMSBuiltinKeys.CONSUMER_ID instead of NonStandardKeys.CONSUMER_GROUP;
  • the push consumer snippet now calls consumer.startup(), which was missing entirely;
  • the intro no longer claims 0.1.0-alpha and documents the OMS_RMQ_DIRECT_NAME_SRV=true prerequisite the examples require.

How Did You Test This Change?

Each rewritten snippet was extracted, prepended with the import block of its corresponding runnable example, and compiled against the built module jars: javac -cp openmessaging/target/classes:openmessaging-api-0.3.1-alpha.jar → success for all three (SimpleProducer, SimplePullConsumer, SimplePushConsumer). The snippets otherwise match example/src/main/java/org/apache/rocketmq/example/openmessaging/* at the PR base commit, where they compile as part of the example module.

… shipped 0.3.1-alpha API

Replace the retired 0.1.0-era snippets (MessagingAccessPointFactory,
createBytesMessageToTopic, Promise/PromiseListener, poll/headers,
NonStandardKeys) with the API used by the bundled runnable examples
(OMS.getMessagingAccessPoint, createBytesMessage, Future listener,
receive/ack, sysHeaders, OMSBuiltinKeys), add the missing push consumer
startup() and the OMS_RMQ_DIRECT_NAME_SRV prerequisite.
@codecov-commenter

codecov-commenter commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.71%. Comparing base (9ea2ccd) to head (7d2c19d).
⚠️ Report is 9 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11342      +/-   ##
=============================================
- Coverage      49.75%   49.71%   -0.05%     
- Complexity     14354    14366      +12     
=============================================
  Files           1390     1390              
  Lines         103246   103262      +16     
  Branches       13502    13504       +2     
=============================================
- Hits           51375    51340      -35     
- Misses         45679    45724      +45     
- Partials        6192     6198       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by github-manager-bot

Summary

Rewrites Example_OpenMessaging.md to match the shipped 0.3.1-alpha API, replacing stale OMSProducer code with the current SimpleProducer/SimpleConsumer/PullConsumer classes.

Findings

  • [Info] The code examples now use OMS.getMessagingAccessPoint() instead of the deprecated MessagingAccessPointFactory, and createBytesMessage() instead of createBytesMessageToTopic(). These match the actual API.
  • [Info] The async send example correctly uses Future<SendResult> with addListener instead of the old Promise/PromiseListener pattern.
  • [Info] The CountDownLatch in the producer example ensures the async callback completes before shutdown. Good practice.
  • [Warning] The consumer example uses CountDownLatch with a 30s timeout. Consider mentioning in the doc that this is just for demo purposes and real applications would use a long-running consumer loop.

Cross-repo Note

This is a docs-only change in apache/rocketmq. No protocol or client changes required.


Automated review by github-manager-bot

@chennaji9
chennaji9 force-pushed the cnj/docs-openmessaging-api branch from d0e1459 to 7d2c19d Compare October 18, 2026 08:10
@chennaji9

Copy link
Copy Markdown
Contributor Author

Hi @RongtongJin, sorry for the ping — this PR has been open for a while without a review yet. The change is small and focused (rewrite Example_OpenMessaging for the shipped 0.3.1-alpha AP…), and all tests and CI pass on my side. Would you mind taking a look when you get a chance? If it looks good, merging it would be much appreciated — happy to adjust anything if needed. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Example_OpenMessaging.md documents the retired 0.1.0-alpha API instead of the shipped 0.3.1-alpha

3 participants