You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2019/11/22 09:22:02 UTC

[rocketmq-ons] branch OpenMessaging updated (0523760 -> 192acc0)

This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a change to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git.


    from 0523760  Merge pull request #6 from duhenglucky/reduce_check
     new beb29e1  Add support for OpenMessaging
     new b31ad6a  Added compatibility with not enable ACL model in server
     new 6992b4e  Add create pull consumer unsupport exception
     new c2b4620  feat(client) adapt to OpenMessaging api
     new efcc721  feat(spring) add spring bean support
     new efeaebd  feat(consumer) add pull consumer support
     new f1f969f  fix(PullConsumer) removed unused import
     new 866bc7a  fix(pom) removed unused dependency
     new 192acc0  Merge pull request #12 from duhenglucky/OpenMessaging

The 36 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ons-core/ons-api/pom.xml                           |  28 --
 .../java/org/apache/rocketmq/ons/api/Action.java   |  26 --
 .../java/org/apache/rocketmq/ons/api/Admin.java    |  37 ---
 .../apache/rocketmq/ons/api/ConsumeContext.java    |  21 --
 .../java/org/apache/rocketmq/ons/api/Consumer.java |  29 --
 .../apache/rocketmq/ons/api/ExpressionType.java    |  24 --
 .../java/org/apache/rocketmq/ons/api/MQType.java   |  38 ---
 .../java/org/apache/rocketmq/ons/api/Message.java  | 251 ------------------
 .../apache/rocketmq/ons/api/MessageAccessor.java   |  41 ---
 .../apache/rocketmq/ons/api/MessageListener.java   |  23 --
 .../apache/rocketmq/ons/api/MessageSelector.java   |  49 ----
 .../org/apache/rocketmq/ons/api/ONSFactory.java    |  88 -------
 .../rocketmq/ons/api/OnExceptionContext.java       |  56 ----
 .../java/org/apache/rocketmq/ons/api/Producer.java |  37 ---
 .../org/apache/rocketmq/ons/api/SendCallback.java  |  24 --
 .../org/apache/rocketmq/ons/api/SendResult.java    |  47 ----
 .../rocketmq/ons/api/batch/BatchConsumer.java      |  27 --
 .../ons/api/batch/BatchMessageListener.java        |  29 --
 .../apache/rocketmq/ons/api/bean/Subscription.java |  93 -------
 .../rocketmq/ons/api/bean/SubscriptionExt.java     |  47 ----
 .../ons/api/order/ConsumeOrderContext.java         |  21 --
 .../ons/api/order/MessageOrderListener.java        |  25 --
 .../ons/api/order/MessageQueueSelector.java        |  25 --
 .../apache/rocketmq/ons/api/order/OrderAction.java |  26 --
 .../rocketmq/ons/api/order/OrderConsumer.java      |  35 ---
 .../rocketmq/ons/api/order/OrderProducer.java      |  28 --
 .../api/transaction/LocalTransactionChecker.java   |  24 --
 .../api/transaction/LocalTransactionExecuter.java  |  26 --
 .../ons/api/transaction/TransactionProducer.java   |  38 ---
 .../ons/api/transaction/TransactionStatus.java     |  28 --
 ons-core/ons-auth4client/pom.xml                   |   2 +-
 .../ons/api/impl/authority/SessionCredentials.java |   2 +-
 .../ons/api/impl/rocketmq/ClientRPCHook.java       |   6 +-
 ons-core/ons-client/pom.xml                        |  11 +-
 .../rocketmq/MessagingAccessPointImpl.java}        |  69 +++--
 .../org/apache/rocketmq/ons/api/Constants.java     |   1 +
 .../org/apache/rocketmq/ons/api/ONSFactory.java    | 251 ++++++++++++++++++
 .../org/apache/rocketmq/ons/api/ONSFactoryAPI.java |  24 +-
 .../apache/rocketmq/ons/api/PropertyKeyConst.java  |  44 +---
 .../rocketmq/ons/api/PropertyValueConst.java       |   0
 .../rocketmq/ons/api/bean/BatchConsumerBean.java   |  32 ++-
 .../apache/rocketmq/ons/api/bean/ConsumerBean.java |  38 ++-
 .../rocketmq/ons/api/bean/OrderConsumerBean.java   |  30 ++-
 .../rocketmq/ons/api/bean/OrderProducerBean.java   |  29 +-
 .../apache/rocketmq/ons/api/bean/ProducerBean.java |  28 +-
 .../ons/api/bean/TransactionProducerBean.java      |  38 ++-
 .../ons/api/exception/ONSClientException.java      |  15 +-
 .../apache/rocketmq/ons/api/impl/MQClientInfo.java |   5 +-
 .../rocketmq/ons/api/impl/ONSFactoryImpl.java      |  37 ++-
 .../ons/api/impl/rocketmq/BatchConsumerImpl.java   |  13 +-
 .../ons/api/impl/rocketmq/ConsumerImpl.java        |  15 +-
 .../ons/api/impl/rocketmq/ONSClientAbstract.java   |   6 +-
 .../ons/api/impl/rocketmq/ONSConsumerAbstract.java |  15 +-
 .../rocketmq/ons/api/impl/rocketmq/ONSUtil.java    |  13 +-
 .../ons/api/impl/rocketmq/OrderConsumerImpl.java   |  14 +-
 .../ons/api/impl/rocketmq/OrderProducerImpl.java   |  19 +-
 .../ons/api/impl/rocketmq/ProducerImpl.java        |  33 ++-
 .../ons/api/impl/rocketmq/PullConsumerImpl.java    | 291 +++++++++++++++++++++
 .../api/impl/rocketmq/TransactionProducerImpl.java |  13 +-
 .../tracehook/OnsClientSendMessageHookImpl.java    |  11 +-
 .../services/io.openmessaging.api.ONSFactoryAPI    |   1 +
 .../impl/rocketmq/NameServerAutoUpdateTest.java    |  39 +--
 .../impl/rocketmq/ONSClientTokenUpdateTest.java    |  44 ++--
 ons-core/ons-trace-core/pom.xml                    |   2 +-
 ons-core/pom.xml                                   |  14 +-
 ons-sample/pom.xml                                 |  12 +-
 .../org/apache/rocketmq/ons/sample/MQConfig.java   |   4 +-
 .../ons/sample/consumer/MessageListenerImpl.java   |   8 +-
 .../ons/sample/consumer/SimpleMQConsumer.java      |  21 +-
 .../ons/sample/consumer/SimpleOrderConsumer.java   |  29 +-
 ...mpleMQConsumer.java => SimplePullConsumer.java} |  44 +++-
 .../producer/LocalTransactionCheckerImpl.java      |   8 +-
 .../ons/sample/producer/MQTimerProducer.java       |  30 ++-
 .../ons/sample/producer/SimpleMQProducer.java      |  34 ++-
 .../ons/sample/producer/SimpleOrderProducer.java   |  31 ++-
 .../sample/producer/SimpleTransactionProducer.java |  33 ++-
 pom.xml                                            |   7 +-
 77 files changed, 1122 insertions(+), 1635 deletions(-)
 delete mode 100644 ons-core/ons-api/pom.xml
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Action.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Admin.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ConsumeContext.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Consumer.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ExpressionType.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MQType.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageAccessor.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageListener.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageSelector.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/OnExceptionContext.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Producer.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendCallback.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendResult.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchConsumer.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchMessageListener.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/Subscription.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/SubscriptionExt.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/ConsumeOrderContext.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageOrderListener.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageQueueSelector.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderAction.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderConsumer.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderProducer.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionChecker.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionExecuter.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionProducer.java
 delete mode 100644 ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionStatus.java
 copy ons-core/ons-client/src/main/java/{org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java => io/openmessaging/rocketmq/MessagingAccessPointImpl.java} (62%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/Constants.java (99%)
 create mode 100644 ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java (67%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java (75%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java (100%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java (78%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java (83%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java (77%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java (74%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java (79%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java (70%)
 rename ons-core/{ons-api => ons-client}/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java (89%)
 create mode 100644 ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java
 create mode 100644 ons-core/ons-client/src/main/resources/META-INF/services/io.openmessaging.api.ONSFactoryAPI
 copy ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/{SimpleMQConsumer.java => SimplePullConsumer.java} (54%)


[rocketmq-ons] 02/36: Add License and Notice file

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit c9eb2296cbe0ee676c968e4f1ef409a39efc398e
Author: duhenglucky <du...@gmail.com>
AuthorDate: Fri Jun 14 22:47:04 2019 +0800

    Add License and Notice file
---
 LICENSE   | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 NOTICE    |   5 ++
 README.md |  11 +++-
 3 files changed, 216 insertions(+), 1 deletion(-)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7f77f44
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (properties) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
\ No newline at end of file
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..703c28b
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,5 @@
+Apache RocketMQ
+Copyright 2016-2018 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/README.md b/README.md
index 868fecc..cae1bae 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,11 @@
 ## Overview
-### Apache RocketMQ lightweight client.
+ Apache RocketMQ ons is a RocketMQ lightweight client.
+
+----------
+## Contributing
+We always welcome new contributions, whether for trivial cleanups, big new features or other material rewards, more details see [here](http://rocketmq.apache.org/docs/how-to-contribute/).
+ 
+----------
+## License
+[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) Copyright (C) Apache Software Foundation
+


[rocketmq-ons] 11/36: Merge pull request #3 from ShannonDing/graalvm-sdk

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 2e94e3e68e0aa88b34cc5c03b8a753f5f58eaa81
Merge: 4a72b44 64fd96e
Author: Heng Du <du...@gmail.com>
AuthorDate: Fri Jun 28 11:36:19 2019 +0800

    Merge pull request #3 from ShannonDing/graalvm-sdk
    
    Add language identifier to support cpp native image

 .../src/main/java/org/apache/rocketmq/ons/api/Message.java | 14 ++++++++++----
 .../java/org/apache/rocketmq/ons/api/PropertyKeyConst.java |  2 ++
 .../ons/api/impl/rocketmq/ONSConsumerAbstract.java         |  7 ++++++-
 .../rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java  |  7 ++++++-
 .../rocketmq/ons/api/impl/rocketmq/ProducerImpl.java       |  8 +++++++-
 .../ons/api/impl/rocketmq/TransactionProducerImpl.java     |  7 ++++++-
 6 files changed, 37 insertions(+), 8 deletions(-)


[rocketmq-ons] 36/36: Merge pull request #12 from duhenglucky/OpenMessaging

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 192acc024192bc5dda7798e0a5882e7d2c190931
Merge: 0523760 866bc7a
Author: Heng Du <du...@apache.org>
AuthorDate: Fri Nov 22 17:21:56 2019 +0800

    Merge pull request #12 from duhenglucky/OpenMessaging
    
    [ISSUE #13]Add OpenMessaging API support

 ons-core/ons-api/pom.xml                           |  28 --
 .../java/org/apache/rocketmq/ons/api/Action.java   |  26 --
 .../java/org/apache/rocketmq/ons/api/Admin.java    |  37 ---
 .../apache/rocketmq/ons/api/ConsumeContext.java    |  21 --
 .../java/org/apache/rocketmq/ons/api/Consumer.java |  29 --
 .../apache/rocketmq/ons/api/ExpressionType.java    |  24 --
 .../java/org/apache/rocketmq/ons/api/MQType.java   |  38 ---
 .../java/org/apache/rocketmq/ons/api/Message.java  | 251 ------------------
 .../apache/rocketmq/ons/api/MessageAccessor.java   |  41 ---
 .../apache/rocketmq/ons/api/MessageListener.java   |  23 --
 .../apache/rocketmq/ons/api/MessageSelector.java   |  49 ----
 .../org/apache/rocketmq/ons/api/ONSFactory.java    |  88 -------
 .../rocketmq/ons/api/OnExceptionContext.java       |  56 ----
 .../java/org/apache/rocketmq/ons/api/Producer.java |  37 ---
 .../org/apache/rocketmq/ons/api/SendCallback.java  |  24 --
 .../org/apache/rocketmq/ons/api/SendResult.java    |  47 ----
 .../rocketmq/ons/api/batch/BatchConsumer.java      |  27 --
 .../ons/api/batch/BatchMessageListener.java        |  29 --
 .../apache/rocketmq/ons/api/bean/Subscription.java |  93 -------
 .../rocketmq/ons/api/bean/SubscriptionExt.java     |  47 ----
 .../ons/api/order/ConsumeOrderContext.java         |  21 --
 .../ons/api/order/MessageOrderListener.java        |  25 --
 .../ons/api/order/MessageQueueSelector.java        |  25 --
 .../apache/rocketmq/ons/api/order/OrderAction.java |  26 --
 .../rocketmq/ons/api/order/OrderConsumer.java      |  35 ---
 .../rocketmq/ons/api/order/OrderProducer.java      |  28 --
 .../api/transaction/LocalTransactionChecker.java   |  24 --
 .../api/transaction/LocalTransactionExecuter.java  |  26 --
 .../ons/api/transaction/TransactionProducer.java   |  38 ---
 .../ons/api/transaction/TransactionStatus.java     |  28 --
 ons-core/ons-auth4client/pom.xml                   |   2 +-
 .../ons/api/impl/authority/SessionCredentials.java |   2 +-
 .../ons/api/impl/rocketmq/ClientRPCHook.java       |   6 +-
 ons-core/ons-client/pom.xml                        |  11 +-
 .../rocketmq/MessagingAccessPointImpl.java}        |  69 +++--
 .../org/apache/rocketmq/ons/api/Constants.java     |   1 +
 .../org/apache/rocketmq/ons/api/ONSFactory.java    | 251 ++++++++++++++++++
 .../org/apache/rocketmq/ons/api/ONSFactoryAPI.java |  24 +-
 .../apache/rocketmq/ons/api/PropertyKeyConst.java  |  44 +---
 .../rocketmq/ons/api/PropertyValueConst.java       |   0
 .../rocketmq/ons/api/bean/BatchConsumerBean.java   |  32 ++-
 .../apache/rocketmq/ons/api/bean/ConsumerBean.java |  38 ++-
 .../rocketmq/ons/api/bean/OrderConsumerBean.java   |  30 ++-
 .../rocketmq/ons/api/bean/OrderProducerBean.java   |  29 +-
 .../apache/rocketmq/ons/api/bean/ProducerBean.java |  28 +-
 .../ons/api/bean/TransactionProducerBean.java      |  38 ++-
 .../ons/api/exception/ONSClientException.java      |  15 +-
 .../apache/rocketmq/ons/api/impl/MQClientInfo.java |   5 +-
 .../rocketmq/ons/api/impl/ONSFactoryImpl.java      |  37 ++-
 .../ons/api/impl/rocketmq/BatchConsumerImpl.java   |  13 +-
 .../ons/api/impl/rocketmq/ConsumerImpl.java        |  15 +-
 .../ons/api/impl/rocketmq/ONSClientAbstract.java   |   6 +-
 .../ons/api/impl/rocketmq/ONSConsumerAbstract.java |  15 +-
 .../rocketmq/ons/api/impl/rocketmq/ONSUtil.java    |  13 +-
 .../ons/api/impl/rocketmq/OrderConsumerImpl.java   |  14 +-
 .../ons/api/impl/rocketmq/OrderProducerImpl.java   |  19 +-
 .../ons/api/impl/rocketmq/ProducerImpl.java        |  33 ++-
 .../ons/api/impl/rocketmq/PullConsumerImpl.java    | 291 +++++++++++++++++++++
 .../api/impl/rocketmq/TransactionProducerImpl.java |  13 +-
 .../tracehook/OnsClientSendMessageHookImpl.java    |  11 +-
 .../services/io.openmessaging.api.ONSFactoryAPI    |   1 +
 .../impl/rocketmq/NameServerAutoUpdateTest.java    |  39 +--
 .../impl/rocketmq/ONSClientTokenUpdateTest.java    |  44 ++--
 ons-core/ons-trace-core/pom.xml                    |   2 +-
 ons-core/pom.xml                                   |  14 +-
 ons-sample/pom.xml                                 |  12 +-
 .../org/apache/rocketmq/ons/sample/MQConfig.java   |   4 +-
 .../ons/sample/consumer/MessageListenerImpl.java   |   8 +-
 .../ons/sample/consumer/SimpleMQConsumer.java      |  21 +-
 .../ons/sample/consumer/SimpleOrderConsumer.java   |  29 +-
 ...mpleMQConsumer.java => SimplePullConsumer.java} |  44 +++-
 .../producer/LocalTransactionCheckerImpl.java      |   8 +-
 .../ons/sample/producer/MQTimerProducer.java       |  30 ++-
 .../ons/sample/producer/SimpleMQProducer.java      |  34 ++-
 .../ons/sample/producer/SimpleOrderProducer.java   |  31 ++-
 .../sample/producer/SimpleTransactionProducer.java |  33 ++-
 pom.xml                                            |   7 +-
 77 files changed, 1122 insertions(+), 1635 deletions(-)


[rocketmq-ons] 25/36: Merge pull request #1 from davidpdw/davidpdw-patch-1

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit efe9ba010c6584d58b26ac0db9efbb4273434364
Merge: 6da9b49 c315d14
Author: davidpdw <40...@qq.com>
AuthorDate: Wed Jul 17 11:51:06 2019 +0800

    Merge pull request #1 from davidpdw/davidpdw-patch-1
    
    Update ProducerImpl.java

 .../java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[rocketmq-ons] 01/36: Init commit.

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 3dbc38a9e4e742c604540b5887453bc0219e2817
Author: duheng.dh <du...@alibaba-inc.com>
AuthorDate: Wed Jun 5 11:16:34 2019 +0800

    Init commit.
---
 .gitignore                                         |  22 ++
 .gitmodules                                        |   0
 README.md                                          |   2 +
 ons-core/.idea/codeStyleSettings.xml               |  38 ++
 ons-core/.idea/copyright/profiles_settings.xml     |   7 +
 ons-core/.idea/encodings.xml                       |  11 +
 ons-core/README.md                                 |   0
 ons-core/ons-api/pom.xml                           |  28 ++
 .../java/org/apache/rocketmq/ons/api/Action.java   |  26 ++
 .../java/org/apache/rocketmq/ons/api/Admin.java    |  37 ++
 .../org/apache/rocketmq/ons/api/Constants.java     |  21 ++
 .../apache/rocketmq/ons/api/ConsumeContext.java    |  21 ++
 .../java/org/apache/rocketmq/ons/api/Consumer.java |  29 ++
 .../apache/rocketmq/ons/api/ExpressionType.java    |  24 ++
 .../java/org/apache/rocketmq/ons/api/MQType.java   |  38 ++
 .../java/org/apache/rocketmq/ons/api/Message.java  | 245 +++++++++++++
 .../apache/rocketmq/ons/api/MessageAccessor.java   |  41 +++
 .../apache/rocketmq/ons/api/MessageListener.java   |  23 ++
 .../apache/rocketmq/ons/api/MessageSelector.java   |  49 +++
 .../org/apache/rocketmq/ons/api/ONSFactory.java    |  88 +++++
 .../org/apache/rocketmq/ons/api/ONSFactoryAPI.java |  40 +++
 .../rocketmq/ons/api/OnExceptionContext.java       |  56 +++
 .../java/org/apache/rocketmq/ons/api/Producer.java |  37 ++
 .../apache/rocketmq/ons/api/PropertyKeyConst.java  | 102 ++++++
 .../rocketmq/ons/api/PropertyValueConst.java       |  27 ++
 .../org/apache/rocketmq/ons/api/SendCallback.java  |  24 ++
 .../org/apache/rocketmq/ons/api/SendResult.java    |  47 +++
 .../rocketmq/ons/api/batch/BatchConsumer.java      |  27 ++
 .../ons/api/batch/BatchMessageListener.java        |  29 ++
 .../rocketmq/ons/api/bean/BatchConsumerBean.java   | 114 ++++++
 .../apache/rocketmq/ons/api/bean/ConsumerBean.java | 157 +++++++++
 .../rocketmq/ons/api/bean/OrderConsumerBean.java   | 111 ++++++
 .../rocketmq/ons/api/bean/OrderProducerBean.java   |  82 +++++
 .../apache/rocketmq/ons/api/bean/ProducerBean.java |  98 ++++++
 .../apache/rocketmq/ons/api/bean/Subscription.java |  93 +++++
 .../rocketmq/ons/api/bean/SubscriptionExt.java     |  47 +++
 .../ons/api/bean/TransactionProducerBean.java      |  95 +++++
 .../ons/api/exception/ONSClientException.java      |  42 +++
 .../ons/api/order/ConsumeOrderContext.java         |  21 ++
 .../ons/api/order/MessageOrderListener.java        |  25 ++
 .../ons/api/order/MessageQueueSelector.java        |  25 ++
 .../apache/rocketmq/ons/api/order/OrderAction.java |  26 ++
 .../rocketmq/ons/api/order/OrderConsumer.java      |  35 ++
 .../rocketmq/ons/api/order/OrderProducer.java      |  28 ++
 .../api/transaction/LocalTransactionChecker.java   |  24 ++
 .../api/transaction/LocalTransactionExecuter.java  |  26 ++
 .../ons/api/transaction/TransactionProducer.java   |  38 ++
 .../ons/api/transaction/TransactionStatus.java     |  28 ++
 ons-core/ons-auth4client/pom.xml                   |  37 ++
 .../rocketmq/ons/api/impl/authority/AuthUtil.java  |  58 ++++
 .../ons/api/impl/authority/OnsAuthSigner.java      |  90 +++++
 .../ons/api/impl/authority/SessionCredentials.java | 214 ++++++++++++
 .../ons/api/impl/authority/SigningAlgorithm.java   |  24 ++
 .../exception/AuthenticationException.java         |  69 ++++
 .../authority/exception/FlowControlException.java  |  44 +++
 .../authority/exception/SignatureException.java    |  48 +++
 .../ons/api/impl/rocketmq/AbstractRPCHook.java     |  75 ++++
 .../ons/api/impl/rocketmq/ClientRPCHook.java       |  57 +++
 .../rocketmq/ons/api/impl/rocketmq/ONSChannel.java |  24 ++
 ons-core/ons-client/pom.xml                        |  74 ++++
 .../apache/rocketmq/ons/api/impl/MQClientInfo.java |  39 +++
 .../rocketmq/ons/api/impl/ONSFactoryImpl.java      |  90 +++++
 .../ons/api/impl/rocketmq/BatchConsumerImpl.java   | 131 +++++++
 .../ons/api/impl/rocketmq/ConsumerImpl.java        | 133 +++++++
 .../apache/rocketmq/ons/api/impl/rocketmq/FAQ.java |  46 +++
 .../ons/api/impl/rocketmq/ONSClientAbstract.java   | 268 +++++++++++++++
 .../ons/api/impl/rocketmq/ONSConsumerAbstract.java | 198 +++++++++++
 .../rocketmq/ons/api/impl/rocketmq/ONSUtil.java    | 185 ++++++++++
 .../ons/api/impl/rocketmq/OnsClientRPCHook.java    |  42 +++
 .../ons/api/impl/rocketmq/OrderConsumerImpl.java   | 114 ++++++
 .../ons/api/impl/rocketmq/OrderProducerImpl.java   | 149 ++++++++
 .../ons/api/impl/rocketmq/ProducerImpl.java        | 246 +++++++++++++
 .../api/impl/rocketmq/TransactionProducerImpl.java | 155 +++++++++
 .../tracehook/OnsClientSendMessageHookImpl.java    |  98 ++++++
 .../impl/tracehook/OnsConsumeMessageHookImpl.java  | 123 +++++++
 .../ons/api/impl/util/ClientLoggerUtil.java        |  55 +++
 .../rocketmq/ons/api/impl/util/MsgConvertUtil.java |  89 +++++
 .../rocketmq/ons/api/impl/util/NameAddrUtils.java  |  47 +++
 .../src/main/resources/ons_client_info.properties  |  16 +
 .../impl/rocketmq/NameServerAutoUpdateTest.java    |  95 +++++
 .../impl/rocketmq/ONSClientTokenUpdateTest.java    | 189 ++++++++++
 .../ons/api/impl/rocketmq/ONSUtilTest.java         |  59 ++++
 ons-core/ons-trace-core/pom.xml                    |  41 +++
 .../ons/open/trace/core/common/OnsTraceBean.java   | 145 ++++++++
 .../open/trace/core/common/OnsTraceConstants.java  |  57 +++
 .../open/trace/core/common/OnsTraceContext.java    | 168 +++++++++
 .../trace/core/common/OnsTraceDataEncoder.java     | 162 +++++++++
 .../trace/core/common/OnsTraceDispatcherType.java  |  25 ++
 .../trace/core/common/OnsTraceTransferBean.java    |  46 +++
 .../ons/open/trace/core/common/OnsTraceType.java   |  27 ++
 .../open/trace/core/dispatch/AsyncDispatcher.java  |  33 ++
 .../core/dispatch/impl/AsyncArrayDispatcher.java   | 382 +++++++++++++++++++++
 .../core/dispatch/impl/TraceProducerFactory.java   |  97 ++++++
 .../ons/open/trace/core/hook/AbstractRPCHook.java  |  72 ++++
 .../ons/open/trace/core/utils/MixUtils.java        | 111 ++++++
 ons-core/pom.xml                                   | 271 +++++++++++++++
 pom.xml                                            | 277 +++++++++++++++
 style/copyright/Apache.xml                         |  23 ++
 style/copyright/profiles_settings.xml              |  64 ++++
 style/ons_checkstyle.xml                           | 137 ++++++++
 style/ons_codeStyle.xml                            | 143 ++++++++
 101 files changed, 7916 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7a1b3a8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,22 @@
+*.iml
+.idea/
+target/
+logs/
+.classpath
+.project
+.settings/
+.amateras
+src/main/resources/hibernate.cfg.xml
+src/main/resources/hibernate.reveng.xml
+/target*
+*/bin/*
+*.log*
+*.versionsBackup
+test-output*
+runtest.sh
+/ons-top/frontend
+*dependency-reduced-pom.xml
+local
+frontend
+/ons-top/ons-frontend
+.DS_Store/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e69de29
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..868fecc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+## Overview
+### Apache RocketMQ lightweight client.
diff --git a/ons-core/.idea/codeStyleSettings.xml b/ons-core/.idea/codeStyleSettings.xml
new file mode 100644
index 0000000..3319e57
--- /dev/null
+++ b/ons-core/.idea/codeStyleSettings.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectCodeStyleSettingsManager">
+    <option name="PER_PROJECT_SETTINGS">
+      <value>
+        <option name="LINE_SEPARATOR" value="&#10;" />
+        <option name="GENERATE_FINAL_LOCALS" value="true" />
+        <option name="GENERATE_FINAL_PARAMETERS" value="true" />
+        <option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
+        <option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
+        <option name="JD_P_AT_EMPTY_LINES" value="false" />
+        <option name="JD_PARAM_DESCRIPTION_ON_NEW_LINE" value="true" />
+        <XML>
+          <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
+        </XML>
+        <codeStyleSettings language="JAVA">
+          <arrangement>
+            <groups>
+              <group>
+                <type>GETTERS_AND_SETTERS</type>
+                <order>KEEP</order>
+              </group>
+              <group>
+                <type>OVERRIDDEN_METHODS</type>
+                <order>KEEP</order>
+              </group>
+              <group>
+                <type>DEPENDENT_METHODS</type>
+                <order>BREADTH_FIRST</order>
+              </group>
+            </groups>
+          </arrangement>
+        </codeStyleSettings>
+      </value>
+    </option>
+    <option name="USE_PER_PROJECT_SETTINGS" value="true" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/ons-core/.idea/copyright/profiles_settings.xml b/ons-core/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..74200de
--- /dev/null
+++ b/ons-core/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,7 @@
+<component name="CopyrightManager">
+  <settings default="">
+    <LanguageOptions name="JAVA">
+      <option name="fileTypeOverride" value="1" />
+    </LanguageOptions>
+  </settings>
+</component>
\ No newline at end of file
diff --git a/ons-core/.idea/encodings.xml b/ons-core/.idea/encodings.xml
new file mode 100644
index 0000000..3446947
--- /dev/null
+++ b/ons-core/.idea/encodings.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
+    <file url="file://$PROJECT_DIR$" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/ons-api" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/ons-auth4client" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/ons-client" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/ons-trace-core" charset="UTF-8" />
+    <file url="PROJECT" charset="UTF-8" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/ons-core/README.md b/ons-core/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/ons-core/ons-api/pom.xml b/ons-core/ons-api/pom.xml
new file mode 100644
index 0000000..374e460
--- /dev/null
+++ b/ons-core/ons-api/pom.xml
@@ -0,0 +1,28 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>ons-all</artifactId>
+        <version>1.8.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+    <artifactId>ons-api</artifactId>
+    <name>ons-api ${project.version}</name>
+</project>
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Action.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Action.java
new file mode 100644
index 0000000..2c0a2c9
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Action.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api;
+
+
+public enum Action {
+
+    CommitMessage,
+
+    ReconsumeLater,
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Admin.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Admin.java
new file mode 100644
index 0000000..702d9a5
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Admin.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import java.util.Properties;
+
+
+public interface Admin {
+
+    boolean isStarted();
+
+
+    boolean isClosed();
+
+
+    void start();
+
+
+    void updateCredential(Properties credentialProperties);
+
+
+    void shutdown();
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Constants.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Constants.java
new file mode 100644
index 0000000..a51ba20
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Constants.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+public class Constants {
+    public static final String TRANSACTION_ID = "__transactionId__";
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ConsumeContext.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ConsumeContext.java
new file mode 100644
index 0000000..5973428
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ConsumeContext.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+public class ConsumeContext {
+
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Consumer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Consumer.java
new file mode 100644
index 0000000..a592559
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Consumer.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+
+public interface Consumer extends Admin {
+
+    void subscribe(final String topic, final String subExpression, final MessageListener listener);
+
+
+    void subscribe(final String topic, final MessageSelector selector, final MessageListener listener);
+
+
+    void unsubscribe(final String topic);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ExpressionType.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ExpressionType.java
new file mode 100644
index 0000000..1980ac6
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ExpressionType.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+public enum ExpressionType {
+
+    SQL92,
+
+    TAG
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MQType.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MQType.java
new file mode 100644
index 0000000..17d4afa
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MQType.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+public enum MQType {
+
+    NOTIFY("NOTIFY"),
+
+    METAQ("METAQ");
+
+    private String name;
+
+    MQType(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
new file mode 100644
index 0000000..5d1f999
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+
+public class Message implements Serializable {
+
+    private static final long serialVersionUID = -1385924226856188094L;
+
+
+    Properties systemProperties;
+
+
+    private String topic;
+
+
+    private Properties userProperties;
+
+
+    private byte[] body;
+
+
+    public Message() {
+        this(null, null, "", null);
+    }
+
+
+    public Message(String topic, String tag, String key, byte[] body) {
+        this.topic = topic;
+        this.body = body;
+
+        this.putSystemProperties(SystemPropKey.TAG, tag);
+        this.putSystemProperties(SystemPropKey.KEY, key);
+    }
+
+
+    void putSystemProperties(final String key, final String value) {
+        if (null == this.systemProperties) {
+            this.systemProperties = new Properties();
+        }
+
+        if (key != null && value != null) {
+            this.systemProperties.put(key, value);
+        }
+    }
+
+
+    public Message(String topic, String tags, byte[] body) {
+        this(topic, tags, "", body);
+    }
+
+
+    public void putUserProperties(final String key, final String value) {
+        if (null == this.userProperties) {
+            this.userProperties = new Properties();
+        }
+
+        if (key != null && value != null) {
+            this.userProperties.put(key, value);
+        }
+    }
+
+
+    public String getUserProperties(final String key) {
+        if (null != this.userProperties) {
+            return (String) this.userProperties.get(key);
+        }
+
+        return null;
+    }
+
+
+    public String getTopic() {
+        return topic;
+    }
+
+
+    public void setTopic(String topic) {
+        this.topic = topic;
+    }
+
+
+    public String getTag() {
+        return this.getSystemProperties(SystemPropKey.TAG);
+    }
+
+
+    String getSystemProperties(final String key) {
+        if (null != this.systemProperties) {
+            return this.systemProperties.getProperty(key);
+        }
+
+        return null;
+    }
+
+
+    public void setTag(String tag) {
+        this.putSystemProperties(SystemPropKey.TAG, tag);
+    }
+
+
+    public String getKey() {
+        return this.getSystemProperties(SystemPropKey.KEY);
+    }
+
+
+    public void setKey(String key) {
+        this.putSystemProperties(SystemPropKey.KEY, key);
+    }
+
+
+    public String getMsgID() {
+        return this.getSystemProperties(SystemPropKey.MSGID);
+    }
+
+
+    public void setMsgID(String msgid) {
+        this.putSystemProperties(SystemPropKey.MSGID, msgid);
+    }
+
+    Properties getSystemProperties() {
+        return systemProperties;
+    }
+
+    void setSystemProperties(Properties systemProperties) {
+        this.systemProperties = systemProperties;
+    }
+
+    public Properties getUserProperties() {
+        return userProperties;
+    }
+
+    public void setUserProperties(Properties userProperties) {
+        this.userProperties = userProperties;
+    }
+
+    public byte[] getBody() {
+        return body;
+    }
+
+    public void setBody(byte[] body) {
+        this.body = body;
+    }
+
+
+    public int getReconsumeTimes() {
+        String pro = this.getSystemProperties(SystemPropKey.RECONSUMETIMES);
+        if (pro != null) {
+            return Integer.parseInt(pro);
+        }
+
+        return 0;
+    }
+
+
+    public void setReconsumeTimes(final int value) {
+        putSystemProperties(SystemPropKey.RECONSUMETIMES, String.valueOf(value));
+    }
+
+
+    public long getBornTimestamp() {
+        String pro = this.getSystemProperties(SystemPropKey.BORNTIMESTAMP);
+        if (pro != null) {
+            return Long.parseLong(pro);
+        }
+
+        return 0L;
+    }
+
+
+    public void setBornTimestamp(final long value) {
+        putSystemProperties(SystemPropKey.BORNTIMESTAMP, String.valueOf(value));
+    }
+
+
+    public String getBornHost() {
+        String pro = this.getSystemProperties(SystemPropKey.BORNHOST);
+        return pro == null ? "" : pro;
+    }
+
+
+    public void setBornHost(final String value) {
+        putSystemProperties(SystemPropKey.BORNHOST, value);
+    }
+
+
+    public long getStartDeliverTime() {
+        String pro = this.getSystemProperties(SystemPropKey.STARTDELIVERTIME);
+        if (pro != null) {
+            return Long.parseLong(pro);
+        }
+
+        return 0L;
+    }
+
+    public String getShardingKey() {
+        String pro = this.getSystemProperties(SystemPropKey.SHARDINGKEY);
+        return pro == null ? "" : pro;
+    }
+
+    public void setShardingKey(final String value) {
+        putSystemProperties(SystemPropKey.SHARDINGKEY, value);
+    }
+
+
+    public void setStartDeliverTime(final long value) {
+        putSystemProperties(SystemPropKey.STARTDELIVERTIME, String.valueOf(value));
+    }
+
+    @Override
+    public String toString() {
+        return "Message [topic=" + topic + ", systemProperties=" + systemProperties + ", userProperties=" + userProperties + ", body="
+            + (body != null ? body.length : 0) + "]";
+    }
+
+
+    static public class SystemPropKey {
+        public static final String TAG = "__TAG";
+        public static final String KEY = "__KEY";
+        public static final String MSGID = "__MSGID";
+        public static final String SHARDINGKEY = "__SHARDINGKEY";
+        public static final String RECONSUMETIMES = "__RECONSUMETIMES";
+        public static final String BORNTIMESTAMP = "__BORNTIMESTAMP";
+        public static final String BORNHOST = "__BORNHOST";
+
+        public static final String STARTDELIVERTIME = "__STARTDELIVERTIME";
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageAccessor.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageAccessor.java
new file mode 100644
index 0000000..61f23b1
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageAccessor.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import java.util.Properties;
+
+
+public class MessageAccessor {
+    public static Properties getSystemProperties(final Message msg) {
+        return msg.systemProperties;
+    }
+
+
+    public static void setSystemProperties(final Message msg, Properties systemProperties) {
+        msg.systemProperties = systemProperties;
+    }
+
+
+    public static void putSystemProperties(final Message msg, final String key, final String value) {
+        msg.putSystemProperties(key, value);
+    }
+
+
+    public static String getSystemProperties(final Message msg, final String key) {
+        return msg.getSystemProperties(key);
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageListener.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageListener.java
new file mode 100644
index 0000000..22b56c7
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageListener.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+
+public interface MessageListener {
+
+    Action consume(final Message message, final ConsumeContext context);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageSelector.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageSelector.java
new file mode 100644
index 0000000..f28bdae
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageSelector.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api;
+
+public class MessageSelector {
+
+    private ExpressionType type;
+
+    private String subExpression;
+
+    public static MessageSelector bySql(String subExpression) {
+        return new MessageSelector(ExpressionType.SQL92, subExpression);
+    }
+
+    public static MessageSelector byTag(String subExpression) {
+        return new MessageSelector(ExpressionType.TAG, subExpression);
+    }
+
+    private MessageSelector() {
+    }
+
+    private MessageSelector(ExpressionType type, String subExpression) {
+        this.type = type;
+        this.subExpression = subExpression;
+    }
+
+    public ExpressionType getType() {
+        return type;
+    }
+
+    public String getSubExpression() {
+        return subExpression;
+    }
+}
\ No newline at end of file
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
new file mode 100644
index 0000000..eaff503
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import org.apache.rocketmq.ons.api.batch.BatchConsumer;
+import org.apache.rocketmq.ons.api.order.OrderConsumer;
+import org.apache.rocketmq.ons.api.order.OrderProducer;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
+import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
+import java.util.Properties;
+
+
+public class ONSFactory {
+
+
+    private static ONSFactoryAPI onsFactory = null;
+
+    static {
+        try {
+
+            Class<?> factoryClass =
+                    ONSFactory.class.getClassLoader().loadClass(
+                            "org.apache.rocketmq.ons.api.impl.ONSFactoryNotifyAndMetaQImpl");
+            onsFactory = (ONSFactoryAPI) factoryClass.newInstance();
+        } catch (Throwable e) {
+            try {
+                Class<?> factoryClass =
+                        ONSFactory.class.getClassLoader().loadClass(
+                                "org.apache.rocketmq.ons.api.impl.ONSFactoryImpl");
+                onsFactory = (ONSFactoryAPI) factoryClass.newInstance();
+            } catch (Throwable e1) {
+                e.printStackTrace();
+                e1.printStackTrace();
+            }
+        }
+    }
+
+
+
+    public static Producer createProducer(final Properties properties) {
+        return onsFactory.createProducer(properties);
+    }
+
+
+
+    public static OrderProducer createOrderProducer(final Properties properties) {
+        return onsFactory.createOrderProducer(properties);
+    }
+
+
+
+    public static TransactionProducer createTransactionProducer(final Properties properties,
+                                                                final LocalTransactionChecker checker) {
+        return onsFactory.createTransactionProducer(properties, checker);
+    }
+
+
+
+    public static Consumer createConsumer(final Properties properties) {
+        return onsFactory.createConsumer(properties);
+    }
+
+
+    public static BatchConsumer createBatchConsumer(final Properties properties) {
+        return onsFactory.createBatchConsumer(properties);
+    }
+
+
+
+    public static OrderConsumer createOrderedConsumer(final Properties properties) {
+        return onsFactory.createOrderedConsumer(properties);
+    }
+
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
new file mode 100644
index 0000000..b4bdd8a
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import org.apache.rocketmq.ons.api.batch.BatchConsumer;
+import org.apache.rocketmq.ons.api.order.OrderConsumer;
+import org.apache.rocketmq.ons.api.order.OrderProducer;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
+import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
+import java.util.Properties;
+
+public interface ONSFactoryAPI {
+
+    Producer createProducer(final Properties properties);
+
+    Consumer createConsumer(final Properties properties);
+
+    BatchConsumer createBatchConsumer(final Properties properties);
+
+    OrderProducer createOrderProducer(final Properties properties);
+
+    OrderConsumer createOrderedConsumer(final Properties properties);
+
+    TransactionProducer createTransactionProducer(final Properties properties,
+        final LocalTransactionChecker checker);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/OnExceptionContext.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/OnExceptionContext.java
new file mode 100644
index 0000000..3eb7620
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/OnExceptionContext.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+
+public class OnExceptionContext {
+
+
+    private String messageId;
+
+
+    private String topic;
+
+
+    private ONSClientException exception;
+
+    public String getMessageId() {
+        return messageId;
+    }
+
+    public void setMessageId(String messageId) {
+        this.messageId = messageId;
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+
+    public void setTopic(String topic) {
+        this.topic = topic;
+    }
+
+    public ONSClientException getException() {
+        return exception;
+    }
+
+    public void setException(ONSClientException exception) {
+        this.exception = exception;
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Producer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Producer.java
new file mode 100644
index 0000000..e45e613
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Producer.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import java.util.concurrent.ExecutorService;
+
+public interface Producer extends Admin {
+
+
+    @Override
+    void start();
+
+    @Override
+    void shutdown();
+
+    SendResult send(final Message message);
+
+    void sendOneway(final Message message);
+
+    void sendAsync(final Message message, final SendCallback sendCallback);
+
+    void setCallbackExecutor(final ExecutorService callbackExecutor);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
new file mode 100644
index 0000000..d98d49c
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import javax.annotation.Generated;
+
+@Generated("ons-api")
+public class PropertyKeyConst {
+
+    public static final String MessageModel = "MessageModel";
+
+    /**
+     * Deprecated, replaced with GROUP_ID
+     */
+    @Deprecated
+    public static final String ProducerId = "ProducerId";
+
+    /**
+     * Deprecated, replaced with GROUP_ID
+     */
+    @Deprecated
+    public static final String ConsumerId = "ConsumerId";
+
+    public static final String GROUP_ID = "GROUP_ID";
+
+    public static final String AccessKey = "AccessKey";
+
+    public static final String SecretKey = "SecretKey";
+
+    public static final String SecurityToken = "SecurityToken";
+
+    public static final String SendMsgTimeoutMillis = "SendMsgTimeoutMillis";
+
+    public static final String ONSAddr = "ONSAddr";
+
+    public static final String NAMESRV_ADDR = "NAMESRV_ADDR";
+
+    public static final String ConsumeThreadNums = "ConsumeThreadNums";
+
+    public static final String OnsChannel = "OnsChannel";
+
+    public static final String MQType = "MQType";
+
+    public static final String isVipChannelEnabled = "isVipChannelEnabled";
+
+    public static final String SuspendTimeMillis = "suspendTimeMillis";
+
+    public static final String MaxReconsumeTimes = "maxReconsumeTimes";
+
+    public static final String ConsumeTimeout = "consumeTimeout";
+
+    public static final String CheckImmunityTimeInSeconds = "CheckImmunityTimeInSeconds";
+
+    public static final String PostSubscriptionWhenPull = "PostSubscriptionWhenPull";
+
+    public static final String ConsumeMessageBatchMaxSize = "ConsumeMessageBatchMaxSize";
+
+    public static final String MaxCachedMessageAmount = "maxCachedMessageAmount";
+
+    public static final String MaxCachedMessageSizeInMiB = "maxCachedMessageSizeInMiB";
+
+    public static final String InstanceName = "InstanceName";
+
+    public static final String MsgTraceSwitch = "MsgTraceSwitch";
+
+    public static final String MqttMessageId = "mqttMessageId";
+
+    public static final String MqttMessage = "mqttMessage";
+
+    public static final String MqttPublishRetain = "mqttRetain";
+
+    public static final String MqttPublishDubFlag = "mqttPublishDubFlag";
+
+    public static final String MqttSecondTopic = "mqttSecondTopic";
+
+    public static final String MqttClientId = "clientId";
+
+    public static final String MqttQOS = "qoslevel";
+
+    public static final String INSTANCE_ID = "INSTANCE_ID";
+
+    public static final String EXACTLYONCE_DELIVERY = "exactlyOnceDelivery";
+
+    public static final String EXACTLYONCE_RM_REFRESHINTERVAL = "exactlyOnceRmRefreshInterval";
+
+    public static final String MAX_BATCH_MESSAGE_COUNT = "maxBatchMessageCount";
+
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java
new file mode 100644
index 0000000..c748447
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+
+public class PropertyValueConst {
+
+
+    public static final String BROADCASTING = "BROADCASTING";
+
+
+    public static final String CLUSTERING = "CLUSTERING";
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendCallback.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendCallback.java
new file mode 100644
index 0000000..ade3f70
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendCallback.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+public interface SendCallback {
+
+    void onSuccess(final SendResult sendResult);
+
+    void onException(final OnExceptionContext context);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendResult.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendResult.java
new file mode 100644
index 0000000..2dd0bb5
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendResult.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+public class SendResult {
+
+    private String messageId;
+
+    private String topic;
+
+
+    public String getMessageId() {
+        return messageId;
+    }
+
+
+    public void setMessageId(String messageId) {
+        this.messageId = messageId;
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+
+    public void setTopic(String topic) {
+        this.topic = topic;
+    }
+
+    @Override
+    public String toString() {
+        return "SendResult[topic=" + topic + ", messageId=" + messageId + ']';
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchConsumer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchConsumer.java
new file mode 100644
index 0000000..848a139
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchConsumer.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.batch;
+
+import org.apache.rocketmq.ons.api.Admin;
+
+public interface BatchConsumer extends Admin {
+
+    void subscribe(final String topic, final String subExpression, final BatchMessageListener listener);
+
+    void unsubscribe(final String topic);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchMessageListener.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchMessageListener.java
new file mode 100644
index 0000000..3716a90
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchMessageListener.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.batch;
+
+import org.apache.rocketmq.ons.api.Action;
+import org.apache.rocketmq.ons.api.ConsumeContext;
+import org.apache.rocketmq.ons.api.Message;
+import java.util.List;
+
+
+public interface BatchMessageListener {
+
+    Action consume(final List<Message> messages, final ConsumeContext context);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java
new file mode 100644
index 0000000..1cfedde
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+import java.util.Map;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.batch.BatchConsumer;
+import org.apache.rocketmq.ons.api.batch.BatchMessageListener;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+
+public class BatchConsumerBean implements BatchConsumer {
+
+    private Properties properties;
+
+
+    private Map<Subscription, BatchMessageListener> subscriptionTable;
+
+    private BatchConsumer batchConsumer;
+
+    @Override
+    public boolean isStarted() {
+        return this.batchConsumer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.batchConsumer.isClosed();
+    }
+
+
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        if (null == this.subscriptionTable) {
+            throw new ONSClientException("subscriptionTable not set");
+        }
+
+        this.batchConsumer = ONSFactory.createBatchConsumer(this.properties);
+
+        for (final Map.Entry<Subscription, BatchMessageListener> next : this.subscriptionTable.entrySet()) {
+            this.subscribe(next.getKey().getTopic(), next.getKey().getExpression(), next.getValue());
+        }
+
+        this.batchConsumer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.batchConsumer != null) {
+            this.batchConsumer.updateCredential(credentialProperties);
+        }
+    }
+
+
+    @Override
+    public void shutdown() {
+        if (this.batchConsumer != null) {
+            this.batchConsumer.shutdown();
+        }
+    }
+
+    @Override
+    public void subscribe(final String topic, final String subExpression, final BatchMessageListener listener) {
+        if (null == this.batchConsumer) {
+            throw new ONSClientException("subscribe must be called after BatchConsumerBean started");
+        }
+        this.batchConsumer.subscribe(topic, subExpression, listener);
+    }
+
+    @Override
+    public void unsubscribe(final String topic) {
+        if (null == this.batchConsumer) {
+            throw new ONSClientException("unsubscribe must be called after BatchConsumerBean started");
+        }
+        this.batchConsumer.unsubscribe(topic);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(final Properties properties) {
+        this.properties = properties;
+    }
+
+    public Map<Subscription, BatchMessageListener> getSubscriptionTable() {
+        return subscriptionTable;
+    }
+
+    public void setSubscriptionTable(
+        final Map<Subscription, BatchMessageListener> subscriptionTable) {
+        this.subscriptionTable = subscriptionTable;
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java
new file mode 100644
index 0000000..839ad62
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Consumer;
+import org.apache.rocketmq.ons.api.ExpressionType;
+import org.apache.rocketmq.ons.api.MessageListener;
+import org.apache.rocketmq.ons.api.MessageSelector;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+
+public class ConsumerBean implements Consumer {
+
+    private Properties properties;
+
+
+    private Map<Subscription, MessageListener> subscriptionTable;
+
+    private Consumer consumer;
+
+
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        if (null == this.subscriptionTable) {
+            throw new ONSClientException("subscriptionTable not set");
+        }
+
+        this.consumer = ONSFactory.createConsumer(this.properties);
+
+        Iterator<Entry<Subscription, MessageListener>> it = this.subscriptionTable.entrySet().iterator();
+        while (it.hasNext()) {
+            Entry<Subscription, MessageListener> next = it.next();
+            if ("com.aliyun.openservices.ons.api.impl.notify.ConsumerImpl".equals(this.consumer.getClass().getCanonicalName())
+                && (next.getKey() instanceof SubscriptionExt)) {
+                SubscriptionExt subscription = (SubscriptionExt) next.getKey();
+                for (Method method : this.consumer.getClass().getMethods()) {
+                    if ("subscribeNotify".equals(method.getName())) {
+                        try {
+                            method.invoke(consumer, subscription.getTopic(), subscription.getExpression(),
+                                    subscription.isPersistence(), next.getValue());
+                        } catch (Exception e) {
+                            throw new ONSClientException("subscribeNotify invoke exception", e);
+                        }
+                        break;
+                    }
+                }
+
+            } else {
+                Subscription subscription = next.getKey();
+                if (subscription.getType() == null || ExpressionType.TAG.name().equals(subscription.getType())) {
+
+                    this.subscribe(subscription.getTopic(), subscription.getExpression(), next.getValue());
+
+                } else if (ExpressionType.SQL92.name().equals(subscription.getType())) {
+
+                    this.subscribe(subscription.getTopic(), MessageSelector.bySql(subscription.getExpression()), next.getValue());
+                } else {
+
+                    throw new ONSClientException(String.format("Expression type %s is unknown!", subscription.getType()));
+                }
+            }
+
+        }
+
+        this.consumer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.consumer != null) {
+            this.consumer.updateCredential(credentialProperties);
+        }
+    }
+
+
+    @Override
+    public void shutdown() {
+        if (this.consumer != null) {
+            this.consumer.shutdown();
+        }
+    }
+
+    @Override
+    public void subscribe(String topic, String subExpression, MessageListener listener) {
+        if (null == this.consumer) {
+            throw new ONSClientException("subscribe must be called after consumerBean started");
+        }
+        this.consumer.subscribe(topic, subExpression, listener);
+    }
+
+    @Override
+    public void subscribe(final String topic, final MessageSelector selector, final MessageListener listener) {
+        if (null == this.consumer) {
+            throw new ONSClientException("subscribe must be called after consumerBean started");
+        }
+        this.consumer.subscribe(topic, selector, listener);
+    }
+
+    @Override
+    public void unsubscribe(String topic) {
+        if (null == this.consumer) {
+            throw new ONSClientException("unsubscribe must be called after consumerBean started");
+        }
+        this.consumer.unsubscribe(topic);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    public Map<Subscription, MessageListener> getSubscriptionTable() {
+        return subscriptionTable;
+    }
+
+    public void setSubscriptionTable(Map<Subscription, MessageListener> subscriptionTable) {
+        this.subscriptionTable = subscriptionTable;
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.consumer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.consumer.isClosed();
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java
new file mode 100644
index 0000000..e5b6402
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+import java.util.Map;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.MessageSelector;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.order.MessageOrderListener;
+import org.apache.rocketmq.ons.api.order.OrderConsumer;
+
+public class OrderConsumerBean implements OrderConsumer {
+
+    private Properties properties;
+
+    private Map<Subscription, MessageOrderListener> subscriptionTable;
+
+    private OrderConsumer orderConsumer;
+
+    @Override
+    public boolean isStarted() {
+        return this.orderConsumer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.orderConsumer.isClosed();
+    }
+
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        if (null == this.subscriptionTable) {
+            throw new ONSClientException("subscriptionTable not set");
+        }
+
+        this.orderConsumer = ONSFactory.createOrderedConsumer(this.properties);
+
+        for (final Map.Entry<Subscription, MessageOrderListener> next : this.subscriptionTable.entrySet()) {
+            this.subscribe(next.getKey().getTopic(), next.getKey().getExpression(), next.getValue());
+        }
+
+        this.orderConsumer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.orderConsumer != null) {
+            this.orderConsumer.updateCredential(credentialProperties);
+        }
+    }
+
+    @Override
+    public void shutdown() {
+        if (this.orderConsumer != null) {
+            this.orderConsumer.shutdown();
+        }
+    }
+
+    @Override
+    public void subscribe(final String topic, final String subExpression, final MessageOrderListener listener) {
+        if (null == this.orderConsumer) {
+            throw new ONSClientException("subscribe must be called after OrderConsumerBean started");
+        }
+        this.orderConsumer.subscribe(topic, subExpression, listener);
+    }
+
+    @Override
+    public void subscribe(String topic, MessageSelector selector, MessageOrderListener listener) {
+        if (null == this.orderConsumer) {
+            throw new ONSClientException("subscribe must be called after OrderConsumerBean started");
+        }
+        this.orderConsumer.subscribe(topic, selector, listener);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(final Properties properties) {
+        this.properties = properties;
+    }
+
+    public Map<Subscription, MessageOrderListener> getSubscriptionTable() {
+        return subscriptionTable;
+    }
+
+    public void setSubscriptionTable(
+        final Map<Subscription, MessageOrderListener> subscriptionTable) {
+        this.subscriptionTable = subscriptionTable;
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java
new file mode 100644
index 0000000..64cf25b
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.order.OrderProducer;
+import java.util.Properties;
+
+
+public class OrderProducerBean implements OrderProducer {
+
+    private Properties properties;
+
+    private OrderProducer orderProducer;
+
+
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        this.orderProducer = ONSFactory.createOrderProducer(this.properties);
+        this.orderProducer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.orderProducer != null) {
+            this.orderProducer.updateCredential(credentialProperties);
+        }
+    }
+
+
+    @Override
+    public void shutdown() {
+        if (this.orderProducer != null) {
+            this.orderProducer.shutdown();
+        }
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.orderProducer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.orderProducer.isClosed();
+    }
+
+    @Override
+    public SendResult send(final Message message, final String shardingKey) {
+        return this.orderProducer.send(message, shardingKey);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(final Properties properties) {
+        this.properties = properties;
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java
new file mode 100644
index 0000000..2094158
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.Producer;
+import org.apache.rocketmq.ons.api.SendCallback;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+
+public class ProducerBean implements Producer {
+
+    private Properties properties;
+    private Producer producer;
+
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        this.producer = ONSFactory.createProducer(this.properties);
+        this.producer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.producer != null) {
+            this.producer.updateCredential(credentialProperties);
+        }
+    }
+
+    @Override
+    public void shutdown() {
+        if (this.producer != null) {
+            this.producer.shutdown();
+        }
+    }
+
+
+    @Override
+    public SendResult send(Message message) {
+        return this.producer.send(message);
+    }
+
+
+    @Override
+    public void sendOneway(Message message) {
+        this.producer.sendOneway(message);
+    }
+
+    @Override
+    public void sendAsync(Message message, SendCallback sendCallback) {
+        this.producer.sendAsync(message, sendCallback);
+    }
+
+    @Override
+    public void setCallbackExecutor(final ExecutorService callbackExecutor) {
+        this.producer.setCallbackExecutor(callbackExecutor);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.producer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.producer.isClosed();
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/Subscription.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/Subscription.java
new file mode 100644
index 0000000..1840d4d
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/Subscription.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+import org.apache.rocketmq.ons.api.ExpressionType;
+
+public class Subscription {
+    private String topic;
+    private String expression;
+
+    /**
+     * TAG or SQL92
+     * <br>if null, equals to TAG
+     *
+     * @see ExpressionType#TAG
+     * @see ExpressionType#SQL92
+     */
+    private String type;
+
+    public String getTopic() {
+        return topic;
+    }
+
+    public void setTopic(String topic) {
+        this.topic = topic;
+    }
+
+    public String getExpression() {
+        return expression;
+    }
+
+    public void setExpression(String expression) {
+        this.expression = expression;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((topic == null) ? 0 : topic.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        Subscription other = (Subscription) obj;
+        if (topic == null) {
+            if (other.topic != null) {
+                return false;
+            }
+        } else if (!topic.equals(other.topic)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Subscription [topic=" + topic + ", expression=" + expression + ", type=" + type + "]";
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/SubscriptionExt.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/SubscriptionExt.java
new file mode 100644
index 0000000..7413f90
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/SubscriptionExt.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+
+public class SubscriptionExt extends Subscription {
+    private boolean persistence = true;
+
+    public boolean isPersistence() {
+        return persistence;
+    }
+
+    public void setPersistence(boolean persistence) {
+        this.persistence = persistence;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return super.equals(obj);
+    }
+
+    @Override
+    public String toString() {
+        return "Subscription [topic=" + super.getTopic() + ", expression=" + super.getExpression()
+            + ", persistence=" + persistence + "]";
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java
new file mode 100644
index 0000000..cb55e14
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.bean;
+
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionExecuter;
+import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
+
+
+public class TransactionProducerBean implements TransactionProducer {
+
+    private Properties properties;
+
+
+    private LocalTransactionChecker localTransactionChecker;
+
+    private TransactionProducer transactionProducer;
+
+
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        this.transactionProducer = ONSFactory.createTransactionProducer(properties, localTransactionChecker);
+        this.transactionProducer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.transactionProducer != null) {
+            this.transactionProducer.updateCredential(credentialProperties);
+        }
+    }
+
+
+    @Override
+    public void shutdown() {
+        if (this.transactionProducer != null) {
+            this.transactionProducer.shutdown();
+        }
+    }
+
+    @Override
+    public SendResult send(Message message, LocalTransactionExecuter executer, Object arg) {
+        return this.transactionProducer.send(message, executer, arg);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    public LocalTransactionChecker getLocalTransactionChecker() {
+        return localTransactionChecker;
+    }
+
+    public void setLocalTransactionChecker(LocalTransactionChecker localTransactionChecker) {
+        this.localTransactionChecker = localTransactionChecker;
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.transactionProducer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.transactionProducer.isClosed();
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java
new file mode 100644
index 0000000..a761e3b
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.exception;
+
+
+public class ONSClientException extends RuntimeException {
+    private static final long serialVersionUID = 5755356574640041094L;
+
+
+    public ONSClientException() {
+    }
+
+
+    public ONSClientException(String message) {
+        super(message);
+    }
+
+
+    public ONSClientException(Throwable cause) {
+        super(cause);
+    }
+
+
+    public ONSClientException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/ConsumeOrderContext.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/ConsumeOrderContext.java
new file mode 100644
index 0000000..f7102c3
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/ConsumeOrderContext.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.order;
+
+public class ConsumeOrderContext {
+
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageOrderListener.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageOrderListener.java
new file mode 100644
index 0000000..20a4003
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageOrderListener.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.order;
+
+import org.apache.rocketmq.ons.api.Message;
+
+public interface MessageOrderListener {
+
+    OrderAction consume(final Message message, final ConsumeOrderContext context);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageQueueSelector.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageQueueSelector.java
new file mode 100644
index 0000000..bee8d64
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageQueueSelector.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.order;
+
+import org.apache.rocketmq.ons.api.Message;
+
+public interface MessageQueueSelector {
+
+    int select(final int queueTotal, final Message msg, final Object arg);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderAction.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderAction.java
new file mode 100644
index 0000000..e2dc190
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderAction.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.order;
+
+
+public enum OrderAction {
+
+    Success,
+
+    Suspend,
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderConsumer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderConsumer.java
new file mode 100644
index 0000000..4e73c1b
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderConsumer.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.order;
+
+import org.apache.rocketmq.ons.api.Admin;
+import org.apache.rocketmq.ons.api.MessageSelector;
+
+
+public interface OrderConsumer extends Admin {
+
+    @Override
+    void start();
+
+    @Override
+    void shutdown();
+
+    void subscribe(final String topic, final String subExpression, final MessageOrderListener listener);
+
+    void subscribe(final String topic, final MessageSelector selector, final MessageOrderListener listener);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderProducer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderProducer.java
new file mode 100644
index 0000000..4e9a0bb
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderProducer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.order;
+
+import org.apache.rocketmq.ons.api.Admin;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.SendResult;
+
+
+public interface OrderProducer extends Admin {
+
+    SendResult send(final Message message, final String shardingKey);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionChecker.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionChecker.java
new file mode 100644
index 0000000..eb46593
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionChecker.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.transaction;
+
+import org.apache.rocketmq.ons.api.Message;
+
+public interface LocalTransactionChecker {
+
+    TransactionStatus check(final Message msg);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionExecuter.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionExecuter.java
new file mode 100644
index 0000000..f3fe785
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionExecuter.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.transaction;
+
+import org.apache.rocketmq.ons.api.Message;
+
+
+public interface LocalTransactionExecuter {
+
+    TransactionStatus execute(final Message msg, final Object arg);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionProducer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionProducer.java
new file mode 100644
index 0000000..c139db1
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionProducer.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.transaction;
+
+import org.apache.rocketmq.ons.api.Admin;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.SendResult;
+
+
+public interface TransactionProducer extends Admin {
+
+    @Override
+    void start();
+
+
+    @Override
+    void shutdown();
+
+
+    SendResult send(final Message message,
+        final LocalTransactionExecuter executer,
+        final Object arg);
+}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionStatus.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionStatus.java
new file mode 100644
index 0000000..c98c9ef
--- /dev/null
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionStatus.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.transaction;
+
+
+public enum TransactionStatus {
+
+    CommitTransaction,
+
+    RollbackTransaction,
+
+    Unknow
+}
diff --git a/ons-core/ons-auth4client/pom.xml b/ons-core/ons-auth4client/pom.xml
new file mode 100644
index 0000000..643f7c7
--- /dev/null
+++ b/ons-core/ons-auth4client/pom.xml
@@ -0,0 +1,37 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>ons-all</artifactId>
+        <groupId>org.apache.rocketmq</groupId>
+        <version>1.8.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>ons-auth4client</artifactId>
+    <name>ons-auth4client ${project.version}</name>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/AuthUtil.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/AuthUtil.java
new file mode 100644
index 0000000..c8dd4f9
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/AuthUtil.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.impl.authority;
+
+import java.util.Map;
+import java.util.SortedMap;
+
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+
+
+public class AuthUtil {
+    public static byte[] combineRequestContent(RemotingCommand request, SortedMap<String, String> fieldsMap) {
+        try {
+            StringBuilder sb = new StringBuilder("");
+            for (Map.Entry<String, String> entry : fieldsMap.entrySet()) {
+                if (!SessionCredentials.Signature.equals(entry.getKey())) {
+                    sb.append(entry.getValue());
+                }
+            }
+
+            return AuthUtil.combineBytes(sb.toString().getBytes(SessionCredentials.CHARSET), request.getBody());
+        } catch (Exception e) {
+            throw new RuntimeException("incompatible exception.", e);
+        }
+    }
+
+    public static byte[] combineBytes(byte[] b1, byte[] b2) {
+        int size = (null != b1 ? b1.length : 0) + (null != b2 ? b2.length : 0);
+        byte[] total = new byte[size];
+        if (null != b1) {
+            System.arraycopy(b1, 0, total, 0, b1.length);
+        }
+        if (null != b2) {
+            System.arraycopy(b2, 0, total, b1.length, b2.length);
+        }
+        return total;
+    }
+
+
+    public static String calSignature(byte[] data, String secretKey) {
+        String signature = OnsAuthSigner.calSignature(data, secretKey);
+        return signature;
+    }
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/OnsAuthSigner.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/OnsAuthSigner.java
new file mode 100644
index 0000000..b948779
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/OnsAuthSigner.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.authority;
+
+import java.nio.charset.Charset;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.rocketmq.common.constant.LoggerName;
+import org.apache.rocketmq.logging.InternalLogger;
+import org.apache.rocketmq.logging.InternalLoggerFactory;
+import org.apache.rocketmq.ons.api.impl.authority.exception.AuthenticationException;
+
+public class OnsAuthSigner {
+    private static final InternalLogger LOGGER = InternalLoggerFactory.getLogger(LoggerName.ROCKETMQ_AUTHORIZE_LOGGER_NAME);
+    public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+    public static final SigningAlgorithm DEFAULT_ALGORITHM = SigningAlgorithm.HmacSHA1;
+    private static final int CAL_SIGNATURE_FAILED = 10015;
+    private static final String CAL_SIGNATURE_FAILED_MSG = "[%s:signature-failed] unable to calculate a request signature. error=%s";
+
+    public static String calSignature(String data, String key) throws AuthenticationException {
+        return calSignature(data, key, DEFAULT_ALGORITHM, DEFAULT_CHARSET);
+    }
+
+    public static String calSignature(String data, String key, SigningAlgorithm algorithm,
+        Charset charset) throws AuthenticationException {
+        return signAndBase64Encode(data, key, algorithm, charset);
+    }
+
+    private static String signAndBase64Encode(String data, String key, SigningAlgorithm algorithm, Charset charset)
+        throws AuthenticationException {
+        try {
+            byte[] signature = sign(data.getBytes(charset), key.getBytes(charset), algorithm);
+            return new String(Base64.encodeBase64(signature), DEFAULT_CHARSET);
+        } catch (Exception e) {
+            String message = String.format(CAL_SIGNATURE_FAILED_MSG, CAL_SIGNATURE_FAILED, e.getMessage());
+            LOGGER.error(message, e);
+            throw new AuthenticationException("CAL_SIGNATURE_FAILED", CAL_SIGNATURE_FAILED, message, e);
+        }
+    }
+
+    private static byte[] sign(byte[] data, byte[] key, SigningAlgorithm algorithm) throws AuthenticationException {
+        try {
+            Mac mac = Mac.getInstance(algorithm.toString());
+            mac.init(new SecretKeySpec(key, algorithm.toString()));
+            return mac.doFinal(data);
+        } catch (Exception e) {
+            String message = String.format(CAL_SIGNATURE_FAILED_MSG, CAL_SIGNATURE_FAILED, e.getMessage());
+            LOGGER.error(message, e);
+            throw new AuthenticationException("CAL_SIGNATURE_FAILED", CAL_SIGNATURE_FAILED, message, e);
+        }
+    }
+
+    public static String calSignature(byte[] data, String key) throws AuthenticationException {
+        return calSignature(data, key, DEFAULT_ALGORITHM, DEFAULT_CHARSET);
+    }
+
+    public static String calSignature(byte[] data, String key, SigningAlgorithm algorithm,
+        Charset charset) throws AuthenticationException {
+        return signAndBase64Encode(data, key, algorithm, charset);
+    }
+
+    private static String signAndBase64Encode(byte[] data, String key, SigningAlgorithm algorithm, Charset charset)
+        throws AuthenticationException {
+        try {
+            byte[] signature = sign(data, key.getBytes(charset), algorithm);
+            return new String(Base64.encodeBase64(signature), DEFAULT_CHARSET);
+        } catch (Exception e) {
+            String message = String.format(CAL_SIGNATURE_FAILED_MSG, CAL_SIGNATURE_FAILED, e.getMessage());
+            LOGGER.error(message, e);
+            throw new AuthenticationException("CAL_SIGNATURE_FAILED", CAL_SIGNATURE_FAILED, message, e);
+        }
+    }
+
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
new file mode 100644
index 0000000..fdbac11
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.authority;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.Properties;
+
+import javax.annotation.Generated;
+
+import org.apache.rocketmq.common.MixAll;
+
+import org.apache.rocketmq.ons.api.impl.rocketmq.ONSChannel;
+
+@Generated("ons-auth4client")
+public class SessionCredentials {
+    public static final Charset CHARSET = Charset.forName("UTF-8");
+    public static final String AccessKey = "AccessKey";
+    public static final String SecretKey = "SecretKey";
+    public static final String Signature = "Signature";
+    public static final String SecurityToken = "SecurityToken";
+    public static final String SignatureMethod = "SignatureMethod";
+    public static final String ONSChannelKey = "OnsChannel";
+
+    public static final String KeyFile = System.getProperty("rocketmq.client.keyFile",
+        System.getProperty("user.home") + File.separator + "onskey");
+
+    private String accessKey;
+    private String secretKey;
+    private String securityToken;
+    private String signature;
+    private String signatureMethod;
+    private ONSChannel onsChannel = ONSChannel.ALIYUN;
+
+    public SessionCredentials() {
+        String keyContent = null;
+        try {
+            keyContent = MixAll.file2String(KeyFile);
+        } catch (IOException ignore) {
+        }
+        if (keyContent != null) {
+            Properties prop = MixAll.string2Properties(keyContent);
+            if (prop != null) {
+                this.updateContent(prop);
+            }
+        }
+    }
+
+    public void updateContent(Properties prop) {
+        {
+            String value = prop.getProperty(AccessKey);
+            if (value != null) {
+                this.accessKey = value.trim();
+            }
+        }
+        {
+            String value = prop.getProperty(SecretKey);
+            if (value != null) {
+                this.secretKey = value.trim();
+            }
+        }
+        {
+            Object value = prop.get(ONSChannelKey);
+            if (value != null) {
+                this.onsChannel = ONSChannel.valueOf(value.toString());
+            }
+        }
+
+        {
+            String value = prop.getProperty(SecurityToken);
+            if (value != null) {
+                this.securityToken = value.trim();
+            }
+        }
+    }
+
+    public String getAccessKey() {
+        return accessKey;
+    }
+
+    public void setAccessKey(String accessKey) {
+        this.accessKey = accessKey;
+    }
+
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public void setSecretKey(String secretKey) {
+        this.secretKey = secretKey;
+    }
+
+    public String getSignature() {
+        return signature;
+    }
+
+    public void setSignature(String signature) {
+        this.signature = signature;
+    }
+
+    public String getSecurityToken() {
+        return securityToken;
+    }
+
+    public void setSecurityToken(final String securityToken) {
+        this.securityToken = securityToken;
+    }
+
+    public String getSignatureMethod() {
+        return signatureMethod;
+    }
+
+    public void setSignatureMethod(String signatureMethod) {
+        this.signatureMethod = signatureMethod;
+    }
+
+    public ONSChannel getOnsChannel() {
+        return onsChannel;
+    }
+
+    public void setOnsChannel(ONSChannel onsChannel) {
+        this.onsChannel = onsChannel;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((accessKey == null) ? 0 : accessKey.hashCode());
+        result = prime * result + ((secretKey == null) ? 0 : secretKey.hashCode());
+        result = prime * result + ((signature == null) ? 0 : signature.hashCode());
+        result = prime * result + ((signatureMethod == null) ? 0 : signatureMethod.hashCode());
+        result = prime * result + ((onsChannel == null) ? 0 : onsChannel.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        SessionCredentials other = (SessionCredentials) obj;
+        if (accessKey == null) {
+            if (other.accessKey != null) {
+                return false;
+            }
+        } else if (!accessKey.equals(other.accessKey)) {
+            return false;
+        }
+
+        if (secretKey == null) {
+            if (other.secretKey != null) {
+                return false;
+            }
+        } else if (!secretKey.equals(other.secretKey)) {
+            return false;
+        }
+
+        if (signature == null) {
+            if (other.signature != null) {
+                return false;
+            }
+        } else if (!signature.equals(other.signature)) {
+            return false;
+        }
+
+        if (signatureMethod == null) {
+            if (other.signatureMethod != null) {
+                return false;
+            }
+        } else if (!signatureMethod.equals(other.signatureMethod)) {
+            return false;
+        }
+
+        if (onsChannel == null) {
+            if (other.onsChannel != null) {
+                return false;
+            }
+        } else if (!onsChannel.equals(other.onsChannel)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "SessionCredentials [accessKey=" + accessKey + ", secretKey=" + secretKey + ", signature="
+            + signature + ", signatureMethod=" + signatureMethod + ", onsChannel=" + onsChannel + "]";
+    }
+}
\ No newline at end of file
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SigningAlgorithm.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SigningAlgorithm.java
new file mode 100644
index 0000000..663b887
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SigningAlgorithm.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.authority;
+
+public enum SigningAlgorithm {
+    HmacSHA1,
+    HmacSHA256,
+    HmacMD5;
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/AuthenticationException.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/AuthenticationException.java
new file mode 100644
index 0000000..4188a98
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/AuthenticationException.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.authority.exception;
+
+public class AuthenticationException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    private String status;
+    private int code;
+
+
+    public AuthenticationException(String status, int code) {
+        super();
+        this.status = status;
+        this.code = code;
+    }
+
+
+    public AuthenticationException(String status, int code, String message) {
+        super(message);
+        this.status = status;
+        this.code = code;
+    }
+
+
+    public AuthenticationException(String status, int code, Throwable throwable) {
+        super(throwable);
+        this.status = status;
+        this.code = code;
+    }
+
+
+    public AuthenticationException(String status, int code, String message, Throwable throwable) {
+        super(message, throwable);
+        this.status = status;
+        this.code = code;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/FlowControlException.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/FlowControlException.java
new file mode 100644
index 0000000..17d872c
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/FlowControlException.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.impl.authority.exception;
+
+public class FlowControlException extends RuntimeException {
+
+    private static final long serialVersionUID = -3662598055526208602L;
+    private final int code;
+
+    public FlowControlException(int code) {
+        super();
+        this.code = code;
+    }
+
+    public FlowControlException(int code, String message, Throwable cause) {
+        super(message, cause);
+        this.code = code;
+    }
+
+    public FlowControlException(int code, String message) {
+        super(message);
+        this.code = code;
+    }
+
+    public FlowControlException(int code, Throwable cause) {
+        super(cause);
+        this.code = code;
+    }
+
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/SignatureException.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/SignatureException.java
new file mode 100644
index 0000000..4269391
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/exception/SignatureException.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.authority.exception;
+
+public class SignatureException extends RuntimeException {
+
+    private static final long serialVersionUID = -3662598055526208602L;
+    private final int code;
+
+
+    public SignatureException(int code) {
+        super();
+        this.code = code;
+    }
+
+
+    public SignatureException(int code, String message, Throwable cause) {
+        super(message, cause);
+        this.code = code;
+    }
+
+
+    public SignatureException(int code, String message) {
+        super(message);
+        this.code = code;
+    }
+
+
+    public SignatureException(int code, Throwable cause) {
+        super(cause);
+        this.code = code;
+    }
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/AbstractRPCHook.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/AbstractRPCHook.java
new file mode 100644
index 0000000..102b24b
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/AbstractRPCHook.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.lang.reflect.Field;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.rocketmq.remoting.CommandCustomHeader;
+import org.apache.rocketmq.remoting.RPCHook;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.AccessKey;
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.ONSChannelKey;
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.SecurityToken;
+
+public abstract class AbstractRPCHook implements RPCHook {
+    protected ConcurrentHashMap<Class<? extends CommandCustomHeader>, Field[]> fieldCache =
+            new ConcurrentHashMap<Class<? extends CommandCustomHeader>, Field[]>();
+
+
+    protected SortedMap<String, String> parseRequestContent(RemotingCommand request, String ak, String securityToken, String onsChannel) {
+        CommandCustomHeader header = request.readCustomHeader();
+        // sort property
+        SortedMap<String, String> map = new TreeMap<String, String>();
+        map.put(AccessKey, ak);
+        map.put(ONSChannelKey, onsChannel);
+        if (securityToken != null) {
+            map.put(SecurityToken, securityToken);
+        }
+        try {
+            // add header properties
+            if (null != header) {
+                Field[] fields = fieldCache.get(header.getClass());
+                if (null == fields) {
+                    fields = header.getClass().getDeclaredFields();
+                    for (Field field : fields) {
+                        field.setAccessible(true);
+                    }
+                    Field[] tmp = fieldCache.putIfAbsent(header.getClass(), fields);
+                    if (null != tmp) {
+                        fields = tmp;
+                    }
+                }
+
+                for (Field field : fields) {
+                    Object value = field.get(header);
+                    if (null != value && !field.isSynthetic()) {
+                        map.put(field.getName(), value.toString());
+                    }
+                }
+            }
+            return map;
+        } catch (Exception e) {
+            throw new RuntimeException("incompatible exception.", e);
+        }
+    }
+
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java
new file mode 100644
index 0000000..72e36b9
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+import org.apache.rocketmq.ons.api.impl.authority.AuthUtil;
+import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.AccessKey;
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.ONSChannelKey;
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.SecurityToken;
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.Signature;
+
+public class ClientRPCHook extends AbstractRPCHook {
+    private SessionCredentials sessionCredentials;
+
+    public ClientRPCHook(SessionCredentials sessionCredentials) {
+        this.sessionCredentials = sessionCredentials;
+    }
+
+    @Override
+    public void doBeforeRequest(String remoteAddr, RemotingCommand request) {
+        byte[] total = AuthUtil.combineRequestContent(request,
+            parseRequestContent(request, sessionCredentials.getAccessKey(),
+                sessionCredentials.getSecurityToken(), sessionCredentials.getOnsChannel().name()));
+        String signature = AuthUtil.calSignature(total, sessionCredentials.getSecretKey());
+        request.addExtField(Signature, signature);
+        request.addExtField(AccessKey, sessionCredentials.getAccessKey());
+        request.addExtField(ONSChannelKey, sessionCredentials.getOnsChannel().name());
+
+        if (sessionCredentials.getSecurityToken() != null) {
+            request.addExtField(SecurityToken, sessionCredentials.getSecurityToken());
+        }
+    }
+
+
+    @Override
+    public void doAfterResponse(String remoteAddr, RemotingCommand request, RemotingCommand response) {
+
+    }
+
+}
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSChannel.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSChannel.java
new file mode 100644
index 0000000..93fdaf1
--- /dev/null
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSChannel.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+public enum ONSChannel {
+    CLOUD,
+    ALIYUN,
+    ALL
+}
diff --git a/ons-core/ons-client/pom.xml b/ons-core/ons-client/pom.xml
new file mode 100644
index 0000000..7cc5df2
--- /dev/null
+++ b/ons-core/ons-client/pom.xml
@@ -0,0 +1,74 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>ons-all</artifactId>
+        <version>1.8.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+    <artifactId>ons-client</artifactId>
+    <name>ons-client ${project.version}</name>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-client</artifactId>
+            <version>${rocketmq.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ons-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ons-trace-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ons-auth4client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/MQClientInfo.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/MQClientInfo.java
new file mode 100644
index 0000000..96ce1ca
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/MQClientInfo.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl;
+
+import java.io.InputStream;
+import java.util.Properties;
+import org.apache.rocketmq.common.MQVersion;
+
+public class MQClientInfo {
+
+    public static int versionCode = MQVersion.CURRENT_VERSION;
+
+    static {
+        try {
+            InputStream stream = MQClientInfo.class.getClassLoader().getResourceAsStream("ons_client_info.properties");
+            Properties properties = new Properties();
+            properties.load(stream);
+            String pkgVersion = String.valueOf(properties.get("version"));
+            versionCode = Integer.MAX_VALUE - Integer.valueOf(pkgVersion.replaceAll("[^0-9]", ""));
+        } catch (Exception ignore) {
+        }
+    }
+
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
new file mode 100644
index 0000000..4fca00e
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl;
+
+import org.apache.rocketmq.client.producer.LocalTransactionState;
+import org.apache.rocketmq.client.producer.TransactionCheckListener;
+import org.apache.rocketmq.common.message.MessageExt;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.Consumer;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactoryAPI;
+import org.apache.rocketmq.ons.api.Producer;
+import org.apache.rocketmq.ons.api.batch.BatchConsumer;
+import org.apache.rocketmq.ons.api.impl.rocketmq.BatchConsumerImpl;
+import org.apache.rocketmq.ons.api.impl.rocketmq.ConsumerImpl;
+import org.apache.rocketmq.ons.api.impl.rocketmq.ONSUtil;
+import org.apache.rocketmq.ons.api.impl.rocketmq.OrderConsumerImpl;
+import org.apache.rocketmq.ons.api.impl.rocketmq.OrderProducerImpl;
+import org.apache.rocketmq.ons.api.impl.rocketmq.ProducerImpl;
+import org.apache.rocketmq.ons.api.impl.rocketmq.TransactionProducerImpl;
+import org.apache.rocketmq.ons.api.order.OrderConsumer;
+import org.apache.rocketmq.ons.api.order.OrderProducer;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
+import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
+import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
+
+public class ONSFactoryImpl implements ONSFactoryAPI {
+    @Override
+    public Producer createProducer(final Properties properties) {
+        return new ProducerImpl(ONSUtil.extractProperties(properties));
+    }
+
+
+    @Override
+    public Consumer createConsumer(final Properties properties) {
+        return new ConsumerImpl(ONSUtil.extractProperties(properties));
+    }
+
+    @Override
+    public BatchConsumer createBatchConsumer(final Properties properties) {
+        return new BatchConsumerImpl(ONSUtil.extractProperties(properties));
+    }
+
+    @Override
+    public OrderProducer createOrderProducer(final Properties properties) {
+        return new OrderProducerImpl(ONSUtil.extractProperties(properties));
+    }
+
+
+    @Override
+    public OrderConsumer createOrderedConsumer(final Properties properties) {
+        return new OrderConsumerImpl(ONSUtil.extractProperties(properties));
+    }
+
+    @Override
+    public TransactionProducer createTransactionProducer(Properties properties,
+                                                         final LocalTransactionChecker checker) {
+        return new TransactionProducerImpl(ONSUtil.extractProperties(properties), new TransactionCheckListener() {
+            @Override
+            public LocalTransactionState checkLocalTransactionState(MessageExt msg) {
+                String msgId = msg.getProperty(Constants.TRANSACTION_ID);
+                Message message = ONSUtil.msgConvert(msg);
+                message.setMsgID(msgId);
+                TransactionStatus check = checker.check(message);
+                if (TransactionStatus.CommitTransaction == check) {
+                    return LocalTransactionState.COMMIT_MESSAGE;
+                } else if (TransactionStatus.RollbackTransaction == check) {
+                    return LocalTransactionState.ROLLBACK_MESSAGE;
+                }
+                return LocalTransactionState.UNKNOW;
+            }
+        });
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
new file mode 100644
index 0000000..592a40c
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.Generated;
+
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
+
+import org.apache.rocketmq.ons.api.Action;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.ConsumeContext;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyValueConst;
+import org.apache.rocketmq.ons.api.batch.BatchConsumer;
+import org.apache.rocketmq.ons.api.batch.BatchMessageListener;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+@Generated("ons-client")
+public class BatchConsumerImpl extends ONSConsumerAbstract implements BatchConsumer {
+    private final static int MAX_BATCH_SIZE = 32;
+    private final static int MIN_BATCH_SIZE = 1;
+    private final ConcurrentHashMap<String, BatchMessageListener> subscribeTable = new ConcurrentHashMap<String, BatchMessageListener>();
+
+    public BatchConsumerImpl(final Properties properties) {
+        super(properties);
+
+        boolean postSubscriptionWhenPull = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.PostSubscriptionWhenPull, "false"));
+        this.defaultMQPushConsumer.setPostSubscriptionWhenPull(postSubscriptionWhenPull);
+
+        String messageModel = properties.getProperty(PropertyKeyConst.MessageModel, PropertyValueConst.CLUSTERING);
+        this.defaultMQPushConsumer.setMessageModel(MessageModel.valueOf(messageModel));
+
+        String consumeBatchSize = properties.getProperty(PropertyKeyConst.ConsumeMessageBatchMaxSize);
+        if (!UtilAll.isBlank(consumeBatchSize)) {
+            int batchSize = Math.min(MAX_BATCH_SIZE, Integer.valueOf(consumeBatchSize));
+            batchSize = Math.max(MIN_BATCH_SIZE, batchSize);
+            this.defaultMQPushConsumer.setConsumeMessageBatchMaxSize(batchSize);
+        }
+    }
+
+    @Override
+    public void start() {
+        this.defaultMQPushConsumer.registerMessageListener(new BatchMessageListenerImpl());
+        super.start();
+    }
+
+    @Override
+    public void subscribe(String topic, String subExpression, BatchMessageListener listener) {
+        if (null == topic) {
+            throw new ONSClientException("topic is null");
+        }
+
+        if (null == listener) {
+            throw new ONSClientException("listener is null");
+        }
+        this.subscribeTable.put(topic, listener);
+        super.subscribe(topic, subExpression);
+    }
+
+    @Override
+    public void unsubscribe(String topic) {
+        if (null != topic) {
+            this.subscribeTable.remove(topic);
+            super.unsubscribe(topic);
+        }
+    }
+
+    class BatchMessageListenerImpl implements MessageListenerConcurrently {
+
+        @Override
+        public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> rmqMsgList,
+            ConsumeConcurrentlyContext contextRMQ) {
+            List<Message> msgList = new ArrayList<Message>();
+            for (MessageExt rmqMsg : rmqMsgList) {
+                Message msg = ONSUtil.msgConvert(rmqMsg);
+                Map<String, String> propertiesMap = rmqMsg.getProperties();
+                msg.setMsgID(rmqMsg.getMsgId());
+                if (propertiesMap != null && propertiesMap.get(Constants.TRANSACTION_ID) != null) {
+                    msg.setMsgID(propertiesMap.get(Constants.TRANSACTION_ID));
+                }
+                msgList.add(msg);
+            }
+
+            BatchMessageListener listener = BatchConsumerImpl.this.subscribeTable.get(msgList.get(0).getTopic());
+            if (null == listener) {
+                throw new ONSClientException("BatchMessageListener is null");
+            }
+
+            final ConsumeContext context = new ConsumeContext();
+            Action action = listener.consume(msgList, context);
+            if (action != null) {
+                switch (action) {
+                    case CommitMessage:
+                        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+                    case ReconsumeLater:
+                        return ConsumeConcurrentlyStatus.RECONSUME_LATER;
+                    default:
+                        break;
+                }
+            }
+            return null;
+        }
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
new file mode 100644
index 0000000..415482f
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.Generated;
+
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
+
+import org.apache.rocketmq.ons.api.Action;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.ConsumeContext;
+import org.apache.rocketmq.ons.api.Consumer;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.MessageListener;
+import org.apache.rocketmq.ons.api.MessageSelector;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyValueConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+@Generated("ons-client")
+public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
+    private final ConcurrentHashMap<String, MessageListener> subscribeTable = new ConcurrentHashMap<String, MessageListener>();
+
+    public ConsumerImpl(final Properties properties) {
+        super(properties);
+        boolean postSubscriptionWhenPull = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.PostSubscriptionWhenPull, "false"));
+        this.defaultMQPushConsumer.setPostSubscriptionWhenPull(postSubscriptionWhenPull);
+
+        String messageModel = properties.getProperty(PropertyKeyConst.MessageModel, PropertyValueConst.CLUSTERING);
+        this.defaultMQPushConsumer.setMessageModel(MessageModel.valueOf(messageModel));
+    }
+
+    @Override
+    public void start() {
+        this.defaultMQPushConsumer.registerMessageListener(new MessageListenerImpl());
+        super.start();
+    }
+
+
+    @Override
+    public void subscribe(String topic, String subExpression, MessageListener listener) {
+        if (null == topic) {
+            throw new ONSClientException("topic is null");
+        }
+
+        if (null == listener) {
+            throw new ONSClientException("listener is null");
+        }
+        this.subscribeTable.put(topic, listener);
+        super.subscribe(topic, subExpression);
+    }
+
+    @Override
+    public void subscribe(final String topic, final MessageSelector selector, final MessageListener listener) {
+        if (null == topic) {
+            throw new ONSClientException("topic is null");
+        }
+
+        if (null == listener) {
+            throw new ONSClientException("listener is null");
+        }
+        this.subscribeTable.put(topic, listener);
+        super.subscribe(topic, selector);
+    }
+
+
+    @Override
+    public void unsubscribe(String topic) {
+        if (null != topic) {
+            this.subscribeTable.remove(topic);
+            super.unsubscribe(topic);
+        }
+    }
+
+
+    class MessageListenerImpl implements MessageListenerConcurrently {
+
+        @Override
+        public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgsRMQList,
+            ConsumeConcurrentlyContext contextRMQ) {
+            MessageExt msgRMQ = msgsRMQList.get(0);
+            Message msg = ONSUtil.msgConvert(msgRMQ);
+            Map<String, String> stringStringMap = msgRMQ.getProperties();
+            msg.setMsgID(msgRMQ.getMsgId());
+            if (stringStringMap != null && stringStringMap.get(Constants.TRANSACTION_ID) != null) {
+                msg.setMsgID(stringStringMap.get(Constants.TRANSACTION_ID));
+            }
+            MessageListener listener = ConsumerImpl.this.subscribeTable.get(msg.getTopic());
+            if (null == listener) {
+                throw new ONSClientException("MessageListener is null");
+            }
+
+            final ConsumeContext context = new ConsumeContext();
+            Action action = listener.consume(msg, context);
+            if (action != null) {
+                switch (action) {
+                    case CommitMessage:
+                        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+                    case ReconsumeLater:
+                        return ConsumeConcurrentlyStatus.RECONSUME_LATER;
+                    default:
+                        break;
+                }
+            }
+
+            return null;
+        }
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/FAQ.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/FAQ.java
new file mode 100644
index 0000000..523184d
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/FAQ.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+public class FAQ {
+    public static final String FIND_NS_FAILED =
+            "http://rocketmq.apache.org/docs/faq/exceptions&namesrv_not_exist";
+
+    public static final String CONNECT_BROKER_FAILED =
+            "http://rocketmq.apache.org/docs/faq/exceptions&connect_broker_failed";
+
+    public static final String SEND_MSG_TO_BROKER_TIMEOUT =
+            "http://rocketmq.apache.org/docs/faq/exceptions&send_msg_failed";
+
+    public static final String SERVICE_STATE_WRONG =
+            "http://rocketmq.apache.org/docs/faq/exceptions&service_not_ok";
+
+    public static final String BROKER_RESPONSE_EXCEPTION =
+            "http://rocketmq.apache.org/docs/faq/exceptions&broker_response_exception";
+
+    public static final String CLIENT_CHECK_MSG_EXCEPTION =
+            "http://rocketmq.apache.org/docs/faq/exceptions&msg_check_failed";
+
+    public static final String TOPIC_ROUTE_NOT_EXIST =
+            "http://rocketmq.apache.org/docs/faq/exceptions&topic_not_exist";
+
+
+    public static String errorMessage(final String msg, final String url) {
+        return String.format("%s\nSee %s for further details.", msg, url);
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
new file mode 100644
index 0000000..2cc4d9c
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.Properties;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.annotation.Generated;
+
+import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.common.namesrv.TopAddressing;
+import org.apache.rocketmq.logging.InternalLogger;
+
+import org.apache.rocketmq.ons.api.Admin;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
+import org.apache.rocketmq.ons.api.impl.util.NameAddrUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import static org.apache.rocketmq.common.UtilAll.getPid;
+
+@Generated("ons-client")
+public abstract class ONSClientAbstract implements Admin {
+
+    protected static final String WSADDR_INTERNAL = System.getProperty("com.aliyun.openservices.ons.addr.internal",
+        "http://onsaddr-internal.aliyun.com:8080/rocketmq/nsaddr4client-internal");
+
+    protected static final String WSADDR_INTERNET = System.getProperty("com.aliyun.openservices.ons.addr.internet",
+        "http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet");
+    protected static final long WSADDR_INTERNAL_TIMEOUTMILLS =
+        Long.parseLong(System.getProperty("com.aliyun.openservices.ons.addr.internal.timeoutmills", "3000"));
+    protected static final long WSADDR_INTERNET_TIMEOUTMILLS =
+            Long.parseLong(System.getProperty("com.aliyun.openservices.ons.addr.internet.timeoutmills", "5000"));
+    private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
+    protected final Properties properties;
+    protected final SessionCredentials sessionCredentials = new SessionCredentials();
+    protected String nameServerAddr = NameAddrUtils.getNameAdd();
+
+    protected AsyncDispatcher traceDispatcher = null;
+
+    protected final AtomicBoolean started = new AtomicBoolean(false);
+
+    private final ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(1,
+        new ThreadFactory() {
+            @Override
+            public Thread newThread(Runnable r) {
+                return new Thread(r, "ONSClient-UpdateNameServerThread");
+            }
+        });
+
+    public ONSClientAbstract(Properties properties) {
+        this.properties = properties;
+        this.sessionCredentials.updateContent(properties);
+        if (null == this.sessionCredentials.getAccessKey() || "".equals(this.sessionCredentials.getAccessKey())) {
+            throw new ONSClientException("please set access key");
+        }
+
+        if (null == this.sessionCredentials.getSecretKey() || "".equals(this.sessionCredentials.getSecretKey())) {
+            throw new ONSClientException("please set secret key");
+        }
+
+        if (null == this.sessionCredentials.getOnsChannel()) {
+            throw new ONSClientException("please set ons channel");
+        }
+
+
+
+        this.nameServerAddr = getNameSrvAddrFromProperties();
+        if (nameServerAddr != null) {
+            return;
+        }
+        this.nameServerAddr = fetchNameServerAddr();
+        if (null == nameServerAddr) {
+            throw new ONSClientException(FAQ.errorMessage("Can not find name server, May be your network problem.", FAQ.FIND_NS_FAILED));
+        }
+
+        this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    String nsAddrs = fetchNameServerAddr();
+                    if (nsAddrs != null && !ONSClientAbstract.this.nameServerAddr.equals(nsAddrs)) {
+                        ONSClientAbstract.this.nameServerAddr = nsAddrs;
+                        if (isStarted()) {
+                            updateNameServerAddr(nsAddrs);
+                        }
+                    }
+                } catch (Exception e) {
+                    LOGGER.error("update name server periodically failed.", e);
+                }
+            }
+        }, 10 * 1000L, 90 * 1000L, TimeUnit.MILLISECONDS);
+
+    }
+
+    protected abstract void updateNameServerAddr(String newAddrs);
+
+    private String getNameSrvAddrFromProperties() {
+        String nameserverAddrs = this.properties.getProperty(PropertyKeyConst.NAMESRV_ADDR);
+        if (StringUtils.isNotEmpty(nameserverAddrs) && NameAddrUtils.NAMESRV_ENDPOINT_PATTERN.matcher(nameserverAddrs.trim()).matches()) {
+            return nameserverAddrs.substring(NameAddrUtils.ENDPOINT_PREFIX.length());
+        }
+
+        return nameserverAddrs;
+    }
+
+    private String fetchNameServerAddr() {
+        String nsAddrs;
+
+
+        {
+            String property = this.properties.getProperty(PropertyKeyConst.ONSAddr);
+            if (property != null) {
+                nsAddrs = new TopAddressing(property).fetchNSAddr();
+                if (nsAddrs != null) {
+                    LOGGER.info("connected to user-defined ons addr server, {} success, {}", property, nsAddrs);
+                    return nsAddrs;
+                } else {
+                    throw new ONSClientException(FAQ.errorMessage("Can not find name server with onsAddr " + property, FAQ.FIND_NS_FAILED));
+                }
+            }
+        }
+
+
+        {
+            TopAddressing top = new TopAddressing(WSADDR_INTERNAL);
+            nsAddrs = top.fetchNSAddr(false, WSADDR_INTERNAL_TIMEOUTMILLS);
+            if (nsAddrs != null) {
+                LOGGER.info("connected to internal server, {} success, {}", WSADDR_INTERNAL, nsAddrs);
+                return nsAddrs;
+            }
+        }
+
+
+        {
+            TopAddressing top = new TopAddressing(WSADDR_INTERNET);
+            nsAddrs = top.fetchNSAddr(false, WSADDR_INTERNET_TIMEOUTMILLS);
+            if (nsAddrs != null) {
+                LOGGER.info("connected to internet server, {} success, {}", WSADDR_INTERNET, nsAddrs);
+            }
+        }
+
+        return nsAddrs;
+    }
+
+    public String getNameServerAddr() {
+        return this.nameServerAddr;
+    }
+
+    protected String buildIntanceName() {
+        return Integer.toString(UtilAll.getPid())
+            + "#" + this.nameServerAddr.hashCode()
+            + "#" + this.sessionCredentials.getAccessKey().hashCode()
+            + "#" + System.nanoTime();
+    }
+
+    protected String getNamespace() {
+        String namespace = null;
+
+
+        {
+            String nameserverAddr = this.properties.getProperty(PropertyKeyConst.NAMESRV_ADDR);
+            if (StringUtils.isNotEmpty(nameserverAddr)) {
+                if (NameAddrUtils.validateInstanceEndpoint(nameserverAddr)) {
+                    namespace = NameAddrUtils.parseInstanceIdFromEndpoint(nameserverAddr);
+                    LOGGER.info("User specify namespace by endpoint: {}.", namespace);
+                }
+            }
+        }
+
+
+        {
+            String namespaceFromProperty = this.properties.getProperty(PropertyKeyConst.INSTANCE_ID, null);
+            if (StringUtils.isNotEmpty(namespaceFromProperty)) {
+                namespace = namespaceFromProperty;
+                LOGGER.info("User specify namespace by property: {}.", namespace);
+            }
+        }
+
+        return namespace;
+    }
+
+    protected void checkONSProducerServiceState(DefaultMQProducerImpl producer) {
+        switch (producer.getServiceState()) {
+            case CREATE_JUST:
+                throw new ONSClientException(
+                    FAQ.errorMessage(String.format("You do not have start the producer[" + getPid() + "], %s", producer.getServiceState()),
+                        FAQ.SERVICE_STATE_WRONG));
+            case SHUTDOWN_ALREADY:
+                throw new ONSClientException(FAQ.errorMessage(String.format("Your producer has been shut down, %s", producer.getServiceState()),
+                    FAQ.SERVICE_STATE_WRONG));
+            case START_FAILED:
+                throw new ONSClientException(FAQ.errorMessage(
+                    String.format("When you start your service throws an exception, %s", producer.getServiceState()), FAQ.SERVICE_STATE_WRONG));
+            case RUNNING:
+                break;
+            default:
+                break;
+        }
+    }
+
+    @Override
+    public void start() {
+        if (null != traceDispatcher) {
+            try {
+                traceDispatcher.start();
+            } catch (MQClientException e) {
+                LOGGER.warn("trace dispatcher start failed ", e);
+            }
+        }
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (null == credentialProperties.getProperty(SessionCredentials.AccessKey)
+                || "".equals(credentialProperties.getProperty(SessionCredentials.AccessKey))) {
+            throw new ONSClientException("update credential failed. please set access key.");
+        }
+
+        if (null == credentialProperties.getProperty(SessionCredentials.SecretKey)
+                || "".equals(credentialProperties.getProperty(SessionCredentials.SecretKey))) {
+            throw new ONSClientException("update credential failed. please set secret key");
+        }
+        this.sessionCredentials.updateContent(credentialProperties);
+    }
+
+    @Override
+    public void shutdown() {
+        if (null != traceDispatcher) {
+            traceDispatcher.shutdown();
+        }
+        scheduledExecutorService.shutdown();
+    }
+
+    @Override
+    public boolean isStarted() {
+        return started.get();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return !isStarted();
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
new file mode 100644
index 0000000..d2bb38b
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.Properties;
+
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.logging.InternalLogger;
+
+import org.apache.rocketmq.ons.api.MessageSelector;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.tracehook.OnsConsumeMessageHookImpl;
+import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
+import org.apache.commons.lang3.StringUtils;
+
+public class ONSConsumerAbstract extends ONSClientAbstract {
+    final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
+    protected final DefaultMQPushConsumer defaultMQPushConsumer;
+    private final static int MAX_CACHED_MESSAGE_SIZE_IN_MIB = 2048;
+    private final static int MIN_CACHED_MESSAGE_SIZE_IN_MIB = 16;
+    private final static int MAX_CACHED_MESSAGE_AMOUNT = 50000;
+    private final static int MIN_CACHED_MESSAGE_AMOUNT = 100;
+
+    private int maxCachedMessageSizeInMiB = 512;
+
+    private int maxCachedMessageAmount = 5000;
+
+    public ONSConsumerAbstract(final Properties properties) {
+        super(properties);
+
+        String consumerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ConsumerId));
+        if (StringUtils.isEmpty(consumerGroup)) {
+            throw new ONSClientException("ConsumerId property is null");
+        }
+
+        this.defaultMQPushConsumer =
+            new DefaultMQPushConsumer(this.getNamespace(), consumerGroup, new OnsClientRPCHook(sessionCredentials));
+
+
+        String maxReconsumeTimes = properties.getProperty(PropertyKeyConst.MaxReconsumeTimes);
+        if (!UtilAll.isBlank(maxReconsumeTimes)) {
+            try {
+                this.defaultMQPushConsumer.setMaxReconsumeTimes(Integer.parseInt(maxReconsumeTimes));
+            } catch (NumberFormatException ignored) {
+            }
+        }
+
+        String maxBatchMessageCount = properties.getProperty(PropertyKeyConst.MAX_BATCH_MESSAGE_COUNT);
+        if (!UtilAll.isBlank(maxBatchMessageCount)) {
+            this.defaultMQPushConsumer.setPullBatchSize(Integer.valueOf(maxBatchMessageCount));
+        }
+
+        String consumeTimeout = properties.getProperty(PropertyKeyConst.ConsumeTimeout);
+        if (!UtilAll.isBlank(consumeTimeout)) {
+            try {
+                this.defaultMQPushConsumer.setConsumeTimeout(Integer.parseInt(consumeTimeout));
+            } catch (NumberFormatException ignored) {
+            }
+        }
+
+        boolean isVipChannelEnabled = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.isVipChannelEnabled, "false"));
+        this.defaultMQPushConsumer.setVipChannelEnabled(isVipChannelEnabled);
+
+        String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
+        this.defaultMQPushConsumer.setInstanceName(instanceName);
+        this.defaultMQPushConsumer.setNamesrvAddr(this.getNameServerAddr());
+
+        String consumeThreadNums = properties.getProperty(PropertyKeyConst.ConsumeThreadNums);
+        if (!UtilAll.isBlank(consumeThreadNums)) {
+            this.defaultMQPushConsumer.setConsumeThreadMin(Integer.valueOf(consumeThreadNums));
+            this.defaultMQPushConsumer.setConsumeThreadMax(Integer.valueOf(consumeThreadNums));
+        }
+
+        String configuredCachedMessageAmount = properties.getProperty(PropertyKeyConst.MaxCachedMessageAmount);
+        if (!UtilAll.isBlank(configuredCachedMessageAmount)) {
+            maxCachedMessageAmount = Math.min(MAX_CACHED_MESSAGE_AMOUNT, Integer.valueOf(configuredCachedMessageAmount));
+            maxCachedMessageAmount = Math.max(MIN_CACHED_MESSAGE_AMOUNT, maxCachedMessageAmount);
+            this.defaultMQPushConsumer.setPullThresholdForTopic(maxCachedMessageAmount);
+
+        }
+
+        String configuredCachedMessageSizeInMiB = properties.getProperty(PropertyKeyConst.MaxCachedMessageSizeInMiB);
+        if (!UtilAll.isBlank(configuredCachedMessageSizeInMiB)) {
+            maxCachedMessageSizeInMiB = Math.min(MAX_CACHED_MESSAGE_SIZE_IN_MIB, Integer.valueOf(configuredCachedMessageSizeInMiB));
+            maxCachedMessageSizeInMiB = Math.max(MIN_CACHED_MESSAGE_SIZE_IN_MIB, maxCachedMessageSizeInMiB);
+            this.defaultMQPushConsumer.setPullThresholdSizeForTopic(maxCachedMessageSizeInMiB);
+        }
+
+        String msgTraceSwitch = properties.getProperty(PropertyKeyConst.MsgTraceSwitch);
+        if (!UtilAll.isBlank(msgTraceSwitch) && (!Boolean.parseBoolean(msgTraceSwitch))) {
+            LOGGER.info("MQ Client Disable the Trace Hook!");
+        } else {
+            try {
+                Properties tempProperties = new Properties();
+                tempProperties.put(OnsTraceConstants.AccessKey, sessionCredentials.getAccessKey());
+                tempProperties.put(OnsTraceConstants.SecretKey, sessionCredentials.getSecretKey());
+                tempProperties.put(OnsTraceConstants.MaxMsgSize, "128000");
+                tempProperties.put(OnsTraceConstants.AsyncBufferSize, "2048");
+                tempProperties.put(OnsTraceConstants.MaxBatchNum, "100");
+                tempProperties.put(OnsTraceConstants.NAMESRV_ADDR, this.getNameServerAddr());
+                tempProperties.put(OnsTraceConstants.InstanceName, "PID_CLIENT_INNER_TRACE_PRODUCER");
+                tempProperties.put(OnsTraceConstants.TraceDispatcherType, OnsTraceDispatcherType.CONSUMER.name());
+                AsyncArrayDispatcher dispatcher = new AsyncArrayDispatcher(tempProperties, sessionCredentials);
+                dispatcher.setHostConsumer(defaultMQPushConsumer.getDefaultMQPushConsumerImpl());
+                traceDispatcher = dispatcher;
+                this.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().registerConsumeMessageHook(
+                    new OnsConsumeMessageHookImpl(traceDispatcher));
+            } catch (Throwable e) {
+                LOGGER.error("system mqtrace hook init failed ,maybe can't send msg trace data", e);
+            }
+        }
+    }
+
+    @Override
+    protected void updateNameServerAddr(String newAddrs) {
+        this.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().updateNameServerAddressList(newAddrs);
+    }
+
+    protected void subscribe(String topic, String subExpression) {
+        try {
+            this.defaultMQPushConsumer.subscribe(topic, subExpression);
+        } catch (MQClientException e) {
+            throw new ONSClientException("defaultMQPushConsumer subscribe exception", e);
+        }
+    }
+
+    protected void subscribe(final String topic, final MessageSelector selector) {
+        String subExpression = "*";
+        String type = org.apache.rocketmq.common.filter.ExpressionType.TAG;
+        if (selector != null) {
+            if (selector.getType() == null) {
+                throw new ONSClientException("Expression type is null!");
+            }
+            subExpression = selector.getSubExpression();
+            type = selector.getType().name();
+        }
+
+        org.apache.rocketmq.client.consumer.MessageSelector messageSelector;
+        if (org.apache.rocketmq.common.filter.ExpressionType.SQL92.equals(type)) {
+            messageSelector = org.apache.rocketmq.client.consumer.MessageSelector.bySql(subExpression);
+        } else if (org.apache.rocketmq.common.filter.ExpressionType.TAG.equals(type)) {
+            messageSelector = org.apache.rocketmq.client.consumer.MessageSelector.byTag(subExpression);
+        } else {
+            throw new ONSClientException(String.format("Expression type %s is unknown!", type));
+        }
+
+        try {
+            this.defaultMQPushConsumer.subscribe(topic, messageSelector);
+        } catch (MQClientException e) {
+            throw new ONSClientException("Consumer subscribe exception", e);
+        }
+    }
+
+    protected void unsubscribe(String topic) {
+        this.defaultMQPushConsumer.unsubscribe(topic);
+    }
+
+    @Override
+    public void start() {
+        try {
+            if (this.started.compareAndSet(false, true)) {
+                this.defaultMQPushConsumer.start();
+                super.start();
+            }
+        } catch (Exception e) {
+            throw new ONSClientException(e.getMessage());
+        }
+    }
+
+    @Override
+    public void shutdown() {
+        if (this.started.compareAndSet(true, false)) {
+            this.defaultMQPushConsumer.shutdown();
+        }
+        super.shutdown();
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
new file mode 100644
index 0000000..e6fac51
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.rocketmq.common.message.MessageConst;
+import org.apache.rocketmq.common.message.MessageExt;
+
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.MessageAccessor;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+public class ONSUtil {
+    private static final Set<String> RESERVED_KEY_SET_RMQ = new HashSet<String>();
+
+    private static final Set<String> RESERVED_KEY_SET_ONS = new HashSet<String>();
+
+
+    static {
+
+        /**
+         * RMQ
+         */
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_KEYS);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_TAGS);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_WAIT_STORE_MSG_OK);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_DELAY_TIME_LEVEL);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_RETRY_TOPIC);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_REAL_TOPIC);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_REAL_QUEUE_ID);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_TRANSACTION_PREPARED);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_PRODUCER_GROUP);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_MIN_OFFSET);
+        RESERVED_KEY_SET_RMQ.add(MessageConst.PROPERTY_MAX_OFFSET);
+
+        /**
+         * ONS
+         */
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.TAG);
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.KEY);
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.MSGID);
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.RECONSUMETIMES);
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.STARTDELIVERTIME);
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.BORNHOST);
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.BORNTIMESTAMP);
+        RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.SHARDINGKEY);
+    }
+
+
+    public static org.apache.rocketmq.common.message.Message msgConvert(Message message) {
+        org.apache.rocketmq.common.message.Message msgRMQ = new org.apache.rocketmq.common.message.Message();
+        if (message == null) {
+            throw new ONSClientException("\'message\' is null");
+        }
+
+        if (message.getTopic() != null) {
+            msgRMQ.setTopic(message.getTopic());
+        }
+        if (message.getKey() != null) {
+            msgRMQ.setKeys(message.getKey());
+        }
+        if (message.getTag() != null) {
+            msgRMQ.setTags(message.getTag());
+        }
+        if (message.getStartDeliverTime() > 0) {
+            msgRMQ.putUserProperty(Message.SystemPropKey.STARTDELIVERTIME, String.valueOf(message.getStartDeliverTime()));
+        }
+        if (message.getBody() != null) {
+            msgRMQ.setBody(message.getBody());
+        }
+
+        if (message.getShardingKey() != null && !message.getShardingKey().isEmpty()) {
+            msgRMQ.putUserProperty(Message.SystemPropKey.SHARDINGKEY, message.getShardingKey());
+        }
+
+        Properties systemProperties = MessageAccessor.getSystemProperties(message);
+        if (systemProperties != null) {
+            Iterator<Entry<Object, Object>> it = systemProperties.entrySet().iterator();
+            while (it.hasNext()) {
+                Entry<Object, Object> next = it.next();
+                if (!RESERVED_KEY_SET_ONS.contains(next.getKey().toString())) {
+                    org.apache.rocketmq.common.message.MessageAccessor.putProperty(msgRMQ, next.getKey().toString(),
+                            next.getValue().toString());
+                }
+            }
+        }
+
+        Properties userProperties = message.getUserProperties();
+        if (userProperties != null) {
+            Iterator<Entry<Object, Object>> it = userProperties.entrySet().iterator();
+            while (it.hasNext()) {
+                Entry<Object, Object> next = it.next();
+                if (!RESERVED_KEY_SET_RMQ.contains(next.getKey().toString())) {
+                    org.apache.rocketmq.common.message.MessageAccessor.putProperty(msgRMQ, next.getKey().toString(),
+                            next.getValue().toString());
+                }
+            }
+        }
+
+        return msgRMQ;
+    }
+
+    public static Message msgConvert(org.apache.rocketmq.common.message.Message msgRMQ) {
+        Message message = new Message();
+        if (msgRMQ.getTopic() != null) {
+            message.setTopic(msgRMQ.getTopic());
+        }
+        if (msgRMQ.getKeys() != null) {
+            message.setKey(msgRMQ.getKeys());
+        }
+        if (msgRMQ.getTags() != null) {
+            message.setTag(msgRMQ.getTags());
+        }
+        if (msgRMQ.getBody() != null) {
+            message.setBody(msgRMQ.getBody());
+        }
+
+        message.setReconsumeTimes(((MessageExt) msgRMQ).getReconsumeTimes());
+        message.setBornTimestamp(((MessageExt) msgRMQ).getBornTimestamp());
+        message.setBornHost(String.valueOf(((MessageExt) msgRMQ).getBornHost()));
+
+        Map<String, String> properties = msgRMQ.getProperties();
+        if (properties != null) {
+            Iterator<Entry<String, String>> it = properties.entrySet().iterator();
+            while (it.hasNext()) {
+                Entry<String, String> next = it.next();
+                // System
+                if (RESERVED_KEY_SET_RMQ.contains(next.getKey()) || RESERVED_KEY_SET_ONS.contains(next.getKey())) {
+                    MessageAccessor.putSystemProperties(message, next.getKey(), next.getValue());
+                }
+                // User
+                else {
+                    message.putUserProperties(next.getKey(), next.getValue());
+                }
+            }
+        }
+
+        return message;
+    }
+
+    public static Properties extractProperties(final Properties properties) {
+        Properties newPro = new Properties();
+        Properties inner = null;
+        try {
+            Field field = Properties.class.getDeclaredField("defaults");
+            field.setAccessible(true);
+            inner = (Properties) field.get(properties);
+        } catch (Exception ignore) {
+        }
+
+        if (inner != null) {
+            for (final Entry<Object, Object> entry : inner.entrySet()) {
+                newPro.setProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
+            }
+        }
+
+        for (final Entry<Object, Object> entry : properties.entrySet()) {
+            newPro.setProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
+        }
+
+        return newPro;
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OnsClientRPCHook.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OnsClientRPCHook.java
new file mode 100644
index 0000000..a145c25
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OnsClientRPCHook.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+import org.apache.rocketmq.ons.api.impl.MQClientInfo;
+import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+
+public class OnsClientRPCHook extends ClientRPCHook {
+
+    public OnsClientRPCHook(SessionCredentials sessionCredentials) {
+        super(sessionCredentials);
+    }
+
+    @Override
+    public void doBeforeRequest(String remoteAddr, RemotingCommand request) {
+        super.doBeforeRequest(remoteAddr, request);
+        request.setVersion(MQClientInfo.versionCode);
+    }
+
+
+    @Override
+    public void doAfterResponse(String remoteAddr, RemotingCommand request, RemotingCommand response) {
+        super.doAfterResponse(remoteAddr, request, response);
+    }
+
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
new file mode 100644
index 0000000..4004f3e
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyContext;
+import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyStatus;
+import org.apache.rocketmq.client.consumer.listener.MessageListenerOrderly;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.common.message.MessageExt;
+
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.MessageSelector;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.order.ConsumeOrderContext;
+import org.apache.rocketmq.ons.api.order.MessageOrderListener;
+import org.apache.rocketmq.ons.api.order.OrderAction;
+import org.apache.rocketmq.ons.api.order.OrderConsumer;
+
+public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsumer {
+    private final ConcurrentHashMap<String, MessageOrderListener> subscribeTable = new ConcurrentHashMap<String, MessageOrderListener>();
+
+    public OrderConsumerImpl(final Properties properties) {
+        super(properties);
+        String suspendTimeMillis = properties.getProperty(PropertyKeyConst.SuspendTimeMillis);
+        if (!UtilAll.isBlank(suspendTimeMillis)) {
+            try {
+                this.defaultMQPushConsumer.setSuspendCurrentQueueTimeMillis(Long.parseLong(suspendTimeMillis));
+            } catch (NumberFormatException ignored) {
+            }
+        }
+    }
+
+    @Override
+    public void start() {
+        this.defaultMQPushConsumer.registerMessageListener(new MessageListenerOrderlyImpl());
+        super.start();
+    }
+
+    @Override
+    public void subscribe(String topic, String subExpression, MessageOrderListener listener) {
+        if (null == topic) {
+            throw new ONSClientException("topic is null");
+        }
+
+        if (null == listener) {
+            throw new ONSClientException("listener is null");
+        }
+        this.subscribeTable.put(topic, listener);
+        super.subscribe(topic, subExpression);
+    }
+
+    @Override
+    public void subscribe(final String topic, final MessageSelector selector, final MessageOrderListener listener) {
+        if (null == topic) {
+            throw new ONSClientException("topic is null");
+        }
+
+        if (null == listener) {
+            throw new ONSClientException("listener is null");
+        }
+        this.subscribeTable.put(topic, listener);
+        super.subscribe(topic, selector);
+    }
+
+    class MessageListenerOrderlyImpl implements MessageListenerOrderly {
+
+        @Override
+        public ConsumeOrderlyStatus consumeMessage(List<MessageExt> arg0, ConsumeOrderlyContext arg1) {
+            MessageExt msgRMQ = arg0.get(0);
+            Message msg = ONSUtil.msgConvert(msgRMQ);
+            msg.setMsgID(msgRMQ.getMsgId());
+
+            MessageOrderListener listener = OrderConsumerImpl.this.subscribeTable.get(msg.getTopic());
+            if (null == listener) {
+                throw new ONSClientException("MessageOrderListener is null");
+            }
+
+            final ConsumeOrderContext context = new ConsumeOrderContext();
+            OrderAction action = listener.consume(msg, context);
+            if (action != null) {
+                switch (action) {
+                    case Success:
+                        return ConsumeOrderlyStatus.SUCCESS;
+                    case Suspend:
+                        return ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT;
+                    default:
+                        break;
+                }
+            }
+
+            return ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT;
+        }
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
new file mode 100644
index 0000000..218a8c2
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.common.message.MessageQueue;
+import org.apache.rocketmq.logging.InternalLogger;
+
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
+import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
+import org.apache.rocketmq.ons.api.order.OrderProducer;
+import org.apache.commons.lang3.StringUtils;
+
+public class OrderProducerImpl extends ONSClientAbstract implements OrderProducer {
+    private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
+    private final DefaultMQProducer defaultMQProducer;
+
+    public OrderProducerImpl(final Properties properties) {
+        super(properties);
+        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ProducerId));
+        if (StringUtils.isEmpty(producerGroup)) {
+            producerGroup = "__ONS_PRODUCER_DEFAULT_GROUP";
+        }
+
+        this.defaultMQProducer =
+            new DefaultMQProducer(this.getNamespace(), producerGroup, new OnsClientRPCHook(sessionCredentials));
+
+
+        this.defaultMQProducer.setProducerGroup(producerGroup);
+
+        boolean isVipChannelEnabled = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.isVipChannelEnabled, "false"));
+        this.defaultMQProducer.setVipChannelEnabled(isVipChannelEnabled);
+
+        String sendMsgTimeoutMillis = properties.getProperty(PropertyKeyConst.SendMsgTimeoutMillis, "3000");
+        this.defaultMQProducer.setSendMsgTimeout(Integer.parseInt(sendMsgTimeoutMillis));
+
+//        boolean addExtendUniqInfo = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.EXACTLYONCE_DELIVERY, "false"));
+//        this.defaultMQProducer.setAddExtendUniqInfo(addExtendUniqInfo);
+
+        String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
+        this.defaultMQProducer.setInstanceName(instanceName);
+        this.defaultMQProducer.setNamesrvAddr(this.getNameServerAddr());
+        String msgTraceSwitch = properties.getProperty(PropertyKeyConst.MsgTraceSwitch);
+        if (!UtilAll.isBlank(msgTraceSwitch) && (!Boolean.parseBoolean(msgTraceSwitch))) {
+            LOGGER.info("MQ Client Disable the Trace Hook!");
+        } else {
+            try {
+                Properties tempProperties = new Properties();
+                tempProperties.put(OnsTraceConstants.AccessKey, sessionCredentials.getAccessKey());
+                tempProperties.put(OnsTraceConstants.SecretKey, sessionCredentials.getSecretKey());
+                tempProperties.put(OnsTraceConstants.MaxMsgSize, "128000");
+                tempProperties.put(OnsTraceConstants.AsyncBufferSize, "2048");
+                tempProperties.put(OnsTraceConstants.MaxBatchNum, "100");
+                tempProperties.put(OnsTraceConstants.NAMESRV_ADDR, this.getNameServerAddr());
+                tempProperties.put(OnsTraceConstants.InstanceName, "PID_CLIENT_INNER_TRACE_PRODUCER");
+                tempProperties.put(OnsTraceConstants.TraceDispatcherType, OnsTraceDispatcherType.PRODUCER.name());
+                AsyncArrayDispatcher dispatcher = new AsyncArrayDispatcher(tempProperties, sessionCredentials);
+                dispatcher.setHostProducer(defaultMQProducer.getDefaultMQProducerImpl());
+                traceDispatcher = dispatcher;
+                this.defaultMQProducer.getDefaultMQProducerImpl().registerSendMessageHook(
+                    new OnsClientSendMessageHookImpl(traceDispatcher));
+            } catch (Throwable e) {
+                LOGGER.error("system mqtrace hook init failed ,maybe can't send msg trace data", e);
+            }
+        }
+    }
+
+    @Override
+    protected void updateNameServerAddr(String newAddrs) {
+        this.defaultMQProducer.getDefaultMQProducerImpl().getmQClientFactory().getMQClientAPIImpl().updateNameServerAddressList(newAddrs);
+    }
+
+    @Override
+    public void start() {
+        try {
+            if (started.compareAndSet(false, true)) {
+                this.defaultMQProducer.start();
+                super.start();
+            }
+        } catch (Exception e) {
+            throw new ONSClientException(e.getMessage());
+        }
+    }
+
+    @Override
+    public void shutdown() {
+        if (started.compareAndSet(true, false)) {
+            this.defaultMQProducer.shutdown();
+        }
+        super.shutdown();
+    }
+
+    @Override
+    public SendResult send(final Message message, final String shardingKey) {
+        if (UtilAll.isBlank(shardingKey)) {
+            throw new ONSClientException("\'shardingKey\' is blank.");
+        }
+        message.setShardingKey(shardingKey);
+        this.checkONSProducerServiceState(this.defaultMQProducer.getDefaultMQProducerImpl());
+        final org.apache.rocketmq.common.message.Message msgRMQ = ONSUtil.msgConvert(message);
+        try {
+            org.apache.rocketmq.client.producer.SendResult sendResultRMQ =
+                this.defaultMQProducer.send(msgRMQ, new org.apache.rocketmq.client.producer.MessageQueueSelector() {
+                    @Override
+                    public MessageQueue select(List<MessageQueue> mqs, org.apache.rocketmq.common.message.Message msg,
+                        Object shardingKey) {
+                        int select = Math.abs(shardingKey.hashCode());
+                        if (select < 0) {
+                            select = 0;
+                        }
+                        return mqs.get(select % mqs.size());
+                    }
+                }, shardingKey);
+            message.setMsgID(sendResultRMQ.getMsgId());
+            SendResult sendResult = new SendResult();
+            sendResult.setTopic(message.getTopic());
+            sendResult.setMessageId(sendResultRMQ.getMsgId());
+            return sendResult;
+        } catch (Exception e) {
+            throw new ONSClientException("defaultMQProducer send order exception", e);
+        }
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
new file mode 100644
index 0000000..bd1dede
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.rocketmq.client.exception.MQBrokerException;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.common.message.MessageClientIDSetter;
+import org.apache.rocketmq.common.protocol.ResponseCode;
+import org.apache.rocketmq.logging.InternalLogger;
+import org.apache.rocketmq.remoting.exception.RemotingConnectException;
+import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
+
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.OnExceptionContext;
+import org.apache.rocketmq.ons.api.Producer;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendCallback;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
+import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
+import org.apache.commons.lang3.StringUtils;
+
+public class ProducerImpl extends ONSClientAbstract implements Producer {
+    private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
+    private final DefaultMQProducer defaultMQProducer;
+
+    public ProducerImpl(final Properties properties) {
+        super(properties);
+
+        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ProducerId));
+        if (StringUtils.isEmpty(producerGroup)) {
+            producerGroup = "__ONS_PRODUCER_DEFAULT_GROUP";
+        }
+
+        this.defaultMQProducer =
+            new DefaultMQProducer(this.getNamespace(), producerGroup, new OnsClientRPCHook(sessionCredentials));
+
+        this.defaultMQProducer.setProducerGroup(producerGroup);
+
+        boolean isVipChannelEnabled = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.isVipChannelEnabled, "false"));
+        this.defaultMQProducer.setVipChannelEnabled(isVipChannelEnabled);
+
+        if (properties.containsKey(PropertyKeyConst.SendMsgTimeoutMillis)) {
+            this.defaultMQProducer.setSendMsgTimeout(Integer.valueOf(properties.get(PropertyKeyConst.SendMsgTimeoutMillis).toString()));
+        } else {
+            this.defaultMQProducer.setSendMsgTimeout(5000);
+        }
+
+//        if (properties.containsKey(PropertyKeyConst.EXACTLYONCE_DELIVERY)) {
+//            this.defaultMQProducer.setAddExtendUniqInfo(Boolean.valueOf(properties.get(PropertyKeyConst.EXACTLYONCE_DELIVERY).toString()));
+//        }
+
+        String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
+        this.defaultMQProducer.setInstanceName(instanceName);
+        this.defaultMQProducer.setNamesrvAddr(this.getNameServerAddr());
+        this.defaultMQProducer.setMaxMessageSize(1024 * 1024 * 4);
+        String msgTraceSwitch = properties.getProperty(PropertyKeyConst.MsgTraceSwitch);
+        if (!UtilAll.isBlank(msgTraceSwitch) && (!Boolean.parseBoolean(msgTraceSwitch))) {
+            LOGGER.info("MQ Client Disable the Trace Hook!");
+        } else {
+            try {
+                Properties tempProperties = new Properties();
+                tempProperties.put(OnsTraceConstants.AccessKey, sessionCredentials.getAccessKey());
+                tempProperties.put(OnsTraceConstants.SecretKey, sessionCredentials.getSecretKey());
+                tempProperties.put(OnsTraceConstants.MaxMsgSize, "128000");
+                tempProperties.put(OnsTraceConstants.AsyncBufferSize, "2048");
+                tempProperties.put(OnsTraceConstants.MaxBatchNum, "100");
+                tempProperties.put(OnsTraceConstants.NAMESRV_ADDR, this.getNameServerAddr());
+                tempProperties.put(OnsTraceConstants.InstanceName, "PID_CLIENT_INNER_TRACE_PRODUCER");
+                tempProperties.put(OnsTraceConstants.TraceDispatcherType, OnsTraceDispatcherType.PRODUCER.name());
+                AsyncArrayDispatcher dispatcher = new AsyncArrayDispatcher(tempProperties, sessionCredentials);
+                dispatcher.setHostProducer(defaultMQProducer.getDefaultMQProducerImpl());
+                traceDispatcher = dispatcher;
+                this.defaultMQProducer.getDefaultMQProducerImpl().registerSendMessageHook(
+                    new OnsClientSendMessageHookImpl(traceDispatcher));
+            } catch (Throwable e) {
+                LOGGER.error("system mqtrace hook init failed ,maybe can't send msg trace data.", e);
+            }
+        }
+    }
+
+    @Override
+    protected void updateNameServerAddr(String newAddrs) {
+        this.defaultMQProducer.getDefaultMQProducerImpl().getmQClientFactory().getMQClientAPIImpl().updateNameServerAddressList(newAddrs);
+    }
+
+    @Override
+    public void start() {
+        try {
+            if (this.started.compareAndSet(false, true)) {
+                this.defaultMQProducer.start();
+                super.start();
+            }
+        } catch (Exception e) {
+            throw new ONSClientException(e.getMessage());
+        }
+    }
+
+    @Override
+    public void shutdown() {
+        if (this.started.compareAndSet(true, false)) {
+            this.defaultMQProducer.shutdown();
+        }
+        super.shutdown();
+    }
+
+    @Override
+    public SendResult send(Message message) {
+        this.checkONSProducerServiceState(this.defaultMQProducer.getDefaultMQProducerImpl());
+        org.apache.rocketmq.common.message.Message msgRMQ = ONSUtil.msgConvert(message);
+
+        try {
+            org.apache.rocketmq.client.producer.SendResult sendResultRMQ = this.defaultMQProducer.send(msgRMQ);
+
+            message.setMsgID(sendResultRMQ.getMsgId());
+            SendResult sendResult = new SendResult();
+            sendResult.setTopic(sendResultRMQ.getMessageQueue().getTopic());
+            sendResult.setMessageId(sendResultRMQ.getMsgId());
+            return sendResult;
+        } catch (Exception e) {
+            LOGGER.error(String.format("Send message Exception, %s", message), e);
+            throw checkProducerException(message.getTopic(), message.getMsgID(), e);
+        }
+    }
+
+    @Override
+    public void sendOneway(Message message) {
+        this.checkONSProducerServiceState(this.defaultMQProducer.getDefaultMQProducerImpl());
+        org.apache.rocketmq.common.message.Message msgRMQ = ONSUtil.msgConvert(message);
+        try {
+            this.defaultMQProducer.sendOneway(msgRMQ);
+            message.setMsgID(MessageClientIDSetter.getUniqID(msgRMQ));
+        } catch (Exception e) {
+            LOGGER.error(String.format("Send message oneway Exception, %s", message), e);
+            throw checkProducerException(message.getTopic(), message.getMsgID(), e);
+        }
+    }
+
+    @Override
+    public void sendAsync(Message message, SendCallback sendCallback) {
+        this.checkONSProducerServiceState(this.defaultMQProducer.getDefaultMQProducerImpl());
+        org.apache.rocketmq.common.message.Message msgRMQ = ONSUtil.msgConvert(message);
+        try {
+            this.defaultMQProducer.send(msgRMQ, sendCallbackConvert(message, sendCallback));
+            message.setMsgID(MessageClientIDSetter.getUniqID(msgRMQ));
+        } catch (Exception e) {
+            LOGGER.error(String.format("Send message async Exception, %s", message), e);
+            throw checkProducerException(message.getTopic(), message.getMsgID(), e);
+        }
+    }
+
+    @Override
+    public void setCallbackExecutor(final ExecutorService callbackExecutor) {
+        this.defaultMQProducer.setCallbackExecutor(callbackExecutor);
+    }
+
+    public DefaultMQProducer getDefaultMQProducer() {
+        return defaultMQProducer;
+    }
+
+    private org.apache.rocketmq.client.producer.SendCallback sendCallbackConvert(final Message message,
+        final SendCallback sendCallback) {
+        org.apache.rocketmq.client.producer.SendCallback rmqSendCallback = new org.apache.rocketmq.client.producer.SendCallback() {
+            @Override
+            public void onSuccess(org.apache.rocketmq.client.producer.SendResult sendResult) {
+                sendCallback.onSuccess(sendResultConvert(sendResult));
+            }
+
+            @Override
+            public void onException(Throwable e) {
+                String topic = new String(message.getTopic());
+                String msgId = new String(message.getMsgID());
+                ONSClientException onsEx = checkProducerException(topic, msgId, e);
+                OnExceptionContext context = new OnExceptionContext();
+                context.setTopic(topic);
+                context.setMessageId(msgId);
+                context.setException(onsEx);
+                sendCallback.onException(context);
+            }
+        };
+        return rmqSendCallback;
+    }
+
+    private SendResult sendResultConvert(
+        final org.apache.rocketmq.client.producer.SendResult rmqSendResult) {
+        SendResult sendResult = new SendResult();
+        sendResult.setTopic(rmqSendResult.getMessageQueue().getTopic());
+        sendResult.setMessageId(rmqSendResult.getMsgId());
+        return sendResult;
+    }
+
+    private ONSClientException checkProducerException(String topic, String msgId, Throwable e) {
+        if (e instanceof MQClientException) {
+            if (e.getCause() != null) {
+                if (e.getCause() instanceof RemotingConnectException) {
+                    return new ONSClientException(
+                        FAQ.errorMessage(String.format("Connect broker failed, Topic=%s, msgId=%s", topic, msgId), FAQ.CONNECT_BROKER_FAILED));
+                } else if (e.getCause() instanceof RemotingTimeoutException) {
+                    return new ONSClientException(FAQ.errorMessage(String.format("Send message to broker timeout, %dms, Topic=%s, msgId=%s",
+                        this.defaultMQProducer.getSendMsgTimeout(), topic, msgId), FAQ.SEND_MSG_TO_BROKER_TIMEOUT));
+                } else if (e.getCause() instanceof MQBrokerException) {
+                    MQBrokerException excep = (MQBrokerException) e.getCause();
+                    return new ONSClientException(FAQ.errorMessage(
+                        String.format("Receive a broker exception, Topi=%s, msgId=%s, %s", topic, msgId, excep.getErrorMessage()),
+                        FAQ.BROKER_RESPONSE_EXCEPTION));
+                }
+            } else {
+                MQClientException excep = (MQClientException) e;
+                if (-1 == excep.getResponseCode()) {
+                    return new ONSClientException(
+                        FAQ.errorMessage(String.format("Topic does not exist, Topic=%s, msgId=%s", topic, msgId), FAQ.TOPIC_ROUTE_NOT_EXIST));
+                } else if (ResponseCode.MESSAGE_ILLEGAL == excep.getResponseCode()) {
+                    return new ONSClientException(
+                        FAQ.errorMessage(String.format("ONS Client check message exception, Topic=%s, msgId=%s", topic, msgId),
+                            FAQ.CLIENT_CHECK_MSG_EXCEPTION));
+                }
+            }
+        }
+
+        return new ONSClientException("defaultMQProducer send exception", e);
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
new file mode 100644
index 0000000..bc03867
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.Properties;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.producer.LocalTransactionState;
+import org.apache.rocketmq.client.producer.TransactionCheckListener;
+import org.apache.rocketmq.client.producer.TransactionMQProducer;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.logging.InternalLogger;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
+import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionExecuter;
+import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
+import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+
+public class TransactionProducerImpl extends ONSClientAbstract implements TransactionProducer {
+    private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
+    TransactionMQProducer transactionMQProducer = null;
+    private Properties properties;
+
+    public TransactionProducerImpl(Properties properties, TransactionCheckListener transactionCheckListener) {
+        super(properties);
+        this.properties = properties;
+        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ProducerId));
+        if (StringUtils.isEmpty(producerGroup)) {
+            producerGroup = "__ONS_PRODUCER_DEFAULT_GROUP";
+        }
+        transactionMQProducer =
+            new TransactionMQProducer(this.getNamespace(), producerGroup, new OnsClientRPCHook(sessionCredentials));
+
+        boolean isVipChannelEnabled = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.isVipChannelEnabled, "false"));
+        transactionMQProducer.setVipChannelEnabled(isVipChannelEnabled);
+
+        String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
+        this.transactionMQProducer.setInstanceName(instanceName);
+
+//        boolean addExtendUniqInfo = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.EXACTLYONCE_DELIVERY, "false"));
+//        transactionMQProducer.setAddExtendUniqInfo(addExtendUniqInfo);
+
+        transactionMQProducer.setTransactionCheckListener(transactionCheckListener);
+        String msgTraceSwitch = properties.getProperty(PropertyKeyConst.MsgTraceSwitch);
+        if (!UtilAll.isBlank(msgTraceSwitch) && (!Boolean.parseBoolean(msgTraceSwitch))) {
+            LOGGER.info("MQ Client Disable the Trace Hook!");
+        } else {
+            try {
+                Properties tempProperties = new Properties();
+                tempProperties.put(OnsTraceConstants.AccessKey, sessionCredentials.getAccessKey());
+                tempProperties.put(OnsTraceConstants.SecretKey, sessionCredentials.getSecretKey());
+                tempProperties.put(OnsTraceConstants.MaxMsgSize, "128000");
+                tempProperties.put(OnsTraceConstants.AsyncBufferSize, "2048");
+                tempProperties.put(OnsTraceConstants.MaxBatchNum, "100");
+                tempProperties.put(OnsTraceConstants.NAMESRV_ADDR, this.getNameServerAddr());
+                tempProperties.put(OnsTraceConstants.InstanceName, "PID_CLIENT_INNER_TRACE_PRODUCER");
+                tempProperties.put(OnsTraceConstants.TraceDispatcherType, OnsTraceDispatcherType.PRODUCER.name());
+                AsyncArrayDispatcher dispatcher = new AsyncArrayDispatcher(tempProperties, sessionCredentials);
+                dispatcher.setHostProducer(transactionMQProducer.getDefaultMQProducerImpl());
+                traceDispatcher = dispatcher;
+                this.transactionMQProducer.getDefaultMQProducerImpl().registerSendMessageHook(
+                    new OnsClientSendMessageHookImpl(traceDispatcher));
+            } catch (Throwable e) {
+                LOGGER.error("system mqtrace hook init failed ,maybe can't send msg trace data", e);
+            }
+        }
+    }
+
+    @Override
+    public void start() {
+        if (started.compareAndSet(false, true)) {
+            if (transactionMQProducer.getTransactionCheckListener() == null) {
+                throw new IllegalArgumentException("TransactionCheckListener is null");
+            }
+            transactionMQProducer.setNamesrvAddr(this.nameServerAddr);
+            try {
+                transactionMQProducer.start();
+                super.start();
+            } catch (MQClientException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    @Override
+    protected void updateNameServerAddr(String newAddrs) {
+        this.transactionMQProducer.getDefaultMQProducerImpl().getmQClientFactory().getMQClientAPIImpl().updateNameServerAddressList(newAddrs);
+    }
+
+    @Override
+    public void shutdown() {
+        if (started.compareAndSet(true, false)) {
+            transactionMQProducer.shutdown();
+        }
+        super.shutdown();
+    }
+
+    @Override
+    public SendResult send(final Message message, final LocalTransactionExecuter executer, Object arg) {
+        this.checkONSProducerServiceState(this.transactionMQProducer.getDefaultMQProducerImpl());
+        org.apache.rocketmq.common.message.Message msgRMQ = ONSUtil.msgConvert(message);
+        org.apache.rocketmq.client.producer.TransactionSendResult sendResultRMQ = null;
+        try {
+            sendResultRMQ = transactionMQProducer.sendMessageInTransaction(msgRMQ,
+                new org.apache.rocketmq.client.producer.LocalTransactionExecuter() {
+                    @Override
+                    public LocalTransactionState executeLocalTransactionBranch(
+                        org.apache.rocketmq.common.message.Message msg,
+                        Object arg) {
+                        String msgId = msg.getProperty(Constants.TRANSACTION_ID);
+                        message.setMsgID(msgId);
+                        TransactionStatus transactionStatus = executer.execute(message, arg);
+                        if (TransactionStatus.CommitTransaction == transactionStatus) {
+                            return LocalTransactionState.COMMIT_MESSAGE;
+                        } else if (TransactionStatus.RollbackTransaction == transactionStatus) {
+                            return LocalTransactionState.ROLLBACK_MESSAGE;
+                        }
+                        return LocalTransactionState.UNKNOW;
+                    }
+                }, arg);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        if (sendResultRMQ.getLocalTransactionState() == LocalTransactionState.ROLLBACK_MESSAGE) {
+            throw new RuntimeException("local transaction branch failed ,so transaction rollback");
+        }
+        SendResult sendResult = new SendResult();
+        sendResult.setMessageId(sendResultRMQ.getMsgId());
+        sendResult.setTopic(sendResultRMQ.getMessageQueue().getTopic());
+        return sendResult;
+    }
+
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsClientSendMessageHookImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsClientSendMessageHookImpl.java
new file mode 100644
index 0000000..c6fbe10
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsClientSendMessageHookImpl.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.impl.tracehook;
+
+import java.util.ArrayList;
+
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceBean;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceContext;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
+import org.apache.rocketmq.client.hook.SendMessageContext;
+import org.apache.rocketmq.client.hook.SendMessageHook;
+import org.apache.rocketmq.client.producer.SendStatus;
+import org.apache.rocketmq.common.MixAll;
+import org.apache.rocketmq.common.protocol.NamespaceUtil;
+
+public class OnsClientSendMessageHookImpl implements SendMessageHook {
+
+    private AsyncDispatcher localDispatcher;
+
+    public OnsClientSendMessageHookImpl(AsyncDispatcher localDispatcher) {
+        this.localDispatcher = localDispatcher;
+    }
+
+    @Override
+    public String hookName() {
+        return "OnsClientSendMessageHook";
+    }
+
+    @Override
+    public void sendMessageBefore(SendMessageContext context) {
+
+        if (context == null || context.getMessage().getTopic().startsWith(MixAll.SYSTEM_TOPIC_PREFIX)) {
+            return;
+        }
+        OnsTraceContext onsContext = new OnsTraceContext();
+        onsContext.setTraceBeans(new ArrayList<OnsTraceBean>(1));
+        context.setMqTraceContext(onsContext);
+        onsContext.setTraceType(OnsTraceType.Pub);
+        String userGroup = NamespaceUtil.withoutNamespace(context.getProducerGroup(), context.getNamespace());
+        onsContext.setGroupName(userGroup);
+        OnsTraceBean traceBean = new OnsTraceBean();
+        String userTopic = NamespaceUtil.withoutNamespace(context.getMessage().getTopic(), context.getNamespace());
+        traceBean.setTopic(userTopic);
+        traceBean.setTags(context.getMessage().getTags());
+        traceBean.setKeys(context.getMessage().getKeys());
+        traceBean.setStoreHost(context.getBrokerAddr());
+        traceBean.setBodyLength(context.getMessage().getBody().length);
+        traceBean.setMsgType(context.getMsgType());
+        onsContext.getTraceBeans().add(traceBean);
+    }
+
+    @Override
+    public void sendMessageAfter(SendMessageContext context) {
+
+        if (context == null || context.getMessage().getTopic().startsWith(OnsTraceConstants.traceTopic) || context.getMqTraceContext() == null) {
+            return;
+        }
+        if (context.getSendResult() == null) {
+            return;
+        }
+        if (context.getSendResult().getRegionId() == null
+            || context.getSendResult().getRegionId().equals(OnsTraceConstants.default_region)
+            || !context.getSendResult().isTraceOn()) {
+            // if regionId is default or switch is false,skip it
+            return;
+        }
+        OnsTraceContext onsContext = (OnsTraceContext) context.getMqTraceContext();
+        OnsTraceBean traceBean = onsContext.getTraceBeans().get(0);
+        int costTime = (int) ((System.currentTimeMillis() - onsContext.getTimeStamp()) / onsContext.getTraceBeans().size());
+        onsContext.setCostTime(costTime);
+        if (context.getSendResult().getSendStatus().equals(SendStatus.SEND_OK)) {
+            onsContext.setSuccess(true);
+        } else {
+            onsContext.setSuccess(false);
+        }
+        onsContext.setRegionId(context.getSendResult().getRegionId());
+        traceBean.setMsgId(context.getSendResult().getMsgId());
+        traceBean.setOffsetMsgId(context.getSendResult().getOffsetMsgId());
+        traceBean.setStoreTime(onsContext.getTimeStamp() + costTime / 2);
+        localDispatcher.append(onsContext);
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsConsumeMessageHookImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsConsumeMessageHookImpl.java
new file mode 100644
index 0000000..d5a0782
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsConsumeMessageHookImpl.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.tracehook;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.rocketmq.client.consumer.listener.ConsumeReturnType;
+import org.apache.rocketmq.client.hook.ConsumeMessageContext;
+import org.apache.rocketmq.client.hook.ConsumeMessageHook;
+import org.apache.rocketmq.common.MixAll;
+import org.apache.rocketmq.common.message.MessageConst;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.common.protocol.NamespaceUtil;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceBean;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceContext;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
+
+public class OnsConsumeMessageHookImpl implements ConsumeMessageHook {
+
+    private AsyncDispatcher localDispatcher;
+
+    public OnsConsumeMessageHookImpl(AsyncDispatcher localDispatcher) {
+        this.localDispatcher = localDispatcher;
+    }
+
+    @Override
+    public String hookName() {
+        return "OnsConsumeMessageHook";
+    }
+
+    @Override
+    public void consumeMessageBefore(ConsumeMessageContext context) {
+        if (context == null || context.getMsgList() == null || context.getMsgList().isEmpty()) {
+            return;
+        }
+        OnsTraceContext onsTraceContext = new OnsTraceContext();
+        context.setMqTraceContext(onsTraceContext);
+        onsTraceContext.setTraceType(OnsTraceType.SubBefore);
+        String userGroup = NamespaceUtil.withoutNamespace(context.getConsumerGroup(), context.getNamespace());
+        onsTraceContext.setGroupName(userGroup);
+        List<OnsTraceBean> beans = new ArrayList<OnsTraceBean>();
+        for (MessageExt msg : context.getMsgList()) {
+            if (msg == null) {
+                continue;
+            }
+            String regionId = msg.getProperty(MessageConst.PROPERTY_MSG_REGION);
+            String traceOn = msg.getProperty(MessageConst.PROPERTY_TRACE_SWITCH);
+            if (regionId == null || regionId.equals(OnsTraceConstants.default_region)) {
+                // if regionId is default ,skip it
+                continue;
+            }
+            if (traceOn != null && "false".equals(traceOn)) {
+                // if trace switch is false ,skip it
+                continue;
+            }
+            OnsTraceBean traceBean = new OnsTraceBean();
+
+            String userTopic = NamespaceUtil.withoutNamespace(msg.getTopic(), context.getNamespace());
+            traceBean.setTopic(userTopic);
+            traceBean.setMsgId(msg.getMsgId());
+            traceBean.setTags(msg.getTags());
+            traceBean.setKeys(msg.getKeys());
+            traceBean.setStoreTime(msg.getStoreTimestamp());
+            traceBean.setBodyLength(msg.getStoreSize());
+            traceBean.setRetryTimes(msg.getReconsumeTimes());
+            onsTraceContext.setRegionId(regionId);
+            beans.add(traceBean);
+        }
+        if (beans.size() > 0) {
+            onsTraceContext.setTraceBeans(beans);
+            onsTraceContext.setTimeStamp(System.currentTimeMillis());
+            localDispatcher.append(onsTraceContext);
+        }
+    }
+
+    @Override
+    public void consumeMessageAfter(ConsumeMessageContext context) {
+        if (context == null || context.getMsgList() == null || context.getMsgList().isEmpty()) {
+            return;
+        }
+        OnsTraceContext subBeforeContext = (OnsTraceContext) context.getMqTraceContext();
+        if (subBeforeContext.getRegionId().equals(OnsTraceConstants.default_region)) {
+            // if regionId is default ,skip it
+            return;
+        }
+        if (subBeforeContext.getTraceBeans() == null || subBeforeContext.getTraceBeans().size() < 1) {
+            // if subbefore bean is null ,skip it
+            return;
+        }
+        OnsTraceContext subAfterContext = new OnsTraceContext();
+        subAfterContext.setTraceType(OnsTraceType.SubAfter);
+        subAfterContext.setRegionId(subBeforeContext.getRegionId());
+        subAfterContext.setGroupName(subBeforeContext.getGroupName());
+        subAfterContext.setRequestId(subBeforeContext.getRequestId());
+        subAfterContext.setSuccess(context.isSuccess());
+
+        int costTime = (int) ((System.currentTimeMillis() - subBeforeContext.getTimeStamp()) / context.getMsgList().size());
+        subAfterContext.setCostTime(costTime);//
+        subAfterContext.setTraceBeans(subBeforeContext.getTraceBeans());
+        String contextType = context.getProps().get(MixAll.CONSUME_CONTEXT_TYPE);
+        if (contextType != null) {
+            subAfterContext.setContextCode(ConsumeReturnType.valueOf(contextType).ordinal());
+        }
+        localDispatcher.append(subAfterContext);
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/ClientLoggerUtil.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/ClientLoggerUtil.java
new file mode 100644
index 0000000..a7e8391
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/ClientLoggerUtil.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.impl.util;
+
+import java.util.Arrays;
+
+import org.apache.rocketmq.client.log.ClientLogger;
+import org.apache.rocketmq.logging.InternalLogger;
+
+public class ClientLoggerUtil {
+    private static final String CLIENT_LOG_ROOT = "ons.client.logRoot";
+    private static final String CLIENT_LOG_FILEMAXINDEX = "ons.client.logFileMaxIndex";
+    private static final int CLIENT_LOG_FILE_MAX_INDEX = 100;
+    private static final String CLIENT_LOG_LEVEL = "ons.client.logLevel";
+    private static final String[] LEVEL_ARRAY = {"ERROR", "WARN", "INFO", "DEBUG"};
+    private static final long CLIENT_LOG_FILESIZE = 64 * 1024 * 1024L;
+
+    public static InternalLogger getClientLogger() {
+        //Make sure
+        String onsClientLogRoot = System.getProperty(CLIENT_LOG_ROOT, System.getProperty("user.home") + "/logs");
+        System.setProperty(ClientLogger.CLIENT_LOG_ROOT, onsClientLogRoot);
+        String onsClientLogLevel = System.getProperty(CLIENT_LOG_LEVEL, "INFO").trim().toUpperCase();
+        if (!Arrays.asList(LEVEL_ARRAY).contains(onsClientLogLevel)) {
+            onsClientLogLevel = "INFO";
+        }
+        System.setProperty(ClientLogger.CLIENT_LOG_LEVEL, onsClientLogLevel);
+        String onsClientLogMaxIndex = System.getProperty(CLIENT_LOG_FILEMAXINDEX, "10").trim();
+        try {
+            int maxIndex = Integer.parseInt(onsClientLogMaxIndex);
+            if (maxIndex <= 0 || maxIndex > CLIENT_LOG_FILE_MAX_INDEX) {
+                throw new NumberFormatException();
+            }
+        } catch (NumberFormatException e) {
+            onsClientLogMaxIndex = "10";
+        }
+        System.setProperty(ClientLogger.CLIENT_LOG_MAXINDEX, onsClientLogMaxIndex);
+        System.setProperty(ClientLogger.CLIENT_LOG_FILENAME, "ons.log");
+        System.setProperty(ClientLogger.CLIENT_LOG_FILESIZE, String.valueOf(CLIENT_LOG_FILESIZE));
+        return ClientLogger.getLog();
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/MsgConvertUtil.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/MsgConvertUtil.java
new file mode 100644
index 0000000..19d7792
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/MsgConvertUtil.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+public class MsgConvertUtil {
+
+    public static final byte[] EMPTY_BYTES = new byte[0];
+    public static final String EMPTY_STRING = "";
+
+    public static final String JMS_MSGMODEL = "jmsMsgModel";
+    /**
+     * To adapt this scene: "Notify client try to receive ObjectMessage sent by JMS client"
+     * Set notify out message model, value can be textMessage OR objectMessage
+     */
+    public static final String COMPATIBLE_FIELD_MSGMODEL = "notifyOutMsgModel";
+
+    public static final String MSGMODEL_TEXT = "textMessage";
+    public static final String MSGMODEL_BYTES = "bytesMessage";
+    public static final String MSGMODEL_OBJ = "objectMessage";
+
+    public static final String MSG_TOPIC = "msgTopic";
+    public static final String MSG_TYPE = "msgType";
+
+
+    public static byte[] objectSerialize(Object object) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(object);
+        oos.close();
+        baos.close();
+        return baos.toByteArray();
+    }
+
+    public static Serializable objectDeserialize(byte[] bytes) throws IOException, ClassNotFoundException {
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        ObjectInputStream ois = new ObjectInputStream(bais);
+        ois.close();
+        bais.close();
+        return (Serializable) ois.readObject();
+    }
+
+    public static final byte[] string2Bytes(String s, String charset) {
+        if (null == s) {
+            return EMPTY_BYTES;
+        }
+        byte[] bs = null;
+        try {
+            bs = s.getBytes(charset);
+        } catch (Exception e) {
+            // ignore
+        }
+        return bs;
+    }
+
+    public static final String bytes2String(byte[] bs, String charset) {
+        if (null == bs) {
+            return EMPTY_STRING;
+        }
+        String s = null;
+        try {
+            s = new String(bs, charset);
+        } catch (Exception e) {
+            // ignore
+        }
+        return s;
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/NameAddrUtils.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/NameAddrUtils.java
new file mode 100644
index 0000000..a652d85
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/util/NameAddrUtils.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.util;
+
+import java.util.regex.Pattern;
+
+import org.apache.rocketmq.common.MixAll;
+
+import org.apache.commons.lang3.StringUtils;
+
+public class NameAddrUtils {
+    public static final String INSTANCE_PREFIX = "MQ_INST_";
+    public static final String INSTANCE_REGEX = INSTANCE_PREFIX + "\\w+_\\w+";
+    public static final String ENDPOINT_PREFIX = "http://";
+    public static final Pattern NAMESRV_ENDPOINT_PATTERN = Pattern.compile("^" + ENDPOINT_PREFIX + ".*");
+    public static final Pattern INST_ENDPOINT_PATTERN = Pattern.compile("^" + ENDPOINT_PREFIX + INSTANCE_REGEX + "\\..*");
+
+    public static String getNameAdd() {
+        return System.getProperty(MixAll.NAMESRV_ADDR_PROPERTY, System.getenv(MixAll.NAMESRV_ADDR_ENV));
+    }
+
+    public static boolean validateInstanceEndpoint(String endpoint) {
+        return INST_ENDPOINT_PATTERN.matcher(endpoint).matches();
+    }
+
+    public static String parseInstanceIdFromEndpoint(String endpoint) {
+        if (StringUtils.isEmpty(endpoint)) {
+            return null;
+        }
+        return endpoint.substring(ENDPOINT_PREFIX.length(), endpoint.indexOf('.'));
+    }
+}
diff --git a/ons-core/ons-client/src/main/resources/ons_client_info.properties b/ons-core/ons-client/src/main/resources/ons_client_info.properties
new file mode 100644
index 0000000..0ba07b4
--- /dev/null
+++ b/ons-core/ons-client/src/main/resources/ons_client_info.properties
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+version=${project.version}
diff --git a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
new file mode 100644
index 0000000..e04d890
--- /dev/null
+++ b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import org.apache.rocketmq.ons.api.Consumer;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.Producer;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.order.OrderProducer;
+import org.junit.Rule;
+import org.junit.rules.ExpectedException;
+
+import java.util.Properties;
+
+public class NameServerAutoUpdateTest {
+
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    @org.junit.Test
+    public void testNamesrv_setNsAddr() {
+        Properties prop = buildProps();
+        prop.setProperty(PropertyKeyConst.NAMESRV_ADDR, "xxx-whatever");
+        Consumer consumer = ONSFactory.createConsumer(prop);
+        consumer.start();
+    }
+
+    @org.junit.Test
+    public void testNamesrv_setOnsAddr_invalid() {
+        expectedException.expect(ONSClientException.class);
+        expectedException.expectMessage("onsAddr " + "xxx");
+
+        Properties prop = buildProps();
+        prop.setProperty(PropertyKeyConst.ONSAddr, "xxx");
+        Consumer consumer = ONSFactory.createConsumer(prop);
+        consumer.start();
+    }
+
+    @org.junit.Test
+    public void testNamesrv_setOnsAddr_valid() throws InterruptedException {
+        Properties prop = buildProps();
+        prop.setProperty(PropertyKeyConst.ONSAddr, "http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet");
+        Consumer consumer = ONSFactory.createConsumer(prop);
+        consumer.start();
+    }
+
+    @org.junit.Test
+    public void testNamesrv_notSetOnsAddr_useInternet_default() throws InterruptedException {
+        Properties prop = buildProps();
+        Consumer consumer = ONSFactory.createConsumer(prop);
+        consumer.start();
+    }
+
+    @org.junit.Test
+    public void testNamesrv_notSetOnsAddr_useInternet_default_Producer() throws InterruptedException {
+        Properties prop = buildProps();
+        Producer producer = ONSFactory.createProducer(prop);
+        producer.start();
+    }
+
+    @org.junit.Test
+    public void testNamesrv_notSetOnsAddr_useInternet_default_OrderProcucer() throws InterruptedException {
+        Properties prop = buildProps();
+        OrderProducer producer = ONSFactory.createOrderProducer(prop);
+        producer.start();
+    }
+
+    private static Properties buildProps() {
+        Properties properties = new Properties();
+
+        properties.put(PropertyKeyConst.ConsumerId, "metaq-consumer-01_SELF");
+        // 鉴权用 AccessKey,在阿里云服务器管理控制台创建
+        properties.put(PropertyKeyConst.AccessKey, "XXX");
+        // 鉴权用 SecretKey,在阿里云服务器管理控制台创建
+        properties.put(PropertyKeyConst.SecretKey, "XXX");
+        return properties;
+    }
+
+}
diff --git a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
new file mode 100644
index 0000000..245fddd
--- /dev/null
+++ b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Consumer;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.Producer;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+import org.apache.rocketmq.remoting.netty.NettyRemotingClient;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ONSClientTokenUpdateTest {
+
+    private static final String TOPIC = "STS_TOPIC_TEST_MOLING";
+
+    @Ignore
+    public void testSend() throws InterruptedException {
+
+        List<List<String>> credentials = new ArrayList<List<String>>() {
+            {
+                add(new ArrayList<String>() {
+                    {
+                        add("ak");
+                        add("sk");
+                        add("token");
+                    }
+                });
+
+                add(new ArrayList<String>() {
+                    {
+                        add("ak");
+                        add("sk");
+                        add("token");
+                    }
+                });
+
+            }
+        };
+
+        Producer producer = ONSFactory.createProducer(buildProps(
+            "ak",
+            "sk",
+            "token",
+            ONSChannel.ALIYUN.name()
+        ));
+        producer.start();
+
+        for (int i = 0; i < 100; i++) {
+            List<String> credential = credentials.get(i % credentials.size());
+            producer.updateCredential(buildProps(credential.get(0), credential.get(1), credential.get(2), ONSChannel.ALIYUN.name()));
+            try {
+                Message msg = new Message(TOPIC, "tag", "key" + i, ("content." + i).getBytes());
+                SendResult result = producer.send(msg);
+                System.out.println(i + " use ak " + credential.get(0) + " send " + result.getMessageId());
+            } catch (Exception e) {
+                System.out.println(i + " use ak " + credential.get(0) + " send failed.");
+            }
+        }
+
+        Thread.sleep(10 * 1000L);
+        producer.shutdown();
+    }
+
+    @Test
+    public void test_ConsumerImpl() throws NoSuchFieldException, IllegalAccessException {
+        Consumer consumer = ONSFactory.createConsumer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
+        ONSConsumerAbstract subImpl = (ONSConsumerAbstract) consumer;
+        consumer.start();
+
+        Assert.assertTrue(subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient() instanceof NettyRemotingClient);
+        NettyRemotingClient remotingClient =
+            (NettyRemotingClient) subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient();
+        Assert.assertTrue(remotingClient.getRPCHooks() instanceof ClientRPCHook);
+        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks();
+        Field field = ClientRPCHook.class.getDeclaredField("sessionCredentials");
+        field.setAccessible(true);
+        SessionCredentials credentials = (SessionCredentials) field.get(clientRPCHook);
+
+        Assert.assertEquals("ak", credentials.getAccessKey());
+        Assert.assertEquals("sk", credentials.getSecretKey());
+        Assert.assertEquals("token", credentials.getSecurityToken());
+        Assert.assertEquals(ONSChannel.ALIYUN, credentials.getOnsChannel());
+
+        consumer.updateCredential(buildProps("nak", "nsk", "ntoken", ONSChannel.CLOUD.name()));
+
+        Assert.assertEquals("nak", credentials.getAccessKey());
+        Assert.assertEquals("nsk", credentials.getSecretKey());
+        Assert.assertEquals("ntoken", credentials.getSecurityToken());
+        Assert.assertEquals(ONSChannel.CLOUD, credentials.getOnsChannel());
+    }
+
+    @Test
+    public void test_ProducerImpl() throws NoSuchFieldException, IllegalAccessException {
+        Producer producer = ONSFactory.createProducer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
+        ProducerImpl subImpl = (ProducerImpl) producer;
+        producer.start();
+
+        Assert.assertTrue(subImpl.getDefaultMQProducer().getDefaultMQProducerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient() instanceof NettyRemotingClient);
+        NettyRemotingClient remotingClient =
+            (NettyRemotingClient) subImpl.getDefaultMQProducer().getDefaultMQProducerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient();
+        Assert.assertTrue(remotingClient.getRPCHooks() instanceof ClientRPCHook);
+        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks();
+        Field field = ClientRPCHook.class.getDeclaredField("sessionCredentials");
+        field.setAccessible(true);
+        SessionCredentials credentials = (SessionCredentials) field.get(clientRPCHook);
+
+        Assert.assertEquals("ak", credentials.getAccessKey());
+        Assert.assertEquals("sk", credentials.getSecretKey());
+        Assert.assertEquals("token", credentials.getSecurityToken());
+        Assert.assertEquals(ONSChannel.ALIYUN, credentials.getOnsChannel());
+
+        producer.updateCredential(buildProps("nak", "nsk", "ntoken", ONSChannel.CLOUD.name()));
+
+        Assert.assertEquals("nak", credentials.getAccessKey());
+        Assert.assertEquals("nsk", credentials.getSecretKey());
+        Assert.assertEquals("ntoken", credentials.getSecurityToken());
+        Assert.assertEquals(ONSChannel.CLOUD, credentials.getOnsChannel());
+    }
+
+    @Test
+    public void test_ConsumerImpl_updateNull() throws NoSuchFieldException, IllegalAccessException {
+        Consumer consumer = ONSFactory.createConsumer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
+        ONSConsumerAbstract subImpl = (ONSConsumerAbstract) consumer;
+        consumer.start();
+
+        Assert.assertTrue(subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient() instanceof NettyRemotingClient);
+        NettyRemotingClient remotingClient =
+            (NettyRemotingClient) subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient();
+        Assert.assertTrue(remotingClient.getRPCHooks() instanceof ClientRPCHook);
+        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks();
+        Field field = ClientRPCHook.class.getDeclaredField("sessionCredentials");
+        field.setAccessible(true);
+        SessionCredentials credentials = (SessionCredentials) field.get(clientRPCHook);
+
+        Assert.assertEquals("ak", credentials.getAccessKey());
+        Assert.assertEquals("sk", credentials.getSecretKey());
+        Assert.assertEquals("token", credentials.getSecurityToken());
+        Assert.assertEquals(ONSChannel.ALIYUN, credentials.getOnsChannel());
+
+        try {
+            consumer.updateCredential(buildProps("nak", "", "ntoken", ONSChannel.CLOUD.name()));
+        } catch (Exception e) {
+            Assert.assertTrue(e instanceof ONSClientException);
+        }
+
+        Assert.assertEquals("ak", credentials.getAccessKey());
+        Assert.assertEquals("sk", credentials.getSecretKey());
+        Assert.assertEquals("token", credentials.getSecurityToken());
+        Assert.assertEquals(ONSChannel.ALIYUN, credentials.getOnsChannel());
+    }
+
+    private static Properties buildProps(String ak, String sk, String token, String channel) {
+        Properties properties = new Properties();
+        properties.put(PropertyKeyConst.ConsumerId, "CID_STS_TEST_MOLING");
+        properties.put(PropertyKeyConst.ProducerId, "PID_STS_TEST_MOLING");
+        properties.put(PropertyKeyConst.AccessKey, ak);
+        properties.put(PropertyKeyConst.SecretKey, sk);
+        properties.put(PropertyKeyConst.SecurityToken, token);
+        properties.put(PropertyKeyConst.OnsChannel, channel);
+
+        return properties;
+    }
+
+}
diff --git a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtilTest.java b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtilTest.java
new file mode 100644
index 0000000..b0b0a1f
--- /dev/null
+++ b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtilTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import java.util.Properties;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ONSUtilTest {
+    @org.junit.Test
+    public void extractProperties() throws Exception {
+        Properties properties = new Properties();
+        properties.put("Integer", 123);
+
+        assertThat(properties.get("Integer")).isEqualTo(123);
+        assertThat(properties.getProperty("Integer")).isNull();
+
+        Properties newPro = ONSUtil.extractProperties(properties);
+        assertThat(newPro.getProperty("Integer")).isEqualTo("123");
+        assertThat(newPro.get("Integer")).isEqualTo("123");
+    }
+
+    @org.junit.Test
+    public void extractProperties_WithInner() throws Exception {
+        Properties inner = new Properties();
+        inner.put("Integer", 123);
+
+        Properties properties = new Properties(inner);
+
+        assertThat(properties.get("Integer")).isNull();
+        assertThat(properties.getProperty("Integer")).isNull();
+
+        inner.put("String", "String");
+        assertThat(properties.get("String")).isNull();
+        assertThat(properties.getProperty("String")).isEqualTo("String");
+
+
+        Properties newPro = ONSUtil.extractProperties(properties);
+        assertThat(newPro.getProperty("Integer")).isEqualTo("123");
+        assertThat(newPro.get("Integer")).isEqualTo("123");
+        assertThat(newPro.getProperty("String")).isEqualTo("String");
+        assertThat(newPro.get("String")).isEqualTo("String");
+    }
+}
\ No newline at end of file
diff --git a/ons-core/ons-trace-core/pom.xml b/ons-core/ons-trace-core/pom.xml
new file mode 100644
index 0000000..4ba3f7d
--- /dev/null
+++ b/ons-core/ons-trace-core/pom.xml
@@ -0,0 +1,41 @@
+<!--
+  ~ /*
+  ~  * Licensed to the Apache Software Foundation (ASF) under one or more
+  ~  * contributor license agreements.  See the NOTICE file distributed with
+  ~  * this work for additional information regarding copyright ownership.
+  ~  * The ASF licenses this file to You under the Apache License, Version 2.0
+  ~  * (the "License"); you may not use this file except in compliance with
+  ~  * the License.  You may obtain a copy of the License at
+  ~  *
+  ~  *     http://www.apache.org/licenses/LICENSE-2.0
+  ~  *
+  ~  * Unless required by applicable law or agreed to in writing, software
+  ~  * distributed under the License is distributed on an "AS IS" BASIS,
+  ~  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  * See the License for the specific language governing permissions and
+  ~  * limitations under the License.
+  ~  */
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>ons-all</artifactId>
+        <groupId>org.apache.rocketmq</groupId>
+        <version>1.8.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>ons-trace-core</artifactId>
+    <packaging>jar</packaging>
+    <name>ons-trace-core ${project.version}</name>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ons-auth4client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-client</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceBean.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceBean.java
new file mode 100644
index 0000000..211958e
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceBean.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.common;
+
+import org.apache.rocketmq.ons.open.trace.core.utils.MixUtils;
+import org.apache.rocketmq.common.message.MessageType;
+
+public class OnsTraceBean {
+    private static final String LOCAL_ADDRESS = MixUtils.getLocalAddress();
+    private String topic = "";
+    private String msgId = "";
+    private String offsetMsgId = "";
+    private String tags = "";
+    private String keys = "";
+    private String storeHost = LOCAL_ADDRESS;
+    private String clientHost = LOCAL_ADDRESS;
+    private long storeTime;
+    private int retryTimes;
+    private int bodyLength;
+    private MessageType msgType;
+
+
+    public MessageType getMsgType() {
+        return msgType;
+    }
+
+
+    public void setMsgType(final MessageType msgType) {
+        this.msgType = msgType;
+    }
+
+
+    public String getOffsetMsgId() {
+        return offsetMsgId;
+    }
+
+
+    public void setOffsetMsgId(final String offsetMsgId) {
+        this.offsetMsgId = offsetMsgId;
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+
+
+    public void setTopic(String topic) {
+        this.topic = topic;
+    }
+
+
+    public String getMsgId() {
+        return msgId;
+    }
+
+
+    public void setMsgId(String msgId) {
+        this.msgId = msgId;
+    }
+
+
+    public String getTags() {
+        return tags;
+    }
+
+
+    public void setTags(String tags) {
+        this.tags = tags;
+    }
+
+
+    public String getKeys() {
+        return keys;
+    }
+
+
+    public void setKeys(String keys) {
+        this.keys = keys;
+    }
+
+
+    public String getStoreHost() {
+        return storeHost;
+    }
+
+
+    public void setStoreHost(String storeHost) {
+        this.storeHost = storeHost;
+    }
+
+
+    public String getClientHost() {
+        return clientHost;
+    }
+
+
+    public void setClientHost(String clientHost) {
+        this.clientHost = clientHost;
+    }
+
+
+    public long getStoreTime() {
+        return storeTime;
+    }
+
+
+    public void setStoreTime(long storeTime) {
+        this.storeTime = storeTime;
+    }
+
+
+    public int getRetryTimes() {
+        return retryTimes;
+    }
+
+
+    public void setRetryTimes(int retryTimes) {
+        this.retryTimes = retryTimes;
+    }
+
+
+    public int getBodyLength() {
+        return bodyLength;
+    }
+
+
+    public void setBodyLength(int bodyLength) {
+        this.bodyLength = bodyLength;
+    }
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceConstants.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceConstants.java
new file mode 100644
index 0000000..0877f84
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceConstants.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.common;
+
+import javax.annotation.Generated;
+
+import org.apache.rocketmq.common.MixAll;
+
+@Generated("ons-client")
+public class OnsTraceConstants {
+
+    public static final String NAMESRV_ADDR = "NAMESRV_ADDR";
+
+    public static final String ADDRSRV_URL = "ADDRSRV_URL";
+
+    public static final String AccessKey = "AccessKey";
+
+    public static final String SecretKey = "SecretKey";
+
+    public static final String InstanceName = "InstanceName";
+
+    public static final String AsyncBufferSize = "AsyncBufferSize";
+
+    public static final String MaxBatchNum = "MaxBatchNum";
+
+    public static final String WakeUpNum = "WakeUpNum";
+
+    public static final String MaxMsgSize = "MaxMsgSize";
+
+
+    public static final String groupName = "_INNER_TRACE_PRODUCER";
+
+    public static final String traceTopic = MixAll.SYSTEM_TOPIC_PREFIX + "TRACE_DATA_";
+
+
+    public static final String default_region = MixAll.DEFAULT_TRACE_REGION_ID;
+
+    public static final char CONTENT_SPLITOR = (char)1;
+    public static final char FIELD_SPLITOR = (char)2;
+
+    public static final String TraceDispatcherType = "DispatcherType";
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceContext.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceContext.java
new file mode 100644
index 0000000..f6aa191
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceContext.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.common;
+
+import java.util.List;
+
+import org.apache.rocketmq.common.message.MessageClientIDSetter;
+
+public class OnsTraceContext implements Comparable<OnsTraceContext> {
+
+    private OnsTraceType traceType;
+
+    private long timeStamp = System.currentTimeMillis();
+
+    private String regionId = "";
+    private String regionName = "";
+
+    private String groupName = "";
+
+    private int costTime = 0;
+
+    private boolean isSuccess = true;
+
+    private String requestId = MessageClientIDSetter.createUniqID();
+
+    private int contextCode = 0;
+
+    private int exactlyOnceStatus = 0;
+
+    private List<OnsTraceBean> traceBeans;
+
+    public int getContextCode() {
+        return contextCode;
+    }
+
+    public void setContextCode(final int contextCode) {
+        this.contextCode = contextCode;
+    }
+
+    public int getExactlyOnceStatus() {
+        return exactlyOnceStatus;
+    }
+
+    public void setExactlyOnceStatus(int exactlyOnceStatus) {
+        this.exactlyOnceStatus = exactlyOnceStatus;
+    }
+
+    public List<OnsTraceBean> getTraceBeans() {
+        return traceBeans;
+    }
+
+
+    public void setTraceBeans(List<OnsTraceBean> traceBeans) {
+        this.traceBeans = traceBeans;
+    }
+
+
+    public String getRegionId() {
+        return regionId;
+    }
+
+
+    public void setRegionId(String regionId) {
+        this.regionId = regionId;
+    }
+
+
+    public OnsTraceType getTraceType() {
+        return traceType;
+    }
+
+
+    public void setTraceType(OnsTraceType traceType) {
+        this.traceType = traceType;
+    }
+
+
+    public long getTimeStamp() {
+        return timeStamp;
+    }
+
+
+    public void setTimeStamp(long timeStamp) {
+        this.timeStamp = timeStamp;
+    }
+
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+
+    public int getCostTime() {
+        return costTime;
+    }
+
+
+    public void setCostTime(int costTime) {
+        this.costTime = costTime;
+    }
+
+
+    public boolean isSuccess() {
+        return isSuccess;
+    }
+
+
+    public void setSuccess(boolean success) {
+        isSuccess = success;
+    }
+
+
+    public String getRequestId() {
+        return requestId;
+    }
+
+
+    public void setRequestId(String requestId) {
+        this.requestId = requestId;
+    }
+
+    public String getRegionName() {
+        return regionName;
+    }
+
+    public void setRegionName(String regionName) {
+        this.regionName = regionName;
+    }
+
+    @Override
+    public int compareTo(OnsTraceContext o) {
+        return (int) (this.timeStamp - o.getTimeStamp());
+    }
+
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(1024);
+        sb.append(traceType).append("_").append(groupName)
+            .append("_").append(regionId).append("_").append(isSuccess).append("_");
+        if (traceBeans != null && traceBeans.size() > 0) {
+            for (OnsTraceBean bean : traceBeans) {
+                sb.append(bean.getMsgId() + "_" + bean.getTopic() + "_");
+            }
+        }
+        return "OnsTraceContext{" + sb.toString() + '}';
+    }
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceDataEncoder.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceDataEncoder.java
new file mode 100644
index 0000000..7b6ad6e
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceDataEncoder.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.rocketmq.common.message.MessageType;
+
+public class OnsTraceDataEncoder {
+
+
+    public static List<OnsTraceContext> decoderFromTraceDataString(String traceData) {
+        List<OnsTraceContext> resList = new ArrayList<OnsTraceContext>();
+        if (traceData == null || traceData.length() <= 0) {
+            return resList;
+        }
+        String[] contextList = traceData.split(String.valueOf(OnsTraceConstants.FIELD_SPLITOR));
+        for (String context : contextList) {
+            String[] line = context.split(String.valueOf(OnsTraceConstants.CONTENT_SPLITOR));
+            if (line[0].equals(OnsTraceType.Pub.name())) {
+                OnsTraceContext pubContext = new OnsTraceContext();
+                pubContext.setTraceType(OnsTraceType.Pub);
+                pubContext.setTimeStamp(Long.parseLong(line[1]));
+                pubContext.setRegionId(line[2]);
+                pubContext.setGroupName(line[3]);
+                OnsTraceBean bean = new OnsTraceBean();
+                bean.setTopic(line[4]);
+                bean.setMsgId(line[5]);
+                bean.setTags(line[6]);
+                bean.setKeys(line[7]);
+                bean.setStoreHost(line[8]);
+                bean.setBodyLength(Integer.parseInt(line[9]));
+                pubContext.setCostTime(Integer.parseInt(line[10]));
+                bean.setMsgType(MessageType.values()[Integer.parseInt(line[11])]);
+                if (line.length == 13) {
+                    pubContext.setSuccess(Boolean.parseBoolean(line[12]));
+                } else if (line.length == 14) {
+                    bean.setOffsetMsgId(line[12]);
+                    pubContext.setSuccess(Boolean.parseBoolean(line[13]));
+                }
+                pubContext.setTraceBeans(new ArrayList<OnsTraceBean>(1));
+                pubContext.getTraceBeans().add(bean);
+                resList.add(pubContext);
+            } else if (line[0].equals(OnsTraceType.SubBefore.name())) {
+                OnsTraceContext subBeforeContext = new OnsTraceContext();
+                subBeforeContext.setTraceType(OnsTraceType.SubBefore);
+                subBeforeContext.setTimeStamp(Long.parseLong(line[1]));
+                subBeforeContext.setRegionId(line[2]);
+                subBeforeContext.setGroupName(line[3]);
+                subBeforeContext.setRequestId(line[4]);
+                OnsTraceBean bean = new OnsTraceBean();
+                bean.setMsgId(line[5]);
+                bean.setRetryTimes(Integer.parseInt(line[6]));
+                bean.setKeys(line[7]);
+                subBeforeContext.setTraceBeans(new ArrayList<OnsTraceBean>(1));
+                subBeforeContext.getTraceBeans().add(bean);
+                resList.add(subBeforeContext);
+            } else if (line[0].equals(OnsTraceType.SubAfter.name())) {
+                OnsTraceContext subAfterContext = new OnsTraceContext();
+                subAfterContext.setTraceType(OnsTraceType.SubAfter);
+                subAfterContext.setRequestId(line[1]);
+                OnsTraceBean bean = new OnsTraceBean();
+                bean.setMsgId(line[2]);
+                bean.setKeys(line[5]);
+                subAfterContext.setTraceBeans(new ArrayList<OnsTraceBean>(1));
+                subAfterContext.getTraceBeans().add(bean);
+                subAfterContext.setCostTime(Integer.parseInt(line[3]));
+                subAfterContext.setSuccess(Boolean.parseBoolean(line[4]));
+                if (line.length >= 7) {
+                    // add the context type
+                    subAfterContext.setContextCode(Integer.parseInt(line[6]));
+                }
+                if (line.length >= 8) {
+                    subAfterContext.setExactlyOnceStatus(Integer.parseInt(line[7]));
+                }
+                resList.add(subAfterContext);
+            }
+        }
+        return resList;
+    }
+
+
+    public static OnsTraceTransferBean encoderFromContextBean(OnsTraceContext ctx) {
+        if (ctx == null) {
+            return null;
+        }
+        OnsTraceTransferBean transferBean = new OnsTraceTransferBean();
+        StringBuilder sb = new StringBuilder(256);
+        switch (ctx.getTraceType()) {
+            case Pub: {
+                OnsTraceBean bean = ctx.getTraceBeans().get(0);
+                sb.append(ctx.getTraceType()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(ctx.getTimeStamp()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(ctx.getRegionId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(ctx.getGroupName()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getTopic()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getMsgId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getTags()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getKeys()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getStoreHost()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getBodyLength()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(ctx.getCostTime()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getMsgType().ordinal()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(bean.getOffsetMsgId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                    .append(ctx.isSuccess()).append(OnsTraceConstants.FIELD_SPLITOR);
+            }
+            break;
+            case SubBefore: {
+                for (OnsTraceBean bean : ctx.getTraceBeans()) {
+                    sb.append(ctx.getTraceType()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getTimeStamp()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getRegionId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getGroupName()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getRequestId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(bean.getMsgId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(bean.getRetryTimes()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(bean.getKeys()).append(OnsTraceConstants.FIELD_SPLITOR);//
+                }
+            }
+            break;
+            case SubAfter: {
+                for (OnsTraceBean bean : ctx.getTraceBeans()) {
+                    sb.append(ctx.getTraceType()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        // .append(ctx.getTimeStamp()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getRequestId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(bean.getMsgId()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getCostTime()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.isSuccess()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(bean.getKeys()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getContextCode()).append(OnsTraceConstants.CONTENT_SPLITOR)//
+                        .append(ctx.getExactlyOnceStatus()).append(OnsTraceConstants.FIELD_SPLITOR);
+                }
+            }
+            break;
+            default:
+        }
+        transferBean.setTransData(sb.toString());
+        for (OnsTraceBean bean : ctx.getTraceBeans()) {
+            transferBean.getTransKey().add(bean.getMsgId());
+            if (bean.getKeys() != null && bean.getKeys().length() > 0) {
+                transferBean.getTransKey().add(bean.getKeys());
+            }
+        }
+        return transferBean;
+    }
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceDispatcherType.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceDispatcherType.java
new file mode 100644
index 0000000..88dc595
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceDispatcherType.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.common;
+
+public enum OnsTraceDispatcherType {
+
+    PRODUCER,
+
+    CONSUMER
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceTransferBean.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceTransferBean.java
new file mode 100644
index 0000000..71d79e4
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceTransferBean.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.common;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class OnsTraceTransferBean {
+    private String transData;
+    private Set<String> transKey = new HashSet<String>();
+
+
+    public String getTransData() {
+        return transData;
+    }
+
+
+    public void setTransData(String transData) {
+        this.transData = transData;
+    }
+
+
+    public Set<String> getTransKey() {
+        return transKey;
+    }
+
+
+    public void setTransKey(Set<String> transKey) {
+        this.transKey = transKey;
+    }
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceType.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceType.java
new file mode 100644
index 0000000..5684584
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/common/OnsTraceType.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.common;
+
+public enum OnsTraceType {
+
+    Pub,
+
+    SubBefore,
+
+    SubAfter,
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/AsyncDispatcher.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/AsyncDispatcher.java
new file mode 100644
index 0000000..87ead88
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/AsyncDispatcher.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.dispatch;
+
+import java.io.IOException;
+
+import org.apache.rocketmq.client.exception.MQClientException;
+
+public interface AsyncDispatcher {
+
+    void start() throws MQClientException;
+
+    boolean append(Object ctx);
+
+    void flush() throws IOException;
+
+    void shutdown();
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/impl/AsyncArrayDispatcher.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/impl/AsyncArrayDispatcher.java
new file mode 100644
index 0000000..4f02bbd
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/impl/AsyncArrayDispatcher.java
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.dispatch.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+import org.apache.rocketmq.client.common.ThreadLocalIndex;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.impl.consumer.DefaultMQPushConsumerImpl;
+import org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl;
+import org.apache.rocketmq.client.impl.producer.TopicPublishInfo;
+import org.apache.rocketmq.client.log.ClientLogger;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.client.producer.MessageQueueSelector;
+import org.apache.rocketmq.client.producer.SendCallback;
+import org.apache.rocketmq.client.producer.SendResult;
+import org.apache.rocketmq.common.ThreadFactoryImpl;
+import org.apache.rocketmq.common.message.Message;
+import org.apache.rocketmq.common.message.MessageQueue;
+import org.apache.rocketmq.common.protocol.NamespaceUtil;
+import org.apache.rocketmq.logging.InternalLogger;
+import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceContext;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDataEncoder;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceTransferBean;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
+
+public class AsyncArrayDispatcher implements AsyncDispatcher {
+    private final static InternalLogger CLIENT_LOG = ClientLogger.getLog();
+    private final int queueSize;
+    private final int batchSize;
+    private final DefaultMQProducer traceProducer;
+    private final ThreadPoolExecutor traceExecuter;
+
+    private AtomicLong discardCount;
+    private Thread worker;
+    private ArrayBlockingQueue<OnsTraceContext> traceContextQueue;
+    private ArrayBlockingQueue<Runnable> appenderQueue;
+    private volatile Thread shutDownHook;
+    private volatile boolean stopped = false;
+    private String dispatcherType;
+    private DefaultMQProducerImpl hostProducer;
+    private DefaultMQPushConsumerImpl hostConsumer;
+    private volatile ThreadLocalIndex sendWhichQueue = new ThreadLocalIndex();
+    private String dispatcherId = UUID.randomUUID().toString();
+
+    public AsyncArrayDispatcher(Properties properties) throws MQClientException {
+        dispatcherType = properties.getProperty(OnsTraceConstants.TraceDispatcherType);
+        int queueSize = Integer.parseInt(properties.getProperty(OnsTraceConstants.AsyncBufferSize, "2048"));
+        queueSize = 1 << (32 - Integer.numberOfLeadingZeros(queueSize - 1));
+        this.queueSize = queueSize;
+        batchSize = Integer.parseInt(properties.getProperty(OnsTraceConstants.MaxBatchNum, "1"));
+        this.discardCount = new AtomicLong(0L);
+        traceContextQueue = new ArrayBlockingQueue<OnsTraceContext>(1024);
+        appenderQueue = new ArrayBlockingQueue<Runnable>(queueSize);
+
+        this.traceExecuter = new ThreadPoolExecutor(//
+            10, //
+            20, //
+            1000 * 60, //
+            TimeUnit.MILLISECONDS, //
+            this.appenderQueue, //
+            new ThreadFactoryImpl("MQTraceSendThread_"));
+        traceProducer = TraceProducerFactory.getTraceDispatcherProducer(properties);
+    }
+
+    public AsyncArrayDispatcher(Properties properties, SessionCredentials sessionCredentials) throws MQClientException {
+        dispatcherType = properties.getProperty(OnsTraceConstants.TraceDispatcherType);
+        int queueSize = Integer.parseInt(properties.getProperty(OnsTraceConstants.AsyncBufferSize, "2048"));
+        queueSize = 1 << (32 - Integer.numberOfLeadingZeros(queueSize - 1));
+        this.queueSize = queueSize;
+        batchSize = Integer.parseInt(properties.getProperty(OnsTraceConstants.MaxBatchNum, "1"));
+        this.discardCount = new AtomicLong(0L);
+        traceContextQueue = new ArrayBlockingQueue<OnsTraceContext>(1024);
+        appenderQueue = new ArrayBlockingQueue<Runnable>(queueSize);
+
+        this.traceExecuter = new ThreadPoolExecutor(
+            10,
+            20,
+            1000 * 60,
+            TimeUnit.MILLISECONDS,
+            this.appenderQueue,
+            new ThreadFactoryImpl("MQTraceSendThread_"));
+        traceProducer = TraceProducerFactory.getTraceDispatcherProducer(properties, sessionCredentials);
+    }
+
+    public DefaultMQProducerImpl getHostProducer() {
+        return hostProducer;
+    }
+
+    public void setHostProducer(DefaultMQProducerImpl hostProducer) {
+        this.hostProducer = hostProducer;
+    }
+
+    public DefaultMQPushConsumerImpl getHostConsumer() {
+        return hostConsumer;
+    }
+
+    public void setHostConsumer(DefaultMQPushConsumerImpl hostConsumer) {
+        this.hostConsumer = hostConsumer;
+    }
+
+    @Override
+    public void start() throws MQClientException {
+        TraceProducerFactory.registerTraceDispatcher(dispatcherId);
+        this.worker = new ThreadFactoryImpl("MQ-AsyncArrayDispatcher-Thread-" + dispatcherId, true)
+            .newThread(new AsyncRunnable());
+        this.worker.start();
+        this.registerShutDownHook();
+    }
+
+    @Override
+    public boolean append(final Object ctx) {
+        boolean result = traceContextQueue.offer((OnsTraceContext) ctx);
+        if (!result) {
+            CLIENT_LOG.info("buffer full" + discardCount.incrementAndGet() + " ,context is " + ctx);
+        }
+        return result;
+    }
+
+    @Override
+    public void flush() throws IOException {
+        long end = System.currentTimeMillis() + 500;
+        while (traceContextQueue.size() > 0 || appenderQueue.size() > 0 && System.currentTimeMillis() <= end) {
+            try {
+                Thread.sleep(1);
+            } catch (InterruptedException e) {
+                break;
+            }
+        }
+        CLIENT_LOG.info("------end trace send " + traceContextQueue.size() + "   " + appenderQueue.size());
+    }
+
+    @Override
+    public void shutdown() {
+        this.stopped = true;
+        this.traceExecuter.shutdown();
+        TraceProducerFactory.unregisterTraceDispatcher(dispatcherId);
+        this.removeShutdownHook();
+    }
+
+    public void registerShutDownHook() {
+        if (shutDownHook == null) {
+            shutDownHook = new ThreadFactoryImpl("ShutdownHookMQTrace").newThread(new Runnable() {
+                private volatile boolean hasShutdown = false;
+                @Override
+                public void run() {
+                    synchronized (this) {
+                        if (!this.hasShutdown) {
+                            try {
+                                flush();
+                            } catch (IOException e) {
+                                CLIENT_LOG.error("system mqtrace hook shutdown failed ,maybe loss some trace data");
+                            }
+                        }
+                    }
+                }
+            });
+            Runtime.getRuntime().addShutdownHook(shutDownHook);
+        }
+    }
+
+    public void removeShutdownHook() {
+        if (shutDownHook != null) {
+            Runtime.getRuntime().removeShutdownHook(shutDownHook);
+        }
+    }
+
+    class AsyncRunnable implements Runnable {
+        private boolean stopped;
+
+        @Override
+        public void run() {
+            while (!stopped) {
+                List<OnsTraceContext> contexts = new ArrayList<OnsTraceContext>(batchSize);
+                for (int i = 0; i < batchSize; i++) {
+                    OnsTraceContext context = null;
+                    try {
+                        context = traceContextQueue.poll(5, TimeUnit.MILLISECONDS);
+                    } catch (InterruptedException e) {
+                    }
+                    if (context != null) {
+                        contexts.add(context);
+                    } else {
+                        break;
+                    }
+                }
+                if (contexts.size() > 0) {
+                    AsyncAppenderRequest request = new AsyncAppenderRequest(contexts);
+                    traceExecuter.submit(request);
+                } else if (AsyncArrayDispatcher.this.stopped) {
+                    this.stopped = true;
+                }
+            }
+
+        }
+    }
+
+    class AsyncAppenderRequest implements Runnable {
+        List<OnsTraceContext> contextList;
+
+        public AsyncAppenderRequest(final List<OnsTraceContext> contextList) {
+            if (contextList != null) {
+                this.contextList = contextList;
+            } else {
+                this.contextList = new ArrayList<OnsTraceContext>(1);
+            }
+        }
+
+        @Override
+        public void run() {
+            sendTraceData(contextList);
+        }
+
+        public void sendTraceData(List<OnsTraceContext> contextList) {
+            Map<String, List<OnsTraceTransferBean>> transBeanMap = new HashMap<String, List<OnsTraceTransferBean>>(16);
+            String currentRegionId = null;
+            for (OnsTraceContext context : contextList) {
+                currentRegionId = context.getRegionId();
+                if (currentRegionId == null || context.getTraceBeans().isEmpty()) {
+                    continue;
+                }
+                String topic = context.getTraceBeans().get(0).getTopic();
+                String key = topic + OnsTraceConstants.CONTENT_SPLITOR + currentRegionId;
+                List<OnsTraceTransferBean> transBeanList = transBeanMap.get(key);
+                if (transBeanList == null) {
+                    transBeanList = new ArrayList<OnsTraceTransferBean>();
+                    transBeanMap.put(key, transBeanList);
+                }
+                OnsTraceTransferBean traceData = OnsTraceDataEncoder.encoderFromContextBean(context);
+                transBeanList.add(traceData);
+            }
+            for (Map.Entry<String, List<OnsTraceTransferBean>> entry : transBeanMap.entrySet()) {
+                String[] key = entry.getKey().split(String.valueOf(OnsTraceConstants.CONTENT_SPLITOR));
+                flushData(entry.getValue(), key[0], key[1]);
+            }
+        }
+
+        private void flushData(List<OnsTraceTransferBean> transBeanList, String topic, String currentRegionId) {
+            if (transBeanList.size() == 0) {
+                return;
+            }
+            StringBuilder buffer = new StringBuilder(1024);
+            int count = 0;
+            Set<String> keySet = new HashSet<String>();
+
+            for (OnsTraceTransferBean bean : transBeanList) {
+                keySet.addAll(bean.getTransKey());
+                buffer.append(bean.getTransData());
+                count++;
+                if (buffer.length() >= traceProducer.getMaxMessageSize()) {
+                    sendTraceDataByMQ(keySet, buffer.toString(), topic, currentRegionId);
+                    buffer.delete(0, buffer.length());
+                    keySet.clear();
+                    count = 0;
+                }
+            }
+            if (count > 0) {
+                sendTraceDataByMQ(keySet, buffer.toString(), topic, currentRegionId);
+            }
+            transBeanList.clear();
+        }
+
+        private void sendTraceDataByMQ(Set<String> keySet, final String data, String dataTopic,
+            String currentRegionId) {
+            String topic = OnsTraceConstants.traceTopic + currentRegionId;
+            final Message message = new Message(topic, data.getBytes());
+            message.setKeys(keySet);
+            try {
+                Set<String> dataBrokerSet = getBrokerSetByTopic(dataTopic);
+                Set<String> traceBrokerSet = tryGetMessageQueueBrokerSet(traceProducer.getDefaultMQProducerImpl(), topic);
+                dataBrokerSet.retainAll(traceBrokerSet);
+                SendCallback callback = new SendCallback() {
+                    @Override
+                    public void onSuccess(SendResult sendResult) {
+                    }
+
+                    @Override
+                    public void onException(Throwable e) {
+                        CLIENT_LOG.info("send trace data ,the traceData is " + data);
+                    }
+                };
+                if (dataBrokerSet.isEmpty()) {
+                    //no cross set
+                    traceProducer.send(message, callback, 5000);
+                } else {
+                    traceProducer.send(message, new MessageQueueSelector() {
+                        @Override
+                        public MessageQueue select(List<MessageQueue> mqs, Message msg, Object arg) {
+                            Set<String> brokerSet = (Set<String>) arg;
+                            List<MessageQueue> filterMqs = new ArrayList<MessageQueue>();
+                            for (MessageQueue queue : mqs) {
+                                if (brokerSet.contains(queue.getBrokerName())) {
+                                    filterMqs.add(queue);
+                                }
+                            }
+                            int index = sendWhichQueue.getAndIncrement();
+                            int pos = Math.abs(index) % filterMqs.size();
+                            if (pos < 0) {
+                                pos = 0;
+                            }
+                            return filterMqs.get(pos);
+                        }
+                    }, dataBrokerSet, callback);
+                }
+
+            } catch (Exception e) {
+                CLIENT_LOG.info("send trace data,the traceData is" + data);
+            }
+        }
+
+        private Set<String> getBrokerSetByTopic(String topic) {
+            Set<String> brokerSet = new HashSet<String>();
+            if (dispatcherType != null && dispatcherType.equals(OnsTraceDispatcherType.PRODUCER.name()) && hostProducer != null) {
+                brokerSet = tryGetMessageQueueBrokerSet(hostProducer, topic);
+            }
+            if (dispatcherType != null && dispatcherType.equals(OnsTraceDispatcherType.CONSUMER.name()) && hostConsumer != null) {
+                brokerSet = tryGetMessageQueueBrokerSet(hostConsumer, topic);
+            }
+            return brokerSet;
+        }
+
+        private Set<String> tryGetMessageQueueBrokerSet(DefaultMQProducerImpl producer, String topic) {
+            Set<String> brokerSet = new HashSet<String>();
+            String realTopic = NamespaceUtil.wrapNamespace(producer.getDefaultMQProducer().getNamespace(), topic);
+            TopicPublishInfo topicPublishInfo = producer.getTopicPublishInfoTable().get(realTopic);
+            if (null == topicPublishInfo || !topicPublishInfo.ok()) {
+                producer.getTopicPublishInfoTable().putIfAbsent(realTopic, new TopicPublishInfo());
+                producer.getmQClientFactory().updateTopicRouteInfoFromNameServer(realTopic);
+                topicPublishInfo = producer.getTopicPublishInfoTable().get(realTopic);
+            }
+            if (topicPublishInfo.isHaveTopicRouterInfo() || topicPublishInfo.ok()) {
+                for (MessageQueue queue : topicPublishInfo.getMessageQueueList()) {
+                    brokerSet.add(queue.getBrokerName());
+                }
+            }
+            return brokerSet;
+        }
+
+        private Set<String> tryGetMessageQueueBrokerSet(DefaultMQPushConsumerImpl consumer, String topic) {
+            Set<String> brokerSet = new HashSet<String>();
+            try {
+                String realTopic = NamespaceUtil.wrapNamespace(consumer.getDefaultMQPushConsumer().getNamespace(), topic);
+                Set<MessageQueue> messageQueues = consumer.fetchSubscribeMessageQueues(realTopic);
+                for (MessageQueue queue : messageQueues) {
+                    brokerSet.add(queue.getBrokerName());
+                }
+            } catch (MQClientException e) {
+                CLIENT_LOG.info("fetch message queue failed, the topic is {}", topic);
+            }
+            return brokerSet;
+        }
+    }
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/impl/TraceProducerFactory.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/impl/TraceProducerFactory.java
new file mode 100644
index 0000000..60e65cb
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/dispatch/impl/TraceProducerFactory.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.dispatch.impl;
+
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.common.namesrv.TopAddressing;
+
+import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+import org.apache.rocketmq.ons.api.impl.rocketmq.ClientRPCHook;
+
+public class TraceProducerFactory {
+    private static Map<String, Object> dispatcherTable = new ConcurrentHashMap<String, Object>();
+    private static AtomicBoolean isStarted = new AtomicBoolean(false);
+    private static DefaultMQProducer traceProducer;
+
+    public static DefaultMQProducer getTraceDispatcherProducer(Properties properties) {
+        if (traceProducer == null) {
+            SessionCredentials sessionCredentials = new SessionCredentials();
+            Properties sessionProperties = new Properties();
+            String accessKey = properties.getProperty(OnsTraceConstants.AccessKey);
+            String secretKey = properties.getProperty(OnsTraceConstants.SecretKey);
+            sessionProperties.put(OnsTraceConstants.AccessKey, accessKey);
+            sessionProperties.put(OnsTraceConstants.SecretKey, secretKey);
+            sessionCredentials.updateContent(sessionProperties);
+            traceProducer = new DefaultMQProducer(new ClientRPCHook(sessionCredentials));
+            traceProducer.setProducerGroup(accessKey + OnsTraceConstants.groupName);
+            traceProducer.setSendMsgTimeout(5000);
+            traceProducer.setInstanceName(properties.getProperty(OnsTraceConstants.InstanceName, String.valueOf(System.currentTimeMillis())));
+            String nameSrv = properties.getProperty(OnsTraceConstants.NAMESRV_ADDR);
+            if (nameSrv == null) {
+                TopAddressing topAddressing = new TopAddressing(properties.getProperty(OnsTraceConstants.ADDRSRV_URL));
+                nameSrv = topAddressing.fetchNSAddr();
+            }
+            traceProducer.setNamesrvAddr(nameSrv);
+            traceProducer.setVipChannelEnabled(false);
+            int maxSize = Integer.parseInt(properties.getProperty(OnsTraceConstants.MaxMsgSize, "128000"));
+            traceProducer.setMaxMessageSize(maxSize - 10 * 1000);
+        }
+        return traceProducer;
+    }
+
+    public static DefaultMQProducer getTraceDispatcherProducer(Properties properties, SessionCredentials sessionCredentials) {
+        if (traceProducer == null) {
+            String accessKey = properties.getProperty(OnsTraceConstants.AccessKey);
+            traceProducer = new DefaultMQProducer(new ClientRPCHook(sessionCredentials));
+            traceProducer.setProducerGroup(accessKey.replace('.', '-') + OnsTraceConstants.groupName);
+            traceProducer.setSendMsgTimeout(5000);
+            traceProducer.setInstanceName(properties.getProperty(OnsTraceConstants.InstanceName, String.valueOf(System.currentTimeMillis())));
+            String nameSrv = properties.getProperty(OnsTraceConstants.NAMESRV_ADDR);
+            if (nameSrv == null) {
+                TopAddressing topAddressing = new TopAddressing(properties.getProperty(OnsTraceConstants.ADDRSRV_URL));
+                nameSrv = topAddressing.fetchNSAddr();
+            }
+            traceProducer.setNamesrvAddr(nameSrv);
+            traceProducer.setVipChannelEnabled(false);
+            int maxSize = Integer.parseInt(properties.getProperty(OnsTraceConstants.MaxMsgSize, "128000"));
+            traceProducer.setMaxMessageSize(maxSize - 10 * 1000);
+        }
+        return traceProducer;
+    }
+
+    public static void registerTraceDispatcher(String dispatcherId) throws MQClientException {
+        dispatcherTable.put(dispatcherId, new Object());
+        if (traceProducer != null && isStarted.compareAndSet(false, true)) {
+            traceProducer.start();
+        }
+    }
+
+    public static void unregisterTraceDispatcher(String dispatcherId) {
+        dispatcherTable.remove(dispatcherId);
+        if (dispatcherTable.isEmpty() && traceProducer != null && isStarted.get()) {
+            traceProducer.shutdown();
+        }
+    }
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/hook/AbstractRPCHook.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/hook/AbstractRPCHook.java
new file mode 100644
index 0000000..9e78880
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/hook/AbstractRPCHook.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.ons.open.trace.core.hook;
+
+import java.lang.reflect.Field;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.rocketmq.remoting.CommandCustomHeader;
+import org.apache.rocketmq.remoting.RPCHook;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.AccessKey;
+import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.ONSChannelKey;
+
+public abstract class AbstractRPCHook implements RPCHook {
+    protected ConcurrentHashMap<Class<? extends CommandCustomHeader>, Field[]> fieldCache =
+            new ConcurrentHashMap<Class<? extends CommandCustomHeader>, Field[]>();
+
+
+    protected SortedMap<String, String> parseRequestContent(RemotingCommand request, String ak, String onsChannel) {
+        CommandCustomHeader header = request.readCustomHeader();
+        // sort property
+        SortedMap<String, String> map = new TreeMap<String, String>();
+        map.put(AccessKey, ak);
+        map.put(ONSChannelKey, onsChannel);
+        try {
+            // add header properties
+            if (null != header) {
+                Field[] fields = fieldCache.get(header.getClass());
+                if (null == fields) {
+                    fields = header.getClass().getDeclaredFields();
+                    for (Field field : fields) {
+                        field.setAccessible(true);
+                    }
+                    Field[] tmp = fieldCache.putIfAbsent(header.getClass(), fields);
+                    if (null != tmp) {
+                        fields = tmp;
+                    }
+                }
+
+                for (Field field : fields) {
+                    Object value = field.get(header);
+                    if (null != value && !field.isSynthetic()) {
+                        map.put(field.getName(), value.toString());
+                    }
+                }
+            }
+            return map;
+        }
+        catch (Exception e) {
+            throw new RuntimeException("incompatible exception.", e);
+        }
+    }
+
+}
diff --git a/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/utils/MixUtils.java b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/utils/MixUtils.java
new file mode 100644
index 0000000..9eb5be1
--- /dev/null
+++ b/ons-core/ons-trace-core/src/main/java/org/apache/rocketmq/ons/open/trace/core/utils/MixUtils.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.rocketmq.ons.open.trace.core.utils;
+
+import org.apache.rocketmq.remoting.protocol.RemotingSerializable;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+public class MixUtils {
+    public static String getLocalAddress() {
+        try {
+
+            Enumeration<NetworkInterface> enumeration = NetworkInterface.getNetworkInterfaces();
+            ArrayList<String> ipv4Result = new ArrayList<String>();
+            ArrayList<String> ipv6Result = new ArrayList<String>();
+            while (enumeration.hasMoreElements()) {
+                final NetworkInterface networkInterface = enumeration.nextElement();
+                final Enumeration<InetAddress> en = networkInterface.getInetAddresses();
+                while (en.hasMoreElements()) {
+                    final InetAddress address = en.nextElement();
+                    if (!address.isLoopbackAddress()) {
+                        if (address instanceof Inet6Address) {
+                            ipv6Result.add(normalizeHostAddress(address));
+                        }
+                        else {
+                            ipv4Result.add(normalizeHostAddress(address));
+                        }
+                    }
+                }
+            }
+
+
+            if (!ipv4Result.isEmpty()) {
+                for (String ip : ipv4Result) {
+                    if (ip.startsWith("127.0") || ip.startsWith("192.168")) {
+                        continue;
+                    }
+
+                    return ip;
+                }
+
+
+                return ipv4Result.get(ipv4Result.size() - 1);
+            }
+
+            else if (!ipv6Result.isEmpty()) {
+                return ipv6Result.get(0);
+            }
+
+            final InetAddress localHost = InetAddress.getLocalHost();
+            return normalizeHostAddress(localHost);
+        }
+        catch (SocketException e) {
+            e.printStackTrace();
+        }
+        catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+        finally {
+
+        }
+
+        return null;
+    }
+
+
+    public static String normalizeHostAddress(final InetAddress localHost) {
+        if (localHost instanceof Inet6Address) {
+            return "[" + localHost.getHostAddress() + "]";
+        }
+        else {
+            return localHost.getHostAddress();
+        }
+    }
+
+
+    public static String toJson(final Object obj, boolean prettyFormat) {
+        return RemotingSerializable.toJson(obj, prettyFormat);
+    }
+
+
+    public static <T> T fromJson(String json, Class<T> classOfT) {
+        return RemotingSerializable.fromJson(json, classOfT);
+    }
+
+
+    public static String replaceNull(String ori) {
+        return ori == null ? "" : ori;
+    }
+}
diff --git a/ons-core/pom.xml b/ons-core/pom.xml
new file mode 100644
index 0000000..edadb69
--- /dev/null
+++ b/ons-core/pom.xml
@@ -0,0 +1,271 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.rocketmq</groupId>
+        <artifactId>ons-parent</artifactId>
+        <version>1.8.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <inceptionYear>2012</inceptionYear>
+    <artifactId>ons-all</artifactId>
+    <packaging>pom</packaging>
+    <name>ons-all ${project.version}</name>
+    <url>https://github.org.apache.rocketmq</url>
+    <description>https://github.com/alibaba/RocketMQ/blob/develop/README.md</description>
+    <modules>
+        <module>ons-client</module>
+        <module>ons-api</module>
+        <module>ons-trace-core</module>
+        <module>ons-auth4client</module>
+    </modules>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <!--maven properties -->
+        <maven.test.skip>true</maven.test.skip>
+        <maven.jdoc.skip>true</maven.jdoc.skip>
+        <downloadSources>true</downloadSources>
+        <!-- compiler settings properties -->
+        <java_source_version>1.6</java_source_version>
+        <java_target_version>1.6</java_target_version>
+        <file_encoding>UTF-8</file_encoding>
+        <!-- Always use stable version of RocketMQ -->
+        <rocketmq.version>4.5.1</rocketmq.version>
+        <auth.version>${project.version}</auth.version>
+        <spring.version>4.1.2.RELEASE</spring.version>
+        <diamond.version>3.7.4</diamond.version>
+    </properties>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>${java_source_version}</source>
+                    <target>${java_target_version}</target>
+                    <encoding>${file_encoding}</encoding>
+                    <showDeprecation>true</showDeprecation>
+                    <showWarnings>true</showWarnings>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.3</version>
+                <configuration>
+                    <skip>${maven.test.skip}</skip>
+                    <argLine>-Xms512m -Xmx1024m</argLine>
+                    <forkMode>once</forkMode>
+                    <includes>
+                        <include>**/*Test.java</include>
+                    </includes>
+                    <excludes>
+                        <exclude>org.apache.rocketmq/remoting/ExceptionTest.java</exclude>
+                        <exclude>org.apache.rocketmq/remoting/SyncInvokeTest.java</exclude>
+                        <exclude>org.apache.rocketmq/remoting/NettyIdleTest.java</exclude>
+                        <exclude>org.apache.rocketmq/remoting/NettyConnectionTest.java</exclude>
+                        <exclude>org.apache.rocketmq/common/filter/PolishExprTest.java</exclude>
+                        <exclude>org.apache.rocketmq/common/protocol/MQProtosHelperTest.java</exclude>
+                        <exclude>
+                            org.apache.rocketmq/client/consumer/loadbalance/AllocateMessageQueueAveragelyTest.java
+                        </exclude>
+                        <exclude>org.apache.rocketmq/store/RecoverTest.java</exclude>
+                        <exclude>org.apache.rocketmq/broker/api/SendMessageTest.java</exclude>
+                        <exclude>org.apache.rocketmq/test/integration/*/*.java</exclude>
+                        <exclude>org.apache.rocketmq/test/integration/BaseTest.java</exclude>
+                        <exclude>org.apache.rocketmq/test/*/*.java</exclude>
+                        <exclude>org.apache.rocketmq/test/BaseTest.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.10.4</version>
+                <executions>
+                    <execution>
+                        <id>attach-javadocs</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <skip>${maven.jdoc.skip}</skip>
+                    <encoding>${file_encoding}</encoding>
+                    <charset>${file_encoding}</charset>
+                    <doclet>org.jboss.apiviz.APIviz</doclet>
+                    <docletArtifact>
+                        <groupId>org.jboss.apiviz</groupId>
+                        <artifactId>apiviz</artifactId>
+                        <version>1.3.2.GA</version>
+                    </docletArtifact>
+                    <useStandardDocletOptions>true</useStandardDocletOptions>
+                    <breakiterator>true</breakiterator>
+                    <version>true</version>
+                    <author>true</author>
+                    <keywords>true</keywords>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>2.1.2</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>false</filtering>
+            </resource>
+        </resources>
+    </build>
+    <profiles>
+        <profile>
+            <id>release-sign-artifacts</id>
+            <activation>
+                <property>
+                    <name>performRelease</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-gpg-plugin</artifactId>
+                        <version>1.1</version>
+                        <executions>
+                            <execution>
+                                <id>sign-artifacts</id>
+                                <phase>verify</phase>
+                                <goals>
+                                    <goal>sign</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>rmq</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-assembly-plugin</artifactId>
+                        <configuration>
+                            <finalName>rmq</finalName>
+                            <descriptors>
+                                <descriptor>release.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>ons-client</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-assembly-plugin</artifactId>
+                        <configuration>
+                            <finalName>rocketmq-ons-client</finalName>
+                            <descriptors>
+                                <descriptor>release-client.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+                <version>1.7.7</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>ons-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>ons-client</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>ons-trace-core</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.rocketmq</groupId>
+                <artifactId>rocketmq-client</artifactId>
+                <version>${rocketmq.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.rocketmq</groupId>
+                <artifactId>rocketmq-remoting</artifactId>
+                <version>${rocketmq.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.rocketmq</groupId>
+                <artifactId>rocketmq-common</artifactId>
+                <version>${rocketmq.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.rocketmq</groupId>
+                <artifactId>rocketmq-tools</artifactId>
+                <version>${rocketmq.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>ons-auth4client</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>ch.qos.logback</groupId>
+                <artifactId>logback-classic</artifactId>
+                <version>1.1.11</version>
+            </dependency>
+            <dependency>
+                <groupId>ch.qos.logback</groupId>
+                <artifactId>logback-core</artifactId>
+                <version>1.1.11</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+</project>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..9718937
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+      <groupId>org.apache</groupId>
+      <artifactId>apache</artifactId>
+      <version>18</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.rocketmq</groupId>
+    <artifactId>ons-parent</artifactId>
+    <version>1.8.1-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>ons-parent ${project.version}</name>
+    <description>
+        Apache RocketMQ lightweight client
+    </description>
+    <inceptionYear>2019</inceptionYear>
+    <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <file_encoding>UTF-8</file_encoding>
+        <!-- Compiler settings properties -->
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+        <eagleeye.core.version>1.4.8</eagleeye.core.version>
+    </properties>
+    <modules>
+        <module>ons-core</module>
+    </modules>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>versions-maven-plugin</artifactId>
+                <version>2.3</version>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>clirr-maven-plugin</artifactId>
+                <version>2.7</version>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.6.1</version>
+                <configuration>
+                    <source>${maven.compiler.source}</source>
+                    <target>${maven.compiler.target}</target>
+                    <compilerVersion>${maven.compiler.source}</compilerVersion>
+                    <showDeprecation>true</showDeprecation>
+                    <showWarnings>true</showWarnings>
+                    <encoding>${file_encoding}</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.19.1</version>
+                <configuration>
+                    <argLine>-Xms512m -Xmx1024m</argLine>
+                    <forkMode>always</forkMode>
+                    <includes>
+                        <include>**/*Test.java</include>
+                    </includes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-site-plugin</artifactId>
+                <version>3.6</version>
+                <configuration>
+                    <locales>en_US</locales>
+                    <outputEncoding>UTF-8</outputEncoding>
+                    <inputEncoding>UTF-8</inputEncoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>3.0.1</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.10.4</version>
+                <configuration>
+                    <charset>UTF-8</charset>
+                    <locale>en_US</locale>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>aggregate</id>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                        <phase>site</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <version>3.0.4</version>
+            </plugin>
+            <plugin>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <version>2.17</version>
+                <executions>
+                    <execution>
+                        <id>verify</id>
+                        <phase>verify</phase>
+                        <configuration>
+                            <configLocation>style/ons_checkstyle.xml</configLocation>
+                            <encoding>UTF-8</encoding>
+                            <consoleOutput>true</consoleOutput>
+                            <failsOnError>true</failsOnError>
+                            <includeTestSourceDirectory>false</includeTestSourceDirectory>
+                        </configuration>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>pl.project13.maven</groupId>
+                <artifactId>git-commit-id-plugin</artifactId>
+                <version>2.2.3</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>revision</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <prefix>git</prefix>
+                    <dateFormat>yyyy-MM-dd HH:mm:ss z</dateFormat>
+                    <failOnNoGitDirectory>false</failOnNoGitDirectory>
+                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
+                    <skipPoms>false</skipPoms>
+                    <verbose>false</verbose>
+                    <generateGitPropertiesFile>false</generateGitPropertiesFile>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.0.2</version>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+                            <addClasspath>false</addClasspath>
+                        </manifest>
+                        <manifestEntries>
+                            <Project-Version>${project.version}</Project-Version>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+                <version>1.7.7</version>
+            </dependency>
+            <dependency>
+                <groupId>ch.qos.logback</groupId>
+                <artifactId>logback-classic</artifactId>
+                <version>1.1.11</version>
+            </dependency>
+            <dependency>
+                <groupId>ch.qos.logback</groupId>
+                <artifactId>logback-core</artifactId>
+                <version>1.1.11</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-codec</groupId>
+                <artifactId>commons-codec</artifactId>
+                <version>1.9</version>
+            </dependency>
+            <dependency>
+                <groupId>com.google.guava</groupId>
+                <artifactId>guava</artifactId>
+                <version>18.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-lang3</artifactId>
+                <version>3.6</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-csv</artifactId>
+                <version>1.5</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-beanutils</groupId>
+                <artifactId>commons-beanutils</artifactId>
+                <version>1.9.3</version>
+            </dependency>
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>1.2.50</version>
+            </dependency>
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>4.11</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.assertj</groupId>
+                <artifactId>assertj-core</artifactId>
+                <version>2.6.0</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.mockito</groupId>
+                <artifactId>mockito-core</artifactId>
+                <version>2.6.3</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.mockito</groupId>
+                <artifactId>mockito-core</artifactId>
+                <version>2.6.3</version>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <scm>
+        <url>git@gitlab.alibaba-inc.com:middleware/ons.git</url>
+        <connection>scm:git:git@gitlab.alibaba-inc.com:middleware/ons.git</connection>
+        <developerConnection>scm:git:git@gitlab.alibaba-inc.com:middleware/ons.git</developerConnection>
+    </scm>
+</project>
diff --git a/style/copyright/Apache.xml b/style/copyright/Apache.xml
new file mode 100644
index 0000000..e3e3dec
--- /dev/null
+++ b/style/copyright/Apache.xml
@@ -0,0 +1,23 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<component name="CopyrightManager">
+    <copyright>
+        <option name="myName" value="Apache" />
+        <option name="notice" value="Licensed to the Apache Software Foundation (ASF) under one or more&#10;contributor license agreements.  See the NOTICE file distributed with&#10;this work for additional information regarding copyright ownership.&#10;The ASF licenses this file to You under the Apache License, Version 2.0&#10;(the &quot;License&quot;); you may not use this file except in compliance with&#10;the License.  You may obtain a copy of the License at&#10;&#10;    http://www.a [...]
+    </copyright>
+</component>
\ No newline at end of file
diff --git a/style/copyright/profiles_settings.xml b/style/copyright/profiles_settings.xml
new file mode 100644
index 0000000..747c7e2
--- /dev/null
+++ b/style/copyright/profiles_settings.xml
@@ -0,0 +1,64 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<component name="CopyrightManager">
+    <settings default="Apache">
+        <module2copyright>
+            <element module="All" copyright="Apache"/>
+        </module2copyright>
+        <LanguageOptions name="GSP">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="prefixLines" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="HTML">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="prefixLines" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="JAVA">
+            <option name="fileTypeOverride" value="3" />
+            <option name="addBlankAfter" value="false" />
+        </LanguageOptions>
+        <LanguageOptions name="JSP">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="prefixLines" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="JSPX">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="prefixLines" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="MXML">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="prefixLines" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="Properties">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="block" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="SPI">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="block" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="XML">
+            <option name="fileTypeOverride" value="3"/>
+            <option name="prefixLines" value="false"/>
+        </LanguageOptions>
+        <LanguageOptions name="__TEMPLATE__">
+            <option name="separateBefore" value="true"/>
+            <option name="lenBefore" value="1"/>
+        </LanguageOptions>
+    </settings>
+</component>
\ No newline at end of file
diff --git a/style/ons_checkstyle.xml b/style/ons_checkstyle.xml
new file mode 100644
index 0000000..3b682af
--- /dev/null
+++ b/style/ons_checkstyle.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<!DOCTYPE module PUBLIC
+    "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+<!--Refer http://checkstyle.sourceforge.net/reports/google-java-style.html#s2.2-file-encoding -->
+<module name="Checker">
+
+    <property name="localeLanguage" value="en"/>
+
+    <!--To configure the check to report on the first instance in each file-->
+    <module name="FileTabCharacter"/>
+
+    <!-- header -->
+    <module name="RegexpHeader">
+        <property name="header" value="/\*\nLicensed to the Apache Software Foundation*"/>
+        <property name="fileExtensions" value="java"/>
+    </module>
+
+    <module name="RegexpHeader">
+        <property name="header" value="#[\s]*Licensed to the Apache Software Foundation*"/>
+        <property name="fileExtensions" value="properties"/>
+    </module>
+
+    <module name="RegexpSingleline">
+        <property name="format" value="System\.out\.println"/>
+        <property name="message" value="Prohibit invoking System.out.println in source code !"/>
+    </module>
+
+    <module name="RegexpSingleline">
+        <property name="format" value="//FIXME"/>
+        <property name="message" value="Recommended fix FIXME task !"/>
+    </module>
+
+    <module name="RegexpSingleline">
+        <property name="format" value="//TODO"/>
+        <property name="message" value="Recommended fix TODO task !"/>
+    </module>
+
+    <module name="RegexpSingleline">
+        <property name="format" value="@alibaba"/>
+        <property name="message" value="Recommended remove @alibaba keyword!"/>
+    </module>
+    <module name="RegexpSingleline">
+        <property name="format" value="@taobao"/>
+        <property name="message" value="Recommended remove @taobao keyword!"/>
+    </module>
+    <module name="RegexpSingleline">
+        <property name="format" value="@author"/>
+        <property name="message" value="Recommended remove @author tag in javadoc!"/>
+    </module>
+
+    <module name="RegexpSingleline">
+        <property name="format"
+                  value=".*[\u3400-\u4DB5\u4E00-\u9FA5\u9FA6-\u9FBB\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFF00-\uFFEF\u2E80-\u2EFF\u3000-\u303F\u31C0-\u31EF]+.*"/>
+        <property name="message" value="Not allow chinese character !"/>
+    </module>
+
+    <module name="FileLength">
+        <property name="max" value="3000"/>
+    </module>
+
+    <module name="TreeWalker">
+
+        <module name="UnusedImports">
+            <property name="processJavadoc" value="true"/>
+        </module>
+        <module name="RedundantImport"/>
+
+        <!--<module name="IllegalImport" />-->
+
+        <!--Checks that classes that override equals() also override hashCode()-->
+        <module name="EqualsHashCode"/>
+        <!--Checks for over-complicated boolean expressions. Currently finds code like if (topic == true), topic || true, !false, etc.-->
+        <module name="SimplifyBooleanExpression"/>
+        <module name="OneStatementPerLine"/>
+        <module name="UnnecessaryParentheses"/>
+        <!--Checks for over-complicated boolean return statements. For example the following code-->
+        <module name="SimplifyBooleanReturn"/>
+
+        <!--Check that the default is after all the cases in producerGroup switch statement-->
+        <module name="DefaultComesLast"/>
+        <!--Detects empty statements (standalone ";" semicolon)-->
+        <module name="EmptyStatement"/>
+        <!--Checks that long constants are defined with an upper ell-->
+        <module name="UpperEll"/>
+        <!--Checks that local, non-final variable names conform to producerGroup format specified by the format property-->
+        <module name="LocalVariableName"/>
+        <!--Validates identifiers for local, final variables, including catch parameters-->
+        <module name="LocalFinalVariableName"/>
+        <!--Validates identifiers for non-static fields-->
+        <module name="MemberName"/>
+        <!--Validates identifiers for class type parameters-->
+        <module name="ClassTypeParameterName">
+            <property name="format" value="^[A-Z0-9]*$"/>
+        </module>
+        <!--Validates identifiers for method type parameters-->
+        <module name="MethodTypeParameterName">
+            <property name="format" value="^[A-Z0-9]*$"/>
+        </module>
+        <module name="PackageName"/>
+        <module name="ParameterName"/>
+        <module name="StaticVariableName"/>
+        <module name="TypeName"/>
+        <!--Checks that there are no import statements that use the * notation-->
+        <module name="AvoidStarImport"/>
+
+        <!--whitespace-->
+        <module name="GenericWhitespace"/>
+        <!--<module name="NoWhitespaceBefore"/>-->
+        <!--<module name="NoWhitespaceAfter"/>-->
+        <module name="WhitespaceAround">
+            <property name="allowEmptyConstructors" value="true"/>
+            <property name="allowEmptyMethods" value="true"/>
+        </module>
+        <module name="Indentation"/>
+        <module name="MethodParamPad"/>
+        <module name="ParenPad"/>
+        <module name="TypecastParenPad"/>
+    </module>
+</module>
diff --git a/style/ons_codeStyle.xml b/style/ons_codeStyle.xml
new file mode 100644
index 0000000..7c7ce54
--- /dev/null
+++ b/style/ons_codeStyle.xml
@@ -0,0 +1,143 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<code_scheme name="rocketmq">
+    <option name="USE_SAME_INDENTS" value="true"/>
+    <option name="IGNORE_SAME_INDENTS_FOR_LANGUAGES" value="true"/>
+    <option name="OTHER_INDENT_OPTIONS">
+        <value>
+            <option name="INDENT_SIZE" value="4"/>
+            <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+            <option name="TAB_SIZE" value="4"/>
+            <option name="USE_TAB_CHARACTER" value="false"/>
+            <option name="SMART_TABS" value="false"/>
+            <option name="LABEL_INDENT_SIZE" value="0"/>
+            <option name="LABEL_INDENT_ABSOLUTE" value="false"/>
+            <option name="USE_RELATIVE_INDENTS" value="false"/>
+        </value>
+    </option>
+    <option name="PREFER_LONGER_NAMES" value="false"/>
+    <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000"/>
+    <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000"/>
+    <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
+        <value/>
+    </option>
+    <option name="IMPORT_LAYOUT_TABLE">
+        <value>
+            <package name="" withSubpackages="true" static="false"/>
+            <emptyLine/>
+            <package name="" withSubpackages="true" static="true"/>
+        </value>
+    </option>
+    <option name="JD_ALIGN_PARAM_COMMENTS" value="false"/>
+    <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false"/>
+    <option name="JD_P_AT_EMPTY_LINES" value="false"/>
+    <option name="JD_KEEP_INVALID_TAGS" value="false"/>
+    <option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true"/>
+    <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/>
+    <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
+    <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+    <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
+    <option name="WHILE_ON_NEW_LINE" value="true"/>
+    <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
+    <option name="ALIGN_MULTILINE_FOR" value="false"/>
+    <option name="SPACE_AFTER_TYPE_CAST" value="true"/>
+    <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/>
+    <option name="METHOD_PARAMETERS_WRAP" value="1"/>
+    <option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true"/>
+    <option name="LABELED_STATEMENT_WRAP" value="1"/>
+    <option name="WRAP_COMMENTS" value="true"/>
+    <option name="METHOD_ANNOTATION_WRAP" value="1"/>
+    <option name="CLASS_ANNOTATION_WRAP" value="1"/>
+    <option name="FIELD_ANNOTATION_WRAP" value="1"/>
+    <JavaCodeStyleSettings>
+        <option name="CLASS_NAMES_IN_JAVADOC" value="3"/>
+    </JavaCodeStyleSettings>
+    <XML>
+        <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true"/>
+    </XML>
+    <ADDITIONAL_INDENT_OPTIONS fileType="haml">
+        <option name="INDENT_SIZE" value="2"/>
+    </ADDITIONAL_INDENT_OPTIONS>
+    <codeStyleSettings language="Groovy">
+        <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/>
+        <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
+        <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+        <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
+        <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
+        <option name="ALIGN_MULTILINE_FOR" value="false"/>
+        <option name="METHOD_PARAMETERS_WRAP" value="1"/>
+        <option name="METHOD_ANNOTATION_WRAP" value="1"/>
+        <option name="CLASS_ANNOTATION_WRAP" value="1"/>
+        <option name="FIELD_ANNOTATION_WRAP" value="1"/>
+        <option name="PARENT_SETTINGS_INSTALLED" value="true"/>
+        <indentOptions>
+            <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+        </indentOptions>
+    </codeStyleSettings>
+    <codeStyleSettings language="HOCON">
+        <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
+        <option name="PARENT_SETTINGS_INSTALLED" value="true"/>
+    </codeStyleSettings>
+    <codeStyleSettings language="JAVA">
+        <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/>
+        <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
+        <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+        <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
+        <option name="WHILE_ON_NEW_LINE" value="true"/>
+        <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
+        <option name="ALIGN_MULTILINE_FOR" value="false"/>
+        <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/>
+        <option name="METHOD_PARAMETERS_WRAP" value="1"/>
+        <option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true"/>
+        <option name="LABELED_STATEMENT_WRAP" value="1"/>
+        <option name="METHOD_ANNOTATION_WRAP" value="1"/>
+        <option name="CLASS_ANNOTATION_WRAP" value="1"/>
+        <option name="FIELD_ANNOTATION_WRAP" value="1"/>
+        <option name="PARENT_SETTINGS_INSTALLED" value="true"/>
+        <indentOptions>
+            <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+        </indentOptions>
+    </codeStyleSettings>
+    <codeStyleSettings language="JSON">
+        <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+        <option name="PARENT_SETTINGS_INSTALLED" value="true"/>
+    </codeStyleSettings>
+    <codeStyleSettings language="Scala">
+        <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
+        <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+        <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
+        <option name="WHILE_ON_NEW_LINE" value="true"/>
+        <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
+        <option name="ALIGN_MULTILINE_FOR" value="false"/>
+        <option name="METHOD_PARAMETERS_WRAP" value="1"/>
+        <option name="METHOD_ANNOTATION_WRAP" value="1"/>
+        <option name="CLASS_ANNOTATION_WRAP" value="1"/>
+        <option name="FIELD_ANNOTATION_WRAP" value="1"/>
+        <option name="PARENT_SETTINGS_INSTALLED" value="true"/>
+        <indentOptions>
+            <option name="INDENT_SIZE" value="4"/>
+            <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+            <option name="TAB_SIZE" value="4"/>
+        </indentOptions>
+    </codeStyleSettings>
+    <codeStyleSettings language="XML">
+        <indentOptions>
+            <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+        </indentOptions>
+    </codeStyleSettings>
+</code_scheme>
\ No newline at end of file


[rocketmq-ons] 12/36: Add rocketmq-ons demo

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 316399b4cadf630b7e6634c380c529de613bbd6f
Author: duhenglucky <du...@gmail.com>
AuthorDate: Mon Jul 1 16:45:52 2019 +0800

    Add rocketmq-ons demo
---
 ons-sample/pom.xml                                 | 27 +++++++++++
 .../org/apache/rocketmq/ons/sample/MQConfig.java   | 32 +++++++++++++
 .../ons/sample/consumer/MessageListenerImpl.java   | 27 +++++++++++
 .../ons/sample/consumer/SimpleMQConsumer.java      | 45 ++++++++++++++++++
 .../ons/sample/consumer/SimpleOrderConsumer.java   | 54 ++++++++++++++++++++++
 .../producer/LocalTransactionCheckerImpl.java      | 15 ++++++
 .../ons/sample/producer/MQTimerProducer.java       | 50 ++++++++++++++++++++
 .../ons/sample/producer/SimpleMQProducer.java      | 54 ++++++++++++++++++++++
 .../ons/sample/producer/SimpleOrderProducer.java   | 52 +++++++++++++++++++++
 .../sample/producer/SimpleTransactionProducer.java | 47 +++++++++++++++++++
 pom.xml                                            |  1 +
 11 files changed, 404 insertions(+)

diff --git a/ons-sample/pom.xml b/ons-sample/pom.xml
new file mode 100644
index 0000000..71a7972
--- /dev/null
+++ b/ons-sample/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>ons-parent</artifactId>
+        <groupId>org.apache.rocketmq</groupId>
+        <version>1.8.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>ons-sample</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>ons-api</artifactId>
+            <version>1.8.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>ons-client</artifactId>
+            <version>1.8.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
new file mode 100644
index 0000000..17937d4
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample;
+
+public class MQConfig {
+    /**
+     * RocketMQ config
+     */
+    public static final String TOPIC = "xxxx";
+    public static final String GROUP_ID = "GID-xxxx";
+    public static final String ORDER_TOPIC = "xxxx";
+    public static final String ORDER_GROUP_ID = "GID-xxxx";
+    public static final String ACCESS_KEY = "xxxx";
+    public static final String SECRET_KEY = "xxxxxxxxxxx";
+    public static final String TAG = "*";
+
+    /**
+     * NAMESRV_ADDR
+     */
+    public static final String NAMESRV_ADDR = "xxxxxx";
+
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
new file mode 100644
index 0000000..f51d16f
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample.consumer;
+
+import java.util.Date;
+import org.apache.rocketmq.ons.api.Action;
+import org.apache.rocketmq.ons.api.ConsumeContext;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.MessageListener;
+
+public class MessageListenerImpl implements MessageListener {
+    @Override
+    public Action consume(Message message, ConsumeContext consumeContext) {
+        System.out.println(new Date() + " Receive message, Topic is:" + message.getTopic() + ", MsgId is:" + message.getMsgID());
+        return Action.CommitMessage;
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
new file mode 100644
index 0000000..4c4f58b
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample.consumer;
+
+
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Consumer;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.sample.MQConfig;
+
+public class SimpleMQConsumer {
+
+    public static void main(String[] args) {
+        Properties consumerProperties = new Properties();
+        consumerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
+        consumerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
+        consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
+        consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+        Consumer consumer = ONSFactory.createConsumer(consumerProperties);
+        consumer.subscribe(MQConfig.TOPIC, MQConfig.TAG, new MessageListenerImpl());
+        consumer.start();
+        System.out.println("Consumer start success.");
+
+        //等待固定时间防止进程退出
+        try {
+            Thread.sleep(200000);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
new file mode 100644
index 0000000..ea5159f
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample.consumer;
+
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.order.ConsumeOrderContext;
+import org.apache.rocketmq.ons.api.order.MessageOrderListener;
+import org.apache.rocketmq.ons.api.order.OrderAction;
+import org.apache.rocketmq.ons.api.order.OrderConsumer;
+import org.apache.rocketmq.ons.sample.MQConfig;
+
+public class SimpleOrderConsumer {
+
+    public static void main(String[] args) {
+        Properties consumerProperties = new Properties();
+        consumerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.ORDER_GROUP_ID);
+        consumerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
+        consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
+        consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+        OrderConsumer consumer = ONSFactory.createOrderedConsumer(consumerProperties);
+        consumer.subscribe(MQConfig.ORDER_TOPIC, MQConfig.TAG,  new MessageOrderListener() {
+
+            @Override
+            public OrderAction consume(final Message message, final ConsumeOrderContext context) {
+                System.out.println(message);
+                return OrderAction.Success;
+            }
+        });
+        consumer.start();
+        System.out.println("Consumer start success.");
+
+        try {
+            Thread.sleep(200000);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
new file mode 100644
index 0000000..32a756f
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
@@ -0,0 +1,15 @@
+package org.apache.rocketmq.ons.sample.producer;
+
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
+import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
+
+
+public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
+
+    @Override
+    public TransactionStatus check(Message msg) {
+        System.out.println("Receive transaction check back request, MsgId: " + msg.getMsgID());
+        return TransactionStatus.CommitTransaction;
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
new file mode 100644
index 0000000..1f70ad3
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample.producer;
+
+import java.util.Date;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.Producer;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.sample.MQConfig;
+
+public class MQTimerProducer {
+    public static void main(String[] args) {
+        Properties producerProperties = new Properties();
+        producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
+        producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
+        producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
+        producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+        Producer producer = ONSFactory.createProducer(producerProperties);
+        producer.start();
+        System.out.println("Producer Started");
+
+        for (int i = 0; i < 10; i++) {
+            Message message = new Message(MQConfig.TOPIC, MQConfig.TAG, "MQ send timer message test".getBytes());
+            long delayTime = 3000;
+            message.setStartDeliverTime(System.currentTimeMillis() + delayTime);
+            try {
+                SendResult sendResult = producer.send(message);
+                assert sendResult != null;
+                System.out.println(new Date() + " Send mq timer message success! Topic is: " + MQConfig.TOPIC + " msgId is: " + sendResult.getMessageId());
+            } catch (ONSClientException e) {
+                System.out.println(new Date() + " Send mq message failed. Topic is:" + MQConfig.TOPIC);
+                e.printStackTrace();
+            }
+        }
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
new file mode 100644
index 0000000..e397a00
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample.producer;
+
+
+import java.util.Date;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.Producer;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.sample.MQConfig;
+
+public class SimpleMQProducer {
+
+
+    public static void main(String[] args) {
+        Properties producerProperties = new Properties();
+        producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
+        producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
+        producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
+        producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+        Producer producer = ONSFactory.createProducer(producerProperties);
+        producer.start();
+        System.out.println("Producer Started");
+
+        for (int i = 0; i < 10; i++) {
+            Message message = new Message(MQConfig.TOPIC, MQConfig.TAG, "mq send transaction message test".getBytes());
+            try {
+                SendResult sendResult = producer.send(message);
+                assert sendResult != null;
+                System.out.println(new Date() + " Send mq message success! Topic is: " + MQConfig.TOPIC + " msgId is: " + sendResult.getMessageId());
+            } catch (ONSClientException e) {
+                System.out.println(new Date() + " Send mq message failed! Topic is: " + MQConfig.TOPIC);
+                e.printStackTrace();
+            }
+        }
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
new file mode 100644
index 0000000..550005c
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample.producer;
+
+import java.util.Date;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.order.OrderProducer;
+import org.apache.rocketmq.ons.sample.MQConfig;
+
+public class SimpleOrderProducer {
+
+    public static void main(String[] args) {
+        Properties producerProperties = new Properties();
+        producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.ORDER_GROUP_ID);
+        producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
+        producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
+        producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+        OrderProducer producer = ONSFactory.createOrderProducer(producerProperties);
+        producer.start();
+        System.out.println("Producer Started");
+
+        for (int i = 0; i < 10; i++) {
+            Message msg = new Message(MQConfig.ORDER_TOPIC, MQConfig.TAG, "MQ send order message test".getBytes());
+            String orderId = "biz_" + i % 10;
+            msg.setKey(orderId);
+            String shardingKey = String.valueOf(orderId);
+            try {
+                SendResult sendResult = producer.send(msg, shardingKey);
+                assert sendResult != null;
+                System.out.println(new Date() + " Send mq message success! Topic is: " + MQConfig.ORDER_TOPIC + " msgId is: " + sendResult.getMessageId());
+            } catch (ONSClientException e) {
+                System.out.println(new Date() + " Send mq message failed! Topic is: " + MQConfig.TOPIC);
+                e.printStackTrace();
+            }
+        }
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
new file mode 100644
index 0000000..bbb97e3
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
@@ -0,0 +1,47 @@
+package org.apache.rocketmq.ons.sample.producer;
+
+import java.util.Date;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.Message;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.transaction.LocalTransactionExecuter;
+import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
+import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
+import org.apache.rocketmq.ons.sample.MQConfig;
+
+public class SimpleTransactionProducer {
+
+    public static void main(String[] args) {
+        Properties tranProducerProperties = new Properties();
+        tranProducerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
+        tranProducerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
+        tranProducerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
+        tranProducerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+        LocalTransactionCheckerImpl localTransactionChecker = new LocalTransactionCheckerImpl();
+        TransactionProducer transactionProducer = ONSFactory.createTransactionProducer(tranProducerProperties, localTransactionChecker);
+        transactionProducer.start();
+
+        Message message = new Message(MQConfig.TOPIC, MQConfig.TAG, "MQ send transaction message test".getBytes());
+
+        for (int i = 0; i < 10; i++) {
+            try {
+                SendResult sendResult = transactionProducer.send(message, new LocalTransactionExecuter() {
+                    @Override
+                    public TransactionStatus execute(Message msg, Object arg) {
+                        System.out.println("Execute local transaction and return TransactionStatus.");
+                        return TransactionStatus.CommitTransaction;
+                    }
+                }, null);
+                assert sendResult != null;
+            } catch (ONSClientException e) {
+                System.out.println(new Date() + " Send mq message failed! Topic is:" + MQConfig.TOPIC);
+                e.printStackTrace();
+            }
+        }
+
+        System.out.println("Send transaction message success.");
+    }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9718937..59fdb13 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,6 +51,7 @@
     </properties>
     <modules>
         <module>ons-core</module>
+        <module>ons-sample</module>
     </modules>
     <build>
         <plugins>


[rocketmq-ons] 05/36: Call onException instead of throw exception when async sending

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 3f9457e265a6fdece1a3ac8147adab3396c7fd12
Author: ShannonDing <li...@163.com>
AuthorDate: Mon Jun 17 16:30:20 2019 +0800

    Call onException instead of throw exception when async sending
---
 .../org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index 6118435..921861a 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -169,7 +169,13 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
             message.setMsgID(MessageClientIDSetter.getUniqID(msgRMQ));
         } catch (Exception e) {
             LOGGER.error(String.format("Send message async Exception, %s", message), e);
-            throw checkProducerException(message.getTopic(), message.getMsgID(), e);
+            //throw checkProducerException(message.getTopic(), message.getMsgID(), e);
+            ONSClientException clientException = checkProducerException(message.getTopic(), message.getMsgID(), e);
+            OnExceptionContext context = new OnExceptionContext();
+            context.setException(clientException);
+            context.setTopic(message.getTopic());
+            context.setMessageId(message.getMsgID());
+            sendCallback.onException(context);
         }
     }
 


[rocketmq-ons] 27/36: Merge pull request #6 from duhenglucky/reduce_check

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 0523760f9b5065102089e085087627c1e9b3bb44
Merge: 4e8d8fb 422eb18
Author: dinglei <li...@163.com>
AuthorDate: Tue Aug 20 10:58:04 2019 +0800

    Merge pull request #6 from duhenglucky/reduce_check
    
    Reduce too strict check in ONS Client create process

 .../ons/api/impl/authority/SessionCredentials.java |  2 +-
 .../ons/api/impl/rocketmq/ONSClientAbstract.java   | 49 ++++++++++++----------
 2 files changed, 27 insertions(+), 24 deletions(-)


[rocketmq-ons] 35/36: fix(pom) removed unused dependency

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 866bc7a9729612f3857acd4931e3fc383c0702f4
Author: 翊名 <du...@alibaba-inc.com>
AuthorDate: Fri Nov 22 14:43:29 2019 +0800

    fix(pom) removed unused dependency
---
 pom.xml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 40f5660..27a4d0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,7 +47,6 @@
         <!-- Compiler settings properties -->
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
-        <eagleeye.core.version>1.4.8</eagleeye.core.version>
     </properties>
     <modules>
         <module>ons-core</module>


[rocketmq-ons] 23/36: Reduce too strict check in ONS Client create process

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 422eb18af4f8d735a0cb663ee004abc229443cfa
Author: duhenglucky <du...@gmail.com>
AuthorDate: Wed Jul 17 10:31:29 2019 +0800

    Reduce too strict check in ONS Client create process
---
 .../ons/api/impl/authority/SessionCredentials.java |  2 +-
 .../ons/api/impl/rocketmq/ONSClientAbstract.java   | 49 ++++++++++++----------
 2 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
index fdbac11..854c093 100644
--- a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
@@ -46,7 +46,7 @@ public class SessionCredentials {
     private String securityToken;
     private String signature;
     private String signatureMethod;
-    private ONSChannel onsChannel = ONSChannel.ALIYUN;
+    private ONSChannel onsChannel = ONSChannel.CLOUD;
 
     public SessionCredentials() {
         String keyContent = null;
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
index 2cc4d9c..74735e6 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
@@ -23,23 +23,20 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-
 import javax.annotation.Generated;
-
-import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.client.exception.MQClientException;
 import org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.namesrv.TopAddressing;
 import org.apache.rocketmq.logging.InternalLogger;
-
 import org.apache.rocketmq.ons.api.Admin;
 import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.rocketmq.ons.api.impl.util.NameAddrUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
 
 import static org.apache.rocketmq.common.UtilAll.getPid;
 
@@ -54,7 +51,7 @@ public abstract class ONSClientAbstract implements Admin {
     protected static final long WSADDR_INTERNAL_TIMEOUTMILLS =
         Long.parseLong(System.getProperty("com.aliyun.openservices.ons.addr.internal.timeoutmills", "3000"));
     protected static final long WSADDR_INTERNET_TIMEOUTMILLS =
-            Long.parseLong(System.getProperty("com.aliyun.openservices.ons.addr.internet.timeoutmills", "5000"));
+        Long.parseLong(System.getProperty("com.aliyun.openservices.ons.addr.internet.timeoutmills", "5000"));
     private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
     protected final Properties properties;
     protected final SessionCredentials sessionCredentials = new SessionCredentials();
@@ -75,11 +72,13 @@ public abstract class ONSClientAbstract implements Admin {
     public ONSClientAbstract(Properties properties) {
         this.properties = properties;
         this.sessionCredentials.updateContent(properties);
-        if (null == this.sessionCredentials.getAccessKey() || "".equals(this.sessionCredentials.getAccessKey())) {
+        if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
+            (null == this.sessionCredentials.getAccessKey() || "".equals(this.sessionCredentials.getAccessKey()))) {
             throw new ONSClientException("please set access key");
         }
 
-        if (null == this.sessionCredentials.getSecretKey() || "".equals(this.sessionCredentials.getSecretKey())) {
+        if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
+            (null == this.sessionCredentials.getSecretKey() || "".equals(this.sessionCredentials.getSecretKey()))) {
             throw new ONSClientException("please set secret key");
         }
 
@@ -87,12 +86,13 @@ public abstract class ONSClientAbstract implements Admin {
             throw new ONSClientException("please set ons channel");
         }
 
-
-
         this.nameServerAddr = getNameSrvAddrFromProperties();
         if (nameServerAddr != null) {
             return;
         }
+        if (nameServerAddr == null && !this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN)) {
+            return;
+        }
         this.nameServerAddr = fetchNameServerAddr();
         if (null == nameServerAddr) {
             throw new ONSClientException(FAQ.errorMessage("Can not find name server, May be your network problem.", FAQ.FIND_NS_FAILED));
@@ -131,7 +131,6 @@ public abstract class ONSClientAbstract implements Admin {
     private String fetchNameServerAddr() {
         String nsAddrs;
 
-
         {
             String property = this.properties.getProperty(PropertyKeyConst.ONSAddr);
             if (property != null) {
@@ -145,7 +144,6 @@ public abstract class ONSClientAbstract implements Admin {
             }
         }
 
-
         {
             TopAddressing top = new TopAddressing(WSADDR_INTERNAL);
             nsAddrs = top.fetchNSAddr(false, WSADDR_INTERNAL_TIMEOUTMILLS);
@@ -155,7 +153,6 @@ public abstract class ONSClientAbstract implements Admin {
             }
         }
 
-
         {
             TopAddressing top = new TopAddressing(WSADDR_INTERNET);
             nsAddrs = top.fetchNSAddr(false, WSADDR_INTERNET_TIMEOUTMILLS);
@@ -172,16 +169,21 @@ public abstract class ONSClientAbstract implements Admin {
     }
 
     protected String buildIntanceName() {
-        return Integer.toString(UtilAll.getPid())
-            + "#" + this.nameServerAddr.hashCode()
-            + "#" + this.sessionCredentials.getAccessKey().hashCode()
-            + "#" + System.nanoTime();
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append(Integer.toString(UtilAll.getPid())).append("#");
+        if (this.nameServerAddr != null) {
+            stringBuilder.append(this.nameServerAddr.hashCode()).append("#");
+        }
+        if (this.sessionCredentials.getAccessKey() != null) {
+            stringBuilder.append(this.sessionCredentials.getAccessKey().hashCode()).append("#");
+        }
+        stringBuilder.append(System.nanoTime());
+        return stringBuilder.toString();
     }
 
     protected String getNamespace() {
         String namespace = null;
 
-
         {
             String nameserverAddr = this.properties.getProperty(PropertyKeyConst.NAMESRV_ADDR);
             if (StringUtils.isNotEmpty(nameserverAddr)) {
@@ -192,7 +194,6 @@ public abstract class ONSClientAbstract implements Admin {
             }
         }
 
-
         {
             String namespaceFromProperty = this.properties.getProperty(PropertyKeyConst.INSTANCE_ID, null);
             if (StringUtils.isNotEmpty(namespaceFromProperty)) {
@@ -236,13 +237,15 @@ public abstract class ONSClientAbstract implements Admin {
 
     @Override
     public void updateCredential(Properties credentialProperties) {
-        if (null == credentialProperties.getProperty(SessionCredentials.AccessKey)
-                || "".equals(credentialProperties.getProperty(SessionCredentials.AccessKey))) {
+        if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
+            (null == credentialProperties.getProperty(SessionCredentials.AccessKey)
+                || "".equals(credentialProperties.getProperty(SessionCredentials.AccessKey)))) {
             throw new ONSClientException("update credential failed. please set access key.");
         }
 
-        if (null == credentialProperties.getProperty(SessionCredentials.SecretKey)
-                || "".equals(credentialProperties.getProperty(SessionCredentials.SecretKey))) {
+        if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
+            (null == credentialProperties.getProperty(SessionCredentials.SecretKey)
+                || "".equals(credentialProperties.getProperty(SessionCredentials.SecretKey)))) {
             throw new ONSClientException("update credential failed. please set secret key");
         }
         this.sessionCredentials.updateContent(credentialProperties);


[rocketmq-ons] 10/36: Add error log for async send failed

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 64fd96ef65885dc13246f0f702ed49dfe1fa4a1b
Author: ShannonDing <li...@163.com>
AuthorDate: Tue Jun 18 11:10:00 2019 +0800

    Add error log for async send failed
---
 .../java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index ecb5221..cfbe212 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -199,6 +199,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
             public void onException(Throwable e) {
                 //String topic = new String(message.getTopic());
                 //String msgId = new String(message.getMsgID());
+                LOGGER.error(String.format("Send message async Exception, %s", message), e);
                 ONSClientException onsEx = checkProducerException(message.getTopic(), message.getMsgID(), e);
                 OnExceptionContext context = new OnExceptionContext();
                 context.setTopic(message.getTopic());


[rocketmq-ons] 32/36: feat(spring) add spring bean support

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit efcc721462d78a6ce3633d1e0a4869c4111b429a
Author: 翊名 <du...@alibaba-inc.com>
AuthorDate: Tue Nov 19 20:17:30 2019 +0800

    feat(spring) add spring bean support
---
 .../rocketmq/ons/api/bean/BatchConsumerBean.java   | 130 ++++++++++++++++
 .../apache/rocketmq/ons/api/bean/ConsumerBean.java | 173 +++++++++++++++++++++
 .../rocketmq/ons/api/bean/OrderConsumerBean.java   | 131 ++++++++++++++++
 .../rocketmq/ons/api/bean/OrderProducerBean.java   |  93 +++++++++++
 .../apache/rocketmq/ons/api/bean/ProducerBean.java | 108 +++++++++++++
 .../ons/api/bean/TransactionProducerBean.java      | 111 +++++++++++++
 .../org/apache/rocketmq/ons/sample/MQConfig.java   |   2 +-
 .../ons/sample/consumer/SimpleMQConsumer.java      |  14 +-
 .../ons/sample/consumer/SimpleOrderConsumer.java   |  16 +-
 .../ons/sample/producer/MQTimerProducer.java       |  13 +-
 .../ons/sample/producer/SimpleMQProducer.java      |  23 ++-
 .../ons/sample/producer/SimpleOrderProducer.java   |  17 +-
 .../sample/producer/SimpleTransactionProducer.java |  16 +-
 13 files changed, 826 insertions(+), 21 deletions(-)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java
new file mode 100644
index 0000000..34017fe
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.bean;
+
+import io.openmessaging.api.batch.BatchConsumer;
+import io.openmessaging.api.batch.BatchMessageListener;
+import io.openmessaging.api.bean.Subscription;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+/**
+ * {@code BatchConsumerBean} Used to integrate {@link BatchConsumer} into Spring.
+ */
+public class BatchConsumerBean implements BatchConsumer {
+    /**
+     * Need to inject this field, specify the properties of the construct {@code BatchConsumer} instance, see the
+     * specific supported properties{@link PropertyKeyConst}
+     *
+     * @see BatchConsumerBean#setProperties(Properties)
+     */
+    private Properties properties;
+
+    /**
+     * By injecting this field, complete the Topic subscription when starting {@code BatchConsumer}
+     *
+     * @see BatchConsumerBean#setSubscriptionTable(Map)
+     */
+    private Map<Subscription, BatchMessageListener> subscriptionTable;
+
+    private BatchConsumer batchConsumer;
+
+    @Override
+    public boolean isStarted() {
+        return this.batchConsumer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.batchConsumer.isClosed();
+    }
+
+    /**
+     * Start the {@code BatchConsumer} instance, it is recommended to configure the init-method of the bean.
+     */
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        if (null == this.subscriptionTable) {
+            throw new ONSClientException("subscriptionTable not set");
+        }
+
+        this.batchConsumer = ONSFactory.createBatchConsumer(this.properties);
+
+        for (final Map.Entry<Subscription, BatchMessageListener> next : this.subscriptionTable.entrySet()) {
+            this.subscribe(next.getKey().getTopic(), next.getKey().getExpression(), next.getValue());
+        }
+
+        this.batchConsumer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.batchConsumer != null) {
+            this.batchConsumer.updateCredential(credentialProperties);
+        }
+    }
+
+    /**
+     * Close the {@code BatchConsumer} instance, it is recommended to configure the destroy-method of the bean.
+     */
+    @Override
+    public void shutdown() {
+        if (this.batchConsumer != null) {
+            this.batchConsumer.shutdown();
+        }
+    }
+
+    @Override
+    public void subscribe(final String topic, final String subExpression, final BatchMessageListener listener) {
+        if (null == this.batchConsumer) {
+            throw new ONSClientException("subscribe must be called after BatchConsumerBean started");
+        }
+        this.batchConsumer.subscribe(topic, subExpression, listener);
+    }
+
+    @Override
+    public void unsubscribe(final String topic) {
+        if (null == this.batchConsumer) {
+            throw new ONSClientException("unsubscribe must be called after BatchConsumerBean started");
+        }
+        this.batchConsumer.unsubscribe(topic);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(final Properties properties) {
+        this.properties = properties;
+    }
+
+    public Map<Subscription, BatchMessageListener> getSubscriptionTable() {
+        return subscriptionTable;
+    }
+
+    public void setSubscriptionTable(
+        final Map<Subscription, BatchMessageListener> subscriptionTable) {
+        this.subscriptionTable = subscriptionTable;
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java
new file mode 100644
index 0000000..1555be9
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.bean;
+
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.ExpressionType;
+import io.openmessaging.api.MessageListener;
+import io.openmessaging.api.MessageSelector;
+import io.openmessaging.api.bean.Subscription;
+import io.openmessaging.api.bean.SubscriptionExt;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+/**
+ * {@code ConsumerBean} is used to integrate {@link Consumer} into Spring Bean
+ */
+public class ConsumerBean implements Consumer {
+    /**
+     * You need to inject this field to specify the properties of the {@code Consumer} instance. For details, see {@link
+     * PropertyKeyConst}.
+     *
+     * @see ConsumerBean#setProperties(Properties)
+     */
+    private Properties properties;
+
+    /**
+     * By injecting this field, complete the Topic subscription when launching {@code Consumer}
+     *
+     * @see ConsumerBean#setSubscriptionTable(Map)
+     */
+    private Map<Subscription, MessageListener> subscriptionTable;
+
+    private Consumer consumer;
+
+    /**
+     * Start the {@code Consumer} instance, it is recommended to configure the init-method of the bean.
+     */
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        if (null == this.subscriptionTable) {
+            throw new ONSClientException("subscriptionTable not set");
+        }
+
+        this.consumer = ONSFactory.createConsumer(this.properties);
+
+        Iterator<Entry<Subscription, MessageListener>> it = this.subscriptionTable.entrySet().iterator();
+        while (it.hasNext()) {
+            Entry<Subscription, MessageListener> next = it.next();
+            if ("com.aliyun.openservices.ons.api.impl.notify.ConsumerImpl".equals(this.consumer.getClass().getCanonicalName())
+                && (next.getKey() instanceof SubscriptionExt)) {
+                SubscriptionExt subscription = (SubscriptionExt) next.getKey();
+                for (Method method : this.consumer.getClass().getMethods()) {
+                    if ("subscribeNotify".equals(method.getName())) {
+                        try {
+                            method.invoke(consumer, subscription.getTopic(), subscription.getExpression(),
+                                subscription.isPersistence(), next.getValue());
+                        } catch (Exception e) {
+                            throw new ONSClientException("subscribeNotify invoke exception", e);
+                        }
+                        break;
+                    }
+                }
+
+            } else {
+                Subscription subscription = next.getKey();
+                if (subscription.getType() == null || ExpressionType.TAG.name().equals(subscription.getType())) {
+
+                    this.subscribe(subscription.getTopic(), subscription.getExpression(), next.getValue());
+
+                } else if (ExpressionType.SQL92.name().equals(subscription.getType())) {
+
+                    this.subscribe(subscription.getTopic(), MessageSelector.bySql(subscription.getExpression()), next.getValue());
+                } else {
+
+                    throw new ONSClientException(String.format("Expression type %s is unknown!", subscription.getType()));
+                }
+            }
+
+        }
+
+        this.consumer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.consumer != null) {
+            this.consumer.updateCredential(credentialProperties);
+        }
+    }
+
+    /**
+     * Close the {@code Consumer} instance, it is recommended to configure the destroy-method of the bean.
+     */
+    @Override
+    public void shutdown() {
+        if (this.consumer != null) {
+            this.consumer.shutdown();
+        }
+    }
+
+    @Override
+    public void subscribe(String topic, String subExpression, MessageListener listener) {
+        if (null == this.consumer) {
+            throw new ONSClientException("subscribe must be called after consumerBean started");
+        }
+        this.consumer.subscribe(topic, subExpression, listener);
+    }
+
+    @Override
+    public void subscribe(final String topic, final MessageSelector selector, final MessageListener listener) {
+        if (null == this.consumer) {
+            throw new ONSClientException("subscribe must be called after consumerBean started");
+        }
+        this.consumer.subscribe(topic, selector, listener);
+    }
+
+    @Override
+    public void unsubscribe(String topic) {
+        if (null == this.consumer) {
+            throw new ONSClientException("unsubscribe must be called after consumerBean started");
+        }
+        this.consumer.unsubscribe(topic);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    public Map<Subscription, MessageListener> getSubscriptionTable() {
+        return subscriptionTable;
+    }
+
+    public void setSubscriptionTable(Map<Subscription, MessageListener> subscriptionTable) {
+        this.subscriptionTable = subscriptionTable;
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.consumer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.consumer.isClosed();
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java
new file mode 100644
index 0000000..dda41e6
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.bean;
+
+import io.openmessaging.api.MessageSelector;
+import io.openmessaging.api.bean.Subscription;
+import io.openmessaging.api.order.MessageOrderListener;
+import io.openmessaging.api.order.OrderConsumer;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+/**
+ * {@code OrderConsumerBean} is used to integrate {@link OrderConsumer} into Spring Bean
+ */
+public class OrderConsumerBean implements OrderConsumer {
+    /**
+     * Need to inject this field, specify the properties of the construct {@code OrderConsumer} instance, the specific
+     * supported properties are detailed in {@link PropertyKeyConst}
+     *
+     * @see OrderConsumerBean#setProperties(Properties)
+     */
+    private Properties properties;
+
+    /**
+     * By injecting this field, complete the subscription for Topic when launching {@code OrderConsumer}
+     *
+     * @see OrderConsumerBean#setSubscriptionTable(Map)
+     */
+    private Map<Subscription, MessageOrderListener> subscriptionTable;
+
+    private OrderConsumer orderConsumer;
+
+    @Override
+    public boolean isStarted() {
+        return this.orderConsumer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.orderConsumer.isClosed();
+    }
+
+    /**
+     * Start the {@code OrderConsumer} instance, it is recommended to configure the init-method of the bean.
+     */
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        if (null == this.subscriptionTable) {
+            throw new ONSClientException("subscriptionTable not set");
+        }
+
+        this.orderConsumer = ONSFactory.createOrderedConsumer(this.properties);
+
+        for (final Map.Entry<Subscription, MessageOrderListener> next : this.subscriptionTable.entrySet()) {
+            this.subscribe(next.getKey().getTopic(), next.getKey().getExpression(), next.getValue());
+        }
+
+        this.orderConsumer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.orderConsumer != null) {
+            this.orderConsumer.updateCredential(credentialProperties);
+        }
+    }
+
+    /**
+     * Close the {@code OrderConsumer} instance, it is recommended to configure the destroy-method of the bean.
+     */
+    @Override
+    public void shutdown() {
+        if (this.orderConsumer != null) {
+            this.orderConsumer.shutdown();
+        }
+    }
+
+    @Override
+    public void subscribe(final String topic, final String subExpression, final MessageOrderListener listener) {
+        if (null == this.orderConsumer) {
+            throw new ONSClientException("subscribe must be called after OrderConsumerBean started");
+        }
+        this.orderConsumer.subscribe(topic, subExpression, listener);
+    }
+
+    @Override
+    public void subscribe(String topic, MessageSelector selector, MessageOrderListener listener) {
+        if (null == this.orderConsumer) {
+            throw new ONSClientException("subscribe must be called after OrderConsumerBean started");
+        }
+        this.orderConsumer.subscribe(topic, selector, listener);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(final Properties properties) {
+        this.properties = properties;
+    }
+
+    public Map<Subscription, MessageOrderListener> getSubscriptionTable() {
+        return subscriptionTable;
+    }
+
+    public void setSubscriptionTable(
+        final Map<Subscription, MessageOrderListener> subscriptionTable) {
+        this.subscriptionTable = subscriptionTable;
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java
new file mode 100644
index 0000000..8f57487
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.bean;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.order.OrderProducer;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+/**
+ * {@code OrderProducerBean} is used to integrate {@link OrderProducer} into Spring Bean.
+ */
+public class OrderProducerBean implements OrderProducer {
+    /**
+     * Need to inject this field, specify the properties of the construct {@code OrderProducer} instance, the specific
+     * supported properties are detailed in {@link PropertyKeyConst}
+     *
+     * @see OrderProducerBean#setProperties(Properties)
+     */
+    private Properties properties;
+
+    private OrderProducer orderProducer;
+
+    /**
+     * Start the {@code OrderProducer} instance, it is recommended to configure the init-method of the bean.
+     */
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        this.orderProducer = ONSFactory.createOrderProducer(this.properties);
+        this.orderProducer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.orderProducer != null) {
+            this.orderProducer.updateCredential(credentialProperties);
+        }
+    }
+
+    /**
+     * Close the {@code OrderProducer} instance, it is recommended to configure the destroy-method of the bean.
+     */
+    @Override
+    public void shutdown() {
+        if (this.orderProducer != null) {
+            this.orderProducer.shutdown();
+        }
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.orderProducer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.orderProducer.isClosed();
+    }
+
+    @Override
+    public SendResult send(final Message message, final String shardingKey) {
+        return this.orderProducer.send(message, shardingKey);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(final Properties properties) {
+        this.properties = properties;
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java
new file mode 100644
index 0000000..26d9922
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.bean;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.SendCallback;
+import io.openmessaging.api.SendResult;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+/**
+ * {@code ProducerBean} for integrating {@link Producer} into Spring Bean
+ */
+public class ProducerBean implements Producer {
+    /**
+     * You need to inject this field to specify the properties of the {@code Producer} instance. For details, see {@link
+     * PropertyKeyConst}
+     *
+     * @see ProducerBean#setProperties(Properties)
+     */
+    private Properties properties;
+    private Producer producer;
+
+    /**
+     * Start the {@code Producer} instance, it is recommended to configure the init-method of the bean.
+     */
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        this.producer = ONSFactory.createProducer(this.properties);
+        this.producer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.producer != null) {
+            this.producer.updateCredential(credentialProperties);
+        }
+    }
+
+    /**
+     * Close the {@code Producer} instance, it is recommended to configure the destroy-method of the bean
+     */
+    @Override
+    public void shutdown() {
+        if (this.producer != null) {
+            this.producer.shutdown();
+        }
+    }
+
+    @Override
+    public SendResult send(Message message) {
+        return this.producer.send(message);
+    }
+
+    @Override
+    public void sendOneway(Message message) {
+        this.producer.sendOneway(message);
+    }
+
+    @Override
+    public void sendAsync(Message message, SendCallback sendCallback) {
+        this.producer.sendAsync(message, sendCallback);
+    }
+
+    @Override
+    public void setCallbackExecutor(final ExecutorService callbackExecutor) {
+        this.producer.setCallbackExecutor(callbackExecutor);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.producer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.producer.isClosed();
+    }
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java
new file mode 100644
index 0000000..c39e732
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.bean;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.transaction.LocalTransactionChecker;
+import io.openmessaging.api.transaction.LocalTransactionExecuter;
+import io.openmessaging.api.transaction.TransactionProducer;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
+/**
+ * {@code TransactionProducerBean} is used to integrate {@link TransactionProducer} into Spring Bean
+ */
+public class TransactionProducerBean implements TransactionProducer {
+    /**
+     * Need to inject this field, specify the properties of the construct {@code TransactionProducer} instance, the
+     * specific supported properties are detailed in {@link PropertyKeyConst}
+     *
+     * @see TransactionProducerBean#setProperties(Properties)
+     */
+    private Properties properties;
+
+    /**
+     * Need to inject this field, {@code TransactionProducer} will send the transaction message will rely on the object
+     * for transaction status checkback
+     *
+     * @see TransactionProducerBean#setLocalTransactionChecker(LocalTransactionChecker)
+     */
+    private LocalTransactionChecker localTransactionChecker;
+
+    private TransactionProducer transactionProducer;
+
+    /**
+     *
+     */
+    @Override
+    public void start() {
+        if (null == this.properties) {
+            throw new ONSClientException("properties not set");
+        }
+
+        this.transactionProducer = ONSFactory.createTransactionProducer(properties, localTransactionChecker);
+        this.transactionProducer.start();
+    }
+
+    @Override
+    public void updateCredential(Properties credentialProperties) {
+        if (this.transactionProducer != null) {
+            this.transactionProducer.updateCredential(credentialProperties);
+        }
+    }
+
+    /**
+     * Close the {@code TransactionProducer} instance, it is recommended to configure the destroy-method of the bean.
+     */
+    @Override
+    public void shutdown() {
+        if (this.transactionProducer != null) {
+            this.transactionProducer.shutdown();
+        }
+    }
+
+    @Override
+    public SendResult send(Message message, LocalTransactionExecuter executer, Object arg) {
+        return this.transactionProducer.send(message, executer, arg);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    public LocalTransactionChecker getLocalTransactionChecker() {
+        return localTransactionChecker;
+    }
+
+    public void setLocalTransactionChecker(LocalTransactionChecker localTransactionChecker) {
+        this.localTransactionChecker = localTransactionChecker;
+    }
+
+    @Override
+    public boolean isStarted() {
+        return this.transactionProducer.isStarted();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return this.transactionProducer.isClosed();
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
index 8a59dc3..c8d300e 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
@@ -31,6 +31,6 @@ public class MQConfig {
     /**
      * NAMESRV_ADDR
      */
-    public static final String NAMESRV_ADDR = "47.107.167.190:9876";
+    public static final String NAMESRV_ADDR = "127.0.0.1:9876";
 
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
index 34fe915..51f558b 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
@@ -27,14 +27,23 @@ import org.apache.rocketmq.ons.sample.MQConfig;
 public class SimpleMQConsumer {
 
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://127.0.0.1:9876");
 
         Properties consumerProperties = new Properties();
         consumerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         consumerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
-        consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+
         Consumer consumer = messagingAccessPoint.createConsumer(consumerProperties);
+        /*
+         * Alternatively, you can use the ONSFactory to create instance directly.
+         * <pre>
+         * {@code
+         * consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+         * OrderConsumer consumer  = ONSFactory.createOrderedConsumer(consumerProperties);
+         * }
+         * </pre>
+         */
         consumer.subscribe(MQConfig.TOPIC, MQConfig.TAG, new MessageListenerImpl());
         consumer.start();
         System.out.printf("Consumer start success. %n");
@@ -44,5 +53,6 @@ public class SimpleMQConsumer {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        consumer.shutdown();
     }
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
index d3aaa07..d991474 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
-
 import io.openmessaging.api.Message;
 import io.openmessaging.api.MessagingAccessPoint;
 import io.openmessaging.api.OMS;
@@ -31,13 +30,23 @@ import org.apache.rocketmq.ons.sample.MQConfig;
 public class SimpleOrderConsumer {
 
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://127.0.0.1:9876");
         Properties consumerProperties = new Properties();
         consumerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.ORDER_GROUP_ID);
         consumerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
-        consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         OrderConsumer consumer = messagingAccessPoint.createOrderedConsumer(consumerProperties);
+
+        /*
+         * Alternatively, you can use the ONSFactory to create instance directly.
+         * <pre>
+         * {@code
+         * consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+         * OrderConsumer consumer  = ONSFactory.createOrderedConsumer(consumerProperties);
+         * }
+         * </pre>
+         */
+
         consumer.subscribe(MQConfig.ORDER_TOPIC, MQConfig.TAG, new MessageOrderListener() {
 
             @Override
@@ -54,5 +63,6 @@ public class SimpleOrderConsumer {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        consumer.shutdown();
     }
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
index 7cc5682..fcf7554 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
@@ -29,13 +29,24 @@ import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class MQTimerProducer {
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://47.107.167.190:9876");
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://127.0.0.1:9876");
 
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         Producer producer = messagingAccessPoint.createProducer(producerProperties);
+
+        /*
+         * Alternatively, you can use the ONSFactory to create instance directly.
+         * <pre>
+         * {@code
+         * producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+         * OrderProducer producer = ONSFactory.createOrderProducer(producerProperties);
+         * }
+         * </pre>
+         */
+
         producer.start();
         System.out.printf("Producer Started. %n");
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
index 2b53968..5bb7f9e 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
@@ -17,30 +17,37 @@
 package org.apache.rocketmq.ons.sample.producer;
 
 import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
 import io.openmessaging.api.Producer;
 import io.openmessaging.api.SendResult;
 import io.openmessaging.api.exception.OMSRuntimeException;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.ONSFactory;
 import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
-
 //    io.openmessaging.api.xxx => com.aliyun.openservices.ons.api.xxxx
 
-
-
 public class SimpleMQProducer {
 
-
     public static void main(String[] args) {
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://127.0.0.1:9876");
 
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
-        producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
-        Producer producer = ONSFactory.createProducer(producerProperties);
+
+        Producer producer = messagingAccessPoint.createProducer(producerProperties);
+        /*
+         * Alternatively, you can use the ONSFactory to create instance directly.
+         * <pre>
+         * {@code
+         * producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+         * Producer producer = ONSFactory.createProducer(producerProperties);
+         * }
+         * </pre>
+         */
 
         producer.start();
         System.out.printf("Producer Started %n");
@@ -56,5 +63,7 @@ public class SimpleMQProducer {
                 e.printStackTrace();
             }
         }
+
+        producer.shutdown();
     }
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
index 2d49a48..a454297 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-
 import io.openmessaging.api.Message;
 import io.openmessaging.api.MessagingAccessPoint;
 import io.openmessaging.api.OMS;
@@ -30,14 +29,25 @@ import org.apache.rocketmq.ons.sample.MQConfig;
 public class SimpleOrderProducer {
 
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@47.107.167.190/us-east");
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://127.0.0.1:9876");
 
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.ORDER_GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
-        producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         OrderProducer producer = messagingAccessPoint.createOrderProducer(producerProperties);
+
+
+        /*
+         * Alternatively, you can use the ONSFactory to create instance directly.
+         * <pre>
+         * {@code
+         * producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+         * OrderProducer producer = ONSFactory.createOrderProducer(producerProperties);
+         * }
+         * </pre>
+         */
+
         producer.start();
         System.out.printf("Producer Started. %n");
 
@@ -55,5 +65,6 @@ public class SimpleOrderProducer {
                 e.printStackTrace();
             }
         }
+        producer.shutdown();
     }
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
index e5834f7..44da502 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
@@ -16,12 +16,10 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-
 import io.openmessaging.api.Message;
 import io.openmessaging.api.MessagingAccessPoint;
 import io.openmessaging.api.OMS;
 import io.openmessaging.api.SendResult;
-import io.openmessaging.api.exception.OMSRuntimeException;
 import io.openmessaging.api.transaction.LocalTransactionExecuter;
 import io.openmessaging.api.transaction.TransactionProducer;
 import io.openmessaging.api.transaction.TransactionStatus;
@@ -34,15 +32,25 @@ import org.apache.rocketmq.ons.sample.MQConfig;
 public class SimpleTransactionProducer {
 
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://127.0.0.1:9876");
 
         Properties tranProducerProperties = new Properties();
         tranProducerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         tranProducerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         tranProducerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
-        tranProducerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         LocalTransactionCheckerImpl localTransactionChecker = new LocalTransactionCheckerImpl();
         TransactionProducer transactionProducer = messagingAccessPoint.createTransactionProducer(tranProducerProperties, localTransactionChecker);
+
+        /*
+         * Alternatively, you can use the ONSFactory to create instance directly.
+         * <pre>
+         * {@code
+         * producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+         * TransactionProducer producer = ONSFactory.createTransactionProducer(tranProducerProperties, localTransactionChecker);
+         * }
+         * </pre>
+         */
+
         transactionProducer.start();
 
         Message message = new Message(MQConfig.TOPIC, MQConfig.TAG, "MQ send transaction message test".getBytes());


[rocketmq-ons] 21/36: [maven-release-plugin] prepare release ons-parent-1.0.0

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 7c24199ff24252334f1bdffbf3e7f83ffa11070b
Author: duhenglucky <du...@gmail.com>
AuthorDate: Fri Jul 12 11:08:24 2019 +0800

    [maven-release-plugin] prepare release ons-parent-1.0.0
---
 ons-core/ons-api/pom.xml         |  2 +-
 ons-core/ons-auth4client/pom.xml |  2 +-
 ons-core/ons-client/pom.xml      |  2 +-
 ons-core/ons-trace-core/pom.xml  |  2 +-
 ons-core/pom.xml                 |  2 +-
 ons-sample/pom.xml               | 10 ++++------
 pom.xml                          |  4 ++--
 7 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/ons-core/ons-api/pom.xml b/ons-core/ons-api/pom.xml
index 374e460..95ba4c4 100644
--- a/ons-core/ons-api/pom.xml
+++ b/ons-core/ons-api/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-all</artifactId>
-        <version>1.8.1-SNAPSHOT</version>
+        <version>1.0.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>
diff --git a/ons-core/ons-auth4client/pom.xml b/ons-core/ons-auth4client/pom.xml
index 643f7c7..2c6db2a 100644
--- a/ons-core/ons-auth4client/pom.xml
+++ b/ons-core/ons-auth4client/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <artifactId>ons-all</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.8.1-SNAPSHOT</version>
+        <version>1.0.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>ons-auth4client</artifactId>
diff --git a/ons-core/ons-client/pom.xml b/ons-core/ons-client/pom.xml
index 7cc5df2..0840795 100644
--- a/ons-core/ons-client/pom.xml
+++ b/ons-core/ons-client/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-all</artifactId>
-        <version>1.8.1-SNAPSHOT</version>
+        <version>1.0.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>
diff --git a/ons-core/ons-trace-core/pom.xml b/ons-core/ons-trace-core/pom.xml
index 4ba3f7d..48f872d 100644
--- a/ons-core/ons-trace-core/pom.xml
+++ b/ons-core/ons-trace-core/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>ons-all</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.8.1-SNAPSHOT</version>
+        <version>1.0.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>ons-trace-core</artifactId>
diff --git a/ons-core/pom.xml b/ons-core/pom.xml
index edadb69..bfb2dc4 100644
--- a/ons-core/pom.xml
+++ b/ons-core/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-parent</artifactId>
-        <version>1.8.1-SNAPSHOT</version>
+        <version>1.0.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <inceptionYear>2012</inceptionYear>
diff --git a/ons-sample/pom.xml b/ons-sample/pom.xml
index 8f52602..bedea83 100644
--- a/ons-sample/pom.xml
+++ b/ons-sample/pom.xml
@@ -15,13 +15,11 @@
   limitations under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <artifactId>ons-parent</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.8.1-SNAPSHOT</version>
+        <version>1.0.0</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -33,12 +31,12 @@
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
             <artifactId>ons-api</artifactId>
-            <version>1.8.1-SNAPSHOT</version>
+            <version>1.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
             <artifactId>ons-client</artifactId>
-            <version>1.8.1-SNAPSHOT</version>
+            <version>1.0.0</version>
         </dependency>
     </dependencies>
 
diff --git a/pom.xml b/pom.xml
index 9317ccd..803a101 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.rocketmq</groupId>
     <artifactId>ons-parent</artifactId>
-    <version>1.8.1-SNAPSHOT</version>
+    <version>1.0.0</version>
     <packaging>pom</packaging>
     <name>ons-parent ${project.version}</name>
     <description>
@@ -274,6 +274,6 @@
         <url>git@github.com:apache/rocketmq-ons.git</url>
         <connection>scm:git:git@github.com:apache/rocketmq-ons.git</connection>
         <developerConnection>scm:git:git@github.com:apache/rocketmq-ons.git</developerConnection>
-        <tag>HEAD</tag>
+        <tag>ons-parent-1.0.0</tag>
     </scm>
 </project>


[rocketmq-ons] 03/36: Remove unnecessary file

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit e28b1a94ee962570eb03f6e9552012ee32b37782
Author: duhenglucky <du...@gmail.com>
AuthorDate: Fri Jun 14 22:53:43 2019 +0800

    Remove unnecessary file
---
 NOTICE             | 2 +-
 ons-core/README.md | 0
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/NOTICE b/NOTICE
index 703c28b..309831a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache RocketMQ
-Copyright 2016-2018 The Apache Software Foundation
+Copyright 2016-2019 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/ons-core/README.md b/ons-core/README.md
deleted file mode 100644
index e69de29..0000000


[rocketmq-ons] 15/36: Add ONS samples.

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 03e429c5e3f3d4b110741271fef96a430d6b4226
Merge: 2e94e3e b1be94d
Author: dinglei <li...@163.com>
AuthorDate: Mon Jul 1 17:47:06 2019 +0800

    Add ONS samples.
    
    Ons sample

 ons-sample/pom.xml                                 | 46 ++++++++++++++++
 .../org/apache/rocketmq/ons/sample/MQConfig.java   | 35 ++++++++++++
 .../ons/sample/consumer/MessageListenerImpl.java   | 30 +++++++++++
 .../ons/sample/consumer/SimpleMQConsumer.java      | 45 ++++++++++++++++
 .../ons/sample/consumer/SimpleOrderConsumer.java   | 54 +++++++++++++++++++
 .../producer/LocalTransactionCheckerImpl.java      | 30 +++++++++++
 .../ons/sample/producer/MQTimerProducer.java       | 53 ++++++++++++++++++
 .../ons/sample/producer/SimpleMQProducer.java      | 54 +++++++++++++++++++
 .../ons/sample/producer/SimpleOrderProducer.java   | 55 +++++++++++++++++++
 .../sample/producer/SimpleTransactionProducer.java | 62 ++++++++++++++++++++++
 pom.xml                                            |  1 +
 11 files changed, 465 insertions(+)


[rocketmq-ons] 20/36: Change scm configuration in pom file

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit a63d36b9e89000fc9e35f88ed2a82dbf8fe947d2
Author: duhenglucky <du...@gmail.com>
AuthorDate: Fri Jul 12 11:06:15 2019 +0800

    Change scm configuration in pom file
---
 pom.xml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 59fdb13..9317ccd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -271,8 +271,9 @@
         </dependencies>
     </dependencyManagement>
     <scm>
-        <url>git@gitlab.alibaba-inc.com:middleware/ons.git</url>
-        <connection>scm:git:git@gitlab.alibaba-inc.com:middleware/ons.git</connection>
-        <developerConnection>scm:git:git@gitlab.alibaba-inc.com:middleware/ons.git</developerConnection>
+        <url>git@github.com:apache/rocketmq-ons.git</url>
+        <connection>scm:git:git@github.com:apache/rocketmq-ons.git</connection>
+        <developerConnection>scm:git:git@github.com:apache/rocketmq-ons.git</developerConnection>
+        <tag>HEAD</tag>
     </scm>
 </project>


[rocketmq-ons] 17/36: Update README.md

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit bc9934af0db4fcaf3269ed67aae66c39286b6778
Author: Heng Du <du...@gmail.com>
AuthorDate: Wed Jul 3 15:00:26 2019 +0800

    Update README.md
---
 README.md | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 6ad473d..d556ce5 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,17 @@
 ## Overview
- Apache RocketMQ ONS is a RocketMQ lightweight client.
+Apache RocketMQ ONS is a RocketMQ lightweight client.      
+As a high-level client, ONS is more simple and easy to use than native clients. It shields the underlying implementation details and provides a better abstraction. It also removes admin interfaces used for resource management. Therefore, for most RocketMQ users, ONS can be used to access the RocketMQ service faster, and the code is more concise and secure.         
 
 ----------
+
+## Feature
+ - Produce messages, including normal, transactional, delayed messages, in synchronously, asynchronously and oneway model.
+ - Consume messages, in cluster or broadcast model, concurrently and orderly with push consumer
+ - Automatically rebalanced, both in producing and consuming process.
+ - Reliability, any downtime broker or name server has no impact on the client.
+
+ 
+----------
 ## Contributing
 We always welcome new contributions, whether for trivial cleanups, big new features or other material rewards, more details see [here](http://rocketmq.apache.org/docs/how-to-contribute/).
  


[rocketmq-ons] 19/36: Merge pull request #5 from duhenglucky/master

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit cedf1b8555aeb27816beef7aff7e754682458fd5
Merge: bc9934a 9cb0ab2
Author: wlliqipeng <wl...@163.com>
AuthorDate: Fri Jul 12 10:37:32 2019 +0800

    Merge pull request #5 from duhenglucky/master
    
    Optimize the sample code to make it can pass the code style check

 .../org/apache/rocketmq/ons/sample/MQConfig.java   | 19 +++++++--------
 .../ons/sample/consumer/MessageListenerImpl.java   | 22 +++++++++---------
 .../ons/sample/consumer/SimpleMQConsumer.java      | 22 +++++++++---------
 .../ons/sample/consumer/SimpleOrderConsumer.java   | 25 ++++++++++----------
 .../producer/LocalTransactionCheckerImpl.java      | 22 +++++++++---------
 .../ons/sample/producer/MQTimerProducer.java       | 26 ++++++++++-----------
 .../ons/sample/producer/SimpleMQProducer.java      | 27 +++++++++++-----------
 .../ons/sample/producer/SimpleOrderProducer.java   | 26 ++++++++++-----------
 .../sample/producer/SimpleTransactionProducer.java | 25 ++++++++++----------
 9 files changed, 108 insertions(+), 106 deletions(-)


[rocketmq-ons] 29/36: Added compatibility with not enable ACL model in server

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit b31ad6a2f597e147e2bcf6cd2bcb07d5054d34ef
Author: duhenglucky <du...@gmail.com>
AuthorDate: Tue Sep 3 17:37:05 2019 +0800

    Added compatibility with not enable ACL model in server
---
 .../apache/rocketmq/ons/api/impl/authority/SessionCredentials.java  | 2 +-
 .../org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java    | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
index 854c093..fdbac11 100644
--- a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/authority/SessionCredentials.java
@@ -46,7 +46,7 @@ public class SessionCredentials {
     private String securityToken;
     private String signature;
     private String signatureMethod;
-    private ONSChannel onsChannel = ONSChannel.CLOUD;
+    private ONSChannel onsChannel = ONSChannel.ALIYUN;
 
     public SessionCredentials() {
         String keyContent = null;
diff --git a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java
index 72e36b9..5184bd5 100644
--- a/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java
+++ b/ons-core/ons-auth4client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ClientRPCHook.java
@@ -17,9 +17,9 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import org.apache.rocketmq.remoting.protocol.RemotingCommand;
 import org.apache.rocketmq.ons.api.impl.authority.AuthUtil;
 import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
 
 import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.AccessKey;
 import static org.apache.rocketmq.ons.api.impl.authority.SessionCredentials.ONSChannelKey;
@@ -35,6 +35,9 @@ public class ClientRPCHook extends AbstractRPCHook {
 
     @Override
     public void doBeforeRequest(String remoteAddr, RemotingCommand request) {
+        if (sessionCredentials.getAccessKey() == null && sessionCredentials.getSecretKey() == null) {
+            return;
+        }
         byte[] total = AuthUtil.combineRequestContent(request,
             parseRequestContent(request, sessionCredentials.getAccessKey(),
                 sessionCredentials.getSecurityToken(), sessionCredentials.getOnsChannel().name()));
@@ -48,7 +51,6 @@ public class ClientRPCHook extends AbstractRPCHook {
         }
     }
 
-
     @Override
     public void doAfterResponse(String remoteAddr, RemotingCommand request, RemotingCommand response) {
 


[rocketmq-ons] 13/36: Modify ons-sample pom file

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit a9c9227350055988908653e564affaa68df21738
Author: duhenglucky <du...@gmail.com>
AuthorDate: Mon Jul 1 16:48:52 2019 +0800

    Modify ons-sample pom file
---
 ons-sample/pom.xml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ons-sample/pom.xml b/ons-sample/pom.xml
index 71a7972..2cebaaf 100644
--- a/ons-sample/pom.xml
+++ b/ons-sample/pom.xml
@@ -7,9 +7,12 @@
         <groupId>org.apache.rocketmq</groupId>
         <version>1.8.1-SNAPSHOT</version>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
     <artifactId>ons-sample</artifactId>
+    <name>rocketmq-ons ${project.version}</name>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.rocketmq</groupId>


[rocketmq-ons] 18/36: Remove System.out.println in sample and changed to standarded apache license

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 9cb0ab2ef356a773d4ec238c2df8104a7bb29af5
Author: duhenglucky <du...@gmail.com>
AuthorDate: Fri Jul 12 10:02:48 2019 +0800

    Remove System.out.println in sample and changed to standarded apache license
---
 .../org/apache/rocketmq/ons/sample/MQConfig.java   | 19 +++++++--------
 .../ons/sample/consumer/MessageListenerImpl.java   | 22 +++++++++---------
 .../ons/sample/consumer/SimpleMQConsumer.java      | 22 +++++++++---------
 .../ons/sample/consumer/SimpleOrderConsumer.java   | 25 ++++++++++----------
 .../producer/LocalTransactionCheckerImpl.java      | 22 +++++++++---------
 .../ons/sample/producer/MQTimerProducer.java       | 26 ++++++++++-----------
 .../ons/sample/producer/SimpleMQProducer.java      | 27 +++++++++++-----------
 .../ons/sample/producer/SimpleOrderProducer.java   | 26 ++++++++++-----------
 .../sample/producer/SimpleTransactionProducer.java | 25 ++++++++++----------
 9 files changed, 108 insertions(+), 106 deletions(-)

diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
index a7d8094..2ef0e44 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
index f8e8ec1..1205ce9 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,7 +16,6 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
-import java.util.Date;
 import org.apache.rocketmq.ons.api.Action;
 import org.apache.rocketmq.ons.api.ConsumeContext;
 import org.apache.rocketmq.ons.api.Message;
@@ -24,7 +24,7 @@ import org.apache.rocketmq.ons.api.MessageListener;
 public class MessageListenerImpl implements MessageListener {
     @Override
     public Action consume(Message message, ConsumeContext consumeContext) {
-        System.out.println(new Date() + " Receive message, Topic is:" + message.getTopic() + ", MsgId is:" + message.getMsgID());
+        System.out.printf("Receive message, Topic is: %s,  MsgId is: %s%n", message.getTopic(), message.getMsgID());
         return Action.CommitMessage;
     }
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
index 4c4f58b..df95829 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,9 +34,8 @@ public class SimpleMQConsumer {
         Consumer consumer = ONSFactory.createConsumer(consumerProperties);
         consumer.subscribe(MQConfig.TOPIC, MQConfig.TAG, new MessageListenerImpl());
         consumer.start();
-        System.out.println("Consumer start success.");
+        System.out.printf("Consumer start success. %n");
 
-        //等待固定时间防止进程退出
         try {
             Thread.sleep(200000);
         } catch (InterruptedException e) {
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
index ea5159f..b51a6a0 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,16 +35,16 @@ public class SimpleOrderConsumer {
         consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         OrderConsumer consumer = ONSFactory.createOrderedConsumer(consumerProperties);
-        consumer.subscribe(MQConfig.ORDER_TOPIC, MQConfig.TAG,  new MessageOrderListener() {
+        consumer.subscribe(MQConfig.ORDER_TOPIC, MQConfig.TAG, new MessageOrderListener() {
 
             @Override
             public OrderAction consume(final Message message, final ConsumeOrderContext context) {
-                System.out.println(message);
+                System.out.printf("Received message: %s%n", message);
                 return OrderAction.Success;
             }
         });
         consumer.start();
-        System.out.println("Consumer start success.");
+        System.out.printf("Consumer start success. %n");
 
         try {
             Thread.sleep(200000);
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
index f5dbd1a..f21db81 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,12 +20,11 @@ import org.apache.rocketmq.ons.api.Message;
 import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
 import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
 
-
 public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
 
     @Override
     public TransactionStatus check(Message msg) {
-        System.out.println("Receive transaction check back request, MsgId: " + msg.getMsgID());
+        System.out.printf("Receive transaction check back request, MsgId: %s%n", msg.getMsgID());
         return TransactionStatus.CommitTransaction;
     }
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
index 471b8bd..26a6bf2 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,7 +16,6 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import java.util.Date;
 import java.util.Properties;
 import org.apache.rocketmq.ons.api.Message;
 import org.apache.rocketmq.ons.api.ONSFactory;
@@ -34,7 +34,7 @@ public class MQTimerProducer {
         producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         Producer producer = ONSFactory.createProducer(producerProperties);
         producer.start();
-        System.out.println("Producer Started");
+        System.out.printf("Producer Started. %n");
 
         for (int i = 0; i < 10; i++) {
             Message message = new Message(MQConfig.TOPIC, MQConfig.TAG, "MQ send timer message test".getBytes());
@@ -43,9 +43,9 @@ public class MQTimerProducer {
             try {
                 SendResult sendResult = producer.send(message);
                 assert sendResult != null;
-                System.out.println(new Date() + " Send mq timer message success! Topic is: " + MQConfig.TOPIC + " msgId is: " + sendResult.getMessageId());
+                System.out.printf("Send mq timer message success! Topic is: %s msgId is: %s%n", MQConfig.TOPIC, sendResult.getMessageId());
             } catch (ONSClientException e) {
-                System.out.println(new Date() + " Send mq message failed. Topic is:" + MQConfig.TOPIC);
+                System.out.printf("Send mq message failed. Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
         }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
index e397a00..e3cb192 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,8 +16,6 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-
-import java.util.Date;
 import java.util.Properties;
 import org.apache.rocketmq.ons.api.Message;
 import org.apache.rocketmq.ons.api.ONSFactory;
@@ -37,16 +36,16 @@ public class SimpleMQProducer {
         producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         Producer producer = ONSFactory.createProducer(producerProperties);
         producer.start();
-        System.out.println("Producer Started");
+        System.out.printf("Producer Started %n");
 
         for (int i = 0; i < 10; i++) {
             Message message = new Message(MQConfig.TOPIC, MQConfig.TAG, "mq send transaction message test".getBytes());
             try {
                 SendResult sendResult = producer.send(message);
                 assert sendResult != null;
-                System.out.println(new Date() + " Send mq message success! Topic is: " + MQConfig.TOPIC + " msgId is: " + sendResult.getMessageId());
+                System.out.printf("Send mq timer message success! Topic is: %s msgId is: %s%n", MQConfig.TOPIC, sendResult.getMessageId());
             } catch (ONSClientException e) {
-                System.out.println(new Date() + " Send mq message failed! Topic is: " + MQConfig.TOPIC);
+                System.out.printf("Send mq message failed. Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
         }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
index dd0b3ae..43ab7f0 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,7 +16,6 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import java.util.Date;
 import java.util.Properties;
 import org.apache.rocketmq.ons.api.Message;
 import org.apache.rocketmq.ons.api.ONSFactory;
@@ -35,7 +35,7 @@ public class SimpleOrderProducer {
         producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         OrderProducer producer = ONSFactory.createOrderProducer(producerProperties);
         producer.start();
-        System.out.println("Producer Started");
+        System.out.printf("Producer Started. %n");
 
         for (int i = 0; i < 10; i++) {
             Message msg = new Message(MQConfig.ORDER_TOPIC, MQConfig.TAG, "MQ send order message test".getBytes());
@@ -45,9 +45,9 @@ public class SimpleOrderProducer {
             try {
                 SendResult sendResult = producer.send(msg, shardingKey);
                 assert sendResult != null;
-                System.out.println(new Date() + " Send mq message success! Topic is: " + MQConfig.ORDER_TOPIC + " msgId is: " + sendResult.getMessageId());
+                System.out.printf("Send mq timer message success! Topic is: %s msgId is: %s%n", MQConfig.TOPIC, sendResult.getMessageId());
             } catch (ONSClientException e) {
-                System.out.println(new Date() + " Send mq message failed! Topic is: " + MQConfig.TOPIC);
+                System.out.printf("Send mq message failed. Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
         }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
index 4ab6805..4d16d51 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
@@ -1,12 +1,13 @@
-/**
- * Copyright (C) 2010-2016 Alibaba Group Holding Limited
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,17 +47,17 @@ public class SimpleTransactionProducer {
                 SendResult sendResult = transactionProducer.send(message, new LocalTransactionExecuter() {
                     @Override
                     public TransactionStatus execute(Message msg, Object arg) {
-                        System.out.println("Execute local transaction and return TransactionStatus.");
+                        System.out.printf("Execute local transaction and return TransactionStatus. %n");
                         return TransactionStatus.CommitTransaction;
                     }
                 }, null);
                 assert sendResult != null;
             } catch (ONSClientException e) {
-                System.out.println(new Date() + " Send mq message failed! Topic is:" + MQConfig.TOPIC);
+                System.out.printf(new Date() + " Send mq message failed! Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
         }
 
-        System.out.println("Send transaction message success.");
+        System.out.printf("Send transaction message success. %n");
     }
 }
\ No newline at end of file


[rocketmq-ons] 33/36: feat(consumer) add pull consumer support

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit efeaebd7050d10800e463d1167a0940078df7f6a
Author: 翊名 <du...@alibaba-inc.com>
AuthorDate: Thu Nov 21 11:47:31 2019 +0800

    feat(consumer) add pull consumer support
---
 .../rocketmq/MessagingAccessPointImpl.java         |   5 +-
 .../org/apache/rocketmq/ons/api/ONSFactory.java    |  26 ++
 .../org/apache/rocketmq/ons/api/ONSFactoryAPI.java |  26 +-
 .../rocketmq/ons/api/impl/ONSFactoryImpl.java      |   7 +
 .../ons/api/impl/rocketmq/PullConsumerImpl.java    | 292 +++++++++++++++++++++
 ons-core/pom.xml                                   |   2 +-
 .../ons/sample/consumer/SimplePullConsumer.java    |  63 +++++
 .../producer/LocalTransactionCheckerImpl.java      |   2 +-
 .../sample/producer/SimpleTransactionProducer.java |   4 +-
 pom.xml                                            |   4 +-
 10 files changed, 408 insertions(+), 23 deletions(-)

diff --git a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
index bb90f64..c1b4a38 100644
--- a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
+++ b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
@@ -21,7 +21,6 @@ import io.openmessaging.api.Consumer;
 import io.openmessaging.api.Message;
 import io.openmessaging.api.MessagingAccessPoint;
 import io.openmessaging.api.OMSBuiltinKeys;
-import io.openmessaging.api.OMSResponseStatus;
 import io.openmessaging.api.Producer;
 import io.openmessaging.api.PullConsumer;
 import io.openmessaging.api.batch.BatchConsumer;
@@ -43,6 +42,7 @@ import org.apache.rocketmq.ons.api.impl.rocketmq.ONSUtil;
 import org.apache.rocketmq.ons.api.impl.rocketmq.OrderConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.OrderProducerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ProducerImpl;
+import org.apache.rocketmq.ons.api.impl.rocketmq.PullConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.TransactionProducerImpl;
 
 public class MessagingAccessPointImpl implements MessagingAccessPoint {
@@ -71,8 +71,7 @@ public class MessagingAccessPointImpl implements MessagingAccessPoint {
 
     @Override public PullConsumer createPullConsumer(Properties properties) {
         injectNameServerAddress(properties);
-        properties.put(PropertyKeyConst.NAMESRV_ADDR, this.attributes.getProperty(OMSBuiltinKeys.ACCESS_POINTS));
-        throw OMSResponseStatus.generateException(OMSResponseStatus.STATUS_1101);
+        return new PullConsumerImpl(properties);
     }
 
     @Override
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
index 847a6ae..fe2768f 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
@@ -19,6 +19,7 @@ package org.apache.rocketmq.ons.api;
 import io.openmessaging.api.Consumer;
 import io.openmessaging.api.OMS;
 import io.openmessaging.api.Producer;
+import io.openmessaging.api.PullConsumer;
 import io.openmessaging.api.batch.BatchConsumer;
 import io.openmessaging.api.order.OrderConsumer;
 import io.openmessaging.api.order.OrderProducer;
@@ -222,4 +223,29 @@ public class ONSFactory {
         return onsFactory.createOrderedConsumer(properties);
     }
 
+    /**
+     * Create Order Consumer
+     * <p>
+     * <code>properties</code>
+     * Requires:
+     * <ol>
+     * <li>{@link PropertyKeyConst#GROUP_ID}</li>
+     * <li>{@link PropertyKeyConst#AccessKey}</li>
+     * <li>{@link PropertyKeyConst#SecretKey}</li>
+     * <li>{@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * Optional:
+     * <ul>
+     * <li>{@link PropertyKeyConst#ConsumeThreadNums}</li>
+     * <li>{@link PropertyKeyConst#OnsChannel}</li>
+     * </ul>
+     * </p>
+     *
+     * @param properties Consumer's configuration
+     * @return {@code PullConsumer} Thread safe {@link PullConsumer} instance
+     */
+    public static PullConsumer createPullConsumer(final Properties properties) {
+        return onsFactory.createPullConsumer(properties);
+    }
+
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
index 67186b4..f9213a6 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
@@ -16,15 +16,16 @@
  */
 package org.apache.rocketmq.ons.api;
 
-import io.openmessaging.api.Consumer;
-import io.openmessaging.api.MessagingAccessPoint;
-import io.openmessaging.api.Producer;
-import io.openmessaging.api.batch.BatchConsumer;
-import io.openmessaging.api.order.OrderConsumer;
-import io.openmessaging.api.order.OrderProducer;
-import io.openmessaging.api.transaction.LocalTransactionChecker;
-import io.openmessaging.api.transaction.TransactionProducer;
-import java.util.Properties;
+    import io.openmessaging.api.Consumer;
+    import io.openmessaging.api.MessagingAccessPoint;
+    import io.openmessaging.api.Producer;
+    import io.openmessaging.api.PullConsumer;
+    import io.openmessaging.api.batch.BatchConsumer;
+    import io.openmessaging.api.order.OrderConsumer;
+    import io.openmessaging.api.order.OrderProducer;
+    import io.openmessaging.api.transaction.LocalTransactionChecker;
+    import io.openmessaging.api.transaction.TransactionProducer;
+    import java.util.Properties;
 
 /**
  * {@link MessagingAccessPoint} is recommended.
@@ -34,19 +35,16 @@ public interface ONSFactoryAPI {
 
     Producer createProducer(final Properties properties);
 
-
     Consumer createConsumer(final Properties properties);
 
-
     BatchConsumer createBatchConsumer(final Properties properties);
 
-
     OrderProducer createOrderProducer(final Properties properties);
 
-
     OrderConsumer createOrderedConsumer(final Properties properties);
 
-
     TransactionProducer createTransactionProducer(final Properties properties,
         final LocalTransactionChecker checker);
+
+    PullConsumer createPullConsumer(final Properties properties);
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
index 18ac9e4..5cded3a 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
@@ -20,6 +20,7 @@ import io.openmessaging.api.Consumer;
 import io.openmessaging.api.Message;
 import io.openmessaging.api.OMS;
 import io.openmessaging.api.Producer;
+import io.openmessaging.api.PullConsumer;
 import io.openmessaging.api.batch.BatchConsumer;
 import io.openmessaging.api.order.OrderConsumer;
 import io.openmessaging.api.order.OrderProducer;
@@ -38,6 +39,7 @@ import org.apache.rocketmq.ons.api.impl.rocketmq.ONSUtil;
 import org.apache.rocketmq.ons.api.impl.rocketmq.OrderConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.OrderProducerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ProducerImpl;
+import org.apache.rocketmq.ons.api.impl.rocketmq.PullConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.TransactionProducerImpl;
 
 /**
@@ -89,4 +91,9 @@ public class ONSFactoryImpl implements ONSFactoryAPI {
             }
         });
     }
+
+    @Override
+    public PullConsumer createPullConsumer(Properties properties) {
+        return new PullConsumerImpl(properties);
+    }
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java
new file mode 100644
index 0000000..c3a5c4d
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api.impl.rocketmq;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.PullConsumer;
+import io.openmessaging.api.TopicPartition;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.client.consumer.DefaultLitePullConsumer;
+import org.apache.rocketmq.client.consumer.TopicMessageQueueChangeListener;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.common.message.MessageQueue;
+import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
+import org.apache.rocketmq.logging.InternalLogger;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyValueConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
+import org.apache.rocketmq.remoting.protocol.LanguageCode;
+
+public class PullConsumerImpl extends ONSClientAbstract implements PullConsumer {
+    private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
+    private final static int MAX_CACHED_MESSAGE_SIZE_IN_MIB = 1024;
+    private final static int MIN_CACHED_MESSAGE_SIZE_IN_MIB = 16;
+    private final static int MAX_CACHED_MESSAGE_AMOUNT = 50000;
+    private final static int MIN_CACHED_MESSAGE_AMOUNT = 100;
+
+    private DefaultLitePullConsumer litePullConsumer;
+
+    private final String TOPIC_PARTITION_SPLITER = "#";
+
+    private int maxCachedMessageSizeInMiB = 512;
+
+    private int maxCachedMessageAmount = 5000;
+
+    public PullConsumerImpl(Properties properties) {
+        super(properties);
+        String consumerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.GROUP_ID));
+        if (StringUtils.isEmpty(consumerGroup)) {
+            throw new ONSClientException("Unable to get GROUP_ID property");
+        }
+
+        this.litePullConsumer =
+            new DefaultLitePullConsumer(this.getNamespace(), consumerGroup, new OnsClientRPCHook(sessionCredentials));
+
+        String messageModel = properties.getProperty(PropertyKeyConst.MessageModel, PropertyValueConst.CLUSTERING);
+        this.litePullConsumer.setMessageModel(MessageModel.valueOf(messageModel));
+
+        String maxBatchMessageCount = properties.getProperty(PropertyKeyConst.MAX_BATCH_MESSAGE_COUNT);
+        if (!UtilAll.isBlank(maxBatchMessageCount)) {
+            this.litePullConsumer.setPullBatchSize(Integer.valueOf(maxBatchMessageCount));
+        }
+
+        boolean isVipChannelEnabled = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.isVipChannelEnabled, "false"));
+        this.litePullConsumer.setVipChannelEnabled(isVipChannelEnabled);
+        if (properties.containsKey(PropertyKeyConst.LANGUAGE_IDENTIFIER)) {
+            int language = Integer.valueOf(properties.get(PropertyKeyConst.LANGUAGE_IDENTIFIER).toString());
+            byte languageByte = (byte) language;
+            this.litePullConsumer.setLanguage(LanguageCode.valueOf(languageByte));
+        }
+        String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
+        this.litePullConsumer.setInstanceName(instanceName);
+        this.litePullConsumer.setNamesrvAddr(this.getNameServerAddr());
+
+        String consumeThreadNums = properties.getProperty(PropertyKeyConst.ConsumeThreadNums);
+        if (!UtilAll.isBlank(consumeThreadNums)) {
+            this.litePullConsumer.setPullThreadNums(Integer.valueOf(consumeThreadNums));
+        }
+
+        String configuredCachedMessageAmount = properties.getProperty(PropertyKeyConst.MaxCachedMessageAmount);
+        if (!UtilAll.isBlank(configuredCachedMessageAmount)) {
+            maxCachedMessageAmount = Math.min(MAX_CACHED_MESSAGE_AMOUNT, Integer.valueOf(configuredCachedMessageAmount));
+            maxCachedMessageAmount = Math.max(MIN_CACHED_MESSAGE_AMOUNT, maxCachedMessageAmount);
+            this.litePullConsumer.setPullThresholdForAll(maxCachedMessageAmount);
+        }
+
+        String configuredCachedMessageSizeInMiB = properties.getProperty(PropertyKeyConst.MaxCachedMessageSizeInMiB);
+        if (!UtilAll.isBlank(configuredCachedMessageSizeInMiB)) {
+            maxCachedMessageSizeInMiB = Math.min(MAX_CACHED_MESSAGE_SIZE_IN_MIB, Integer.valueOf(configuredCachedMessageSizeInMiB));
+            maxCachedMessageSizeInMiB = Math.max(MIN_CACHED_MESSAGE_SIZE_IN_MIB, maxCachedMessageSizeInMiB);
+            this.litePullConsumer.setPullThresholdSizeForQueue(maxCachedMessageSizeInMiB);
+        }
+
+//        String msgTraceSwitch = properties.getProperty(PropertyKeyConst.MsgTraceSwitch);
+//        if (!UtilAll.isBlank(msgTraceSwitch) && (!Boolean.parseBoolean(msgTraceSwitch))) {
+//            LOGGER.info("MQ Client Disable the Trace Hook!");
+//        } else {
+//            try {
+//                Properties tempProperties = new Properties();
+//                tempProperties.put(OnsTraceConstants.AccessKey, sessionCredentials.getAccessKey());
+//                tempProperties.put(OnsTraceConstants.SecretKey, sessionCredentials.getSecretKey());
+//                tempProperties.put(OnsTraceConstants.MaxMsgSize, "128000");
+//                tempProperties.put(OnsTraceConstants.AsyncBufferSize, "2048");
+//                tempProperties.put(OnsTraceConstants.MaxBatchNum, "100");
+//                tempProperties.put(OnsTraceConstants.NAMESRV_ADDR, this.getNameServerAddr());
+//                tempProperties.put(OnsTraceConstants.InstanceName, "PID_CLIENT_INNER_TRACE_PRODUCER");
+//                tempProperties.put(OnsTraceConstants.TraceDispatcherType, OnsTraceDispatcherType.CONSUMER.name());
+//                AsyncArrayDispatcher dispatcher = new AsyncArrayDispatcher(tempProperties, sessionCredentials);
+//                dispatcher.setHostConsumer(defaultMQPushConsumer.getDefaultMQPushConsumerImpl());
+//                traceDispatcher = dispatcher;
+//                this.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().registerConsumeMessageHook(
+//                    new OnsConsumeMessageHookImpl(traceDispatcher));
+//            } catch (Throwable e) {
+//                LOGGER.error("system mqtrace hook init failed ,maybe can't send msg trace data", e);
+//            }
+//        }
+
+    }
+
+    @Override protected void updateNameServerAddr(String nameServerAddresses) {
+        //TODO
+    }
+
+    private Set<TopicPartition> convertToTopicPartitions(Collection<MessageQueue> messageQueues) {
+        Set<TopicPartition> topicPartitions = new HashSet<>();
+        for (MessageQueue messageQueue : messageQueues) {
+            TopicPartition topicPartition = convertToTopicPartition(messageQueue);
+            topicPartitions.add(topicPartition);
+        }
+        return topicPartitions;
+    }
+
+    private Set<MessageQueue> convertToMessageQueues(Collection<TopicPartition> topicPartitions) {
+        Set<MessageQueue> messageQueues = new HashSet<>();
+        for (TopicPartition topicPartition : topicPartitions) {
+            messageQueues.add(convertToMessageQueue(topicPartition));
+        }
+        return messageQueues;
+    }
+
+    private TopicPartition convertToTopicPartition(MessageQueue messageQueue) {
+        String topic = messageQueue.getTopic();
+        String partition = messageQueue.getBrokerName() + TOPIC_PARTITION_SPLITER + messageQueue.getQueueId();
+        TopicPartition topicPartition = new TopicPartition(topic, partition);
+        return topicPartition;
+    }
+
+    private MessageQueue convertToMessageQueue(TopicPartition topicPartition) {
+        String topic = topicPartition.getTopic();
+        String[] tmp = topicPartition.getPartition().split(TOPIC_PARTITION_SPLITER);
+        if (tmp.length != 2) {
+            LOGGER.warn("Failed to get message queue from TopicPartition: {}", topicPartition);
+            throw new ONSClientException("Failed to get message queue");
+        }
+        String brokerName = tmp[0];
+        int queueId = Integer.valueOf(tmp[1]);
+        return new MessageQueue(topic, brokerName, queueId);
+    }
+
+    @Override public Set<TopicPartition> topicPartitions(String topic) {
+        try {
+            Collection<MessageQueue> messageQueues = litePullConsumer.fetchMessageQueues(topic);
+            Set<TopicPartition> topicPartitions = new HashSet<>();
+            for (MessageQueue messageQueue : messageQueues) {
+                topicPartitions.add(convertToTopicPartition(messageQueue));
+            }
+            return topicPartitions;
+        } catch (MQClientException ex) {
+            throw new ONSClientException("defaultMQPushConsumer subscribe exception", ex);
+        }
+    }
+
+    @Override public void assign(Collection<TopicPartition> topicPartitions) {
+        Set<MessageQueue> messageQueues = new HashSet<>();
+        for (TopicPartition topicPartition : topicPartitions) {
+            messageQueues.add(convertToMessageQueue(topicPartition));
+        }
+        this.litePullConsumer.assign(messageQueues);
+    }
+
+    @Override public void registerTopicPartitionChangedListener(String topic, TopicPartitionChangeListener callback) {
+        TopicMessageQueueChangeListener listener = new TopicMessageQueueChangeListener() {
+            @Override public void onChanged(String topic, Set<MessageQueue> messageQueues) {
+                callback.onChanged(convertToTopicPartitions(messageQueues));
+            }
+        };
+        try {
+            this.litePullConsumer.registerTopicMessageQueueChangeListener(topic, listener);
+
+        } catch (MQClientException ex) {
+            LOGGER.warn("Register listener error", ex);
+            throw new ONSClientException("Failed to register topic partition listener");
+        }
+    }
+
+    @Override public List<Message> poll(long timeout) {
+        List<MessageExt> rmqMsgList = litePullConsumer.poll(timeout);
+        List<Message> msgList = new ArrayList<Message>();
+        for (MessageExt rmqMsg : rmqMsgList) {
+            Message msg = ONSUtil.msgConvert(rmqMsg);
+            Map<String, String> propertiesMap = rmqMsg.getProperties();
+            msg.setMsgID(rmqMsg.getMsgId());
+            if (propertiesMap != null && propertiesMap.get(Constants.TRANSACTION_ID) != null) {
+                msg.setMsgID(propertiesMap.get(Constants.TRANSACTION_ID));
+            }
+            msgList.add(msg);
+        }
+        return msgList;
+    }
+
+    @Override public void seek(TopicPartition topicPartition, long offset) {
+        MessageQueue messageQueue = convertToMessageQueue(topicPartition);
+        try {
+            litePullConsumer.seek(messageQueue, offset);
+        } catch (MQClientException ex) {
+            LOGGER.warn("Topic partition: {} seek to: {} error", topicPartition, offset, ex);
+            throw new ONSClientException("Seek offset failed");
+        }
+    }
+
+    @Override public void seekToBeginning(TopicPartition topicPartition) {
+        //TODO
+    }
+
+    @Override public void seekToEnd(TopicPartition topicPartition) {
+        //TODO
+
+    }
+
+    @Override public void pause(Collection<TopicPartition> topicPartitions) {
+        this.litePullConsumer.pause(convertToMessageQueues(topicPartitions));
+    }
+
+    @Override public void resume(Collection<TopicPartition> topicPartitions) {
+        this.litePullConsumer.resume(convertToMessageQueues(topicPartitions));
+    }
+
+    @Override public Long offsetForTimestamp(TopicPartition topicPartition, Long timestamp) {
+        try {
+            return litePullConsumer.offsetForTimestamp(convertToMessageQueue(topicPartition), timestamp);
+        } catch (MQClientException ex) {
+            LOGGER.warn("Get offset for topic partition:{} with timestamp:{} error", topicPartition, timestamp, ex);
+            throw new ONSClientException("Failed to get offset");
+        }
+    }
+
+    @Override public Long committed(TopicPartition topicPartition) {
+        try {
+            return litePullConsumer.committed(convertToMessageQueue(topicPartition));
+        } catch (MQClientException ex) {
+            LOGGER.warn("Get committed offset for topic partition: {} error", topicPartition, ex);
+            throw new ONSClientException("Failed to get committed offset");
+        }
+    }
+
+    @Override public void commitSync() {
+        litePullConsumer.commitSync();
+    }
+
+    @Override public void start() {
+        try {
+            if (this.started.compareAndSet(false, true)) {
+                this.litePullConsumer.start();
+                super.start();
+            }
+        } catch (Exception e) {
+            throw new ONSClientException(e.getMessage());
+        }
+    }
+
+    @Override public void shutdown() {
+        if (this.started.compareAndSet(true, false)) {
+            this.litePullConsumer.shutdown();
+        }
+        super.shutdown();
+    }
+}
diff --git a/ons-core/pom.xml b/ons-core/pom.xml
index 7a3da6a..62851ac 100644
--- a/ons-core/pom.xml
+++ b/ons-core/pom.xml
@@ -44,7 +44,7 @@
         <java_target_version>1.8</java_target_version>
         <file_encoding>UTF-8</file_encoding>
         <!-- Always use stable version of RocketMQ -->
-        <rocketmq.version>4.5.2</rocketmq.version>
+        <rocketmq.version>4.6.0</rocketmq.version>
         <auth.version>${project.version}</auth.version>
         <spring.version>4.1.2.RELEASE</spring.version>
         <diamond.version>3.7.4</diamond.version>
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimplePullConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimplePullConsumer.java
new file mode 100644
index 0000000..91bf280
--- /dev/null
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimplePullConsumer.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.sample.consumer;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.PullConsumer;
+import io.openmessaging.api.TopicPartition;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.sample.MQConfig;
+
+public class SimplePullConsumer {
+    public static void main(String[] args) {
+
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://127.0.0.1:9876");
+
+        Properties consumerProperties = new Properties();
+        consumerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
+        consumerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
+        consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
+
+        PullConsumer consumer = messagingAccessPoint.createPullConsumer(consumerProperties);
+        /*
+         * Alternatively, you can use the ONSFactory to create instance directly.
+         * <pre>
+         * {@code
+         * consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
+         * OrderConsumer consumer  = ONSFactory.createOrderedConsumer(consumerProperties);
+         * }
+         * </pre>
+         */
+
+        consumer.start();
+        Set<TopicPartition> topicPartitions = consumer.topicPartitions(MQConfig.TOPIC);
+        consumer.assign(topicPartitions);
+
+        while (true){
+            List<Message> messages = consumer.poll(3000);
+            System.out.printf("Received message: %s %n", messages);
+            consumer.commitSync();
+        }
+
+
+    }
+}
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
index 973dc4d..bcfa454 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
@@ -24,7 +24,7 @@ public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
 
     @Override
     public TransactionStatus check(Message msg) {
-        System.out.printf("Receive transaction check back request, MsgId: %s%n", msg.getMsgID());
+        System.out.printf("Receive transaction check back request, MsgId: %s%n", msg);
         return TransactionStatus.CommitTransaction;
     }
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
index 44da502..2e41e22 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
@@ -60,8 +60,8 @@ public class SimpleTransactionProducer {
                 SendResult sendResult = transactionProducer.send(message, new LocalTransactionExecuter() {
                     @Override
                     public TransactionStatus execute(Message msg, Object arg) {
-                        System.out.printf("Execute local transaction and return TransactionStatus. %n");
-                        return TransactionStatus.CommitTransaction;
+                        System.out.printf("Execute local transaction and return TransactionStatus. %s %n", msg);
+                        return TransactionStatus.Unknow;
                     }
                 }, null);
                 assert sendResult != null;
diff --git a/pom.xml b/pom.xml
index 71433c0..40f5660 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,8 +45,8 @@
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <file_encoding>UTF-8</file_encoding>
         <!-- Compiler settings properties -->
-        <maven.compiler.source>1.7</maven.compiler.source>
-        <maven.compiler.target>1.7</maven.compiler.target>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
         <eagleeye.core.version>1.4.8</eagleeye.core.version>
     </properties>
     <modules>


[rocketmq-ons] 04/36: Fix the issue that exception callback can not be called when doing async sending message with null topic

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 7af9b5793010069d49ff720c397c924a5a598fc1
Author: ShannonDing <li...@163.com>
AuthorDate: Mon Jun 17 15:25:04 2019 +0800

    Fix the issue that exception callback can not be called when doing async sending message with null topic
---
 .../org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index bd1dede..6118435 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -192,11 +192,11 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
 
             @Override
             public void onException(Throwable e) {
-                String topic = new String(message.getTopic());
+                //String topic = new String(message.getTopic());
                 String msgId = new String(message.getMsgID());
-                ONSClientException onsEx = checkProducerException(topic, msgId, e);
+                ONSClientException onsEx = checkProducerException(message.getTopic(), msgId, e);
                 OnExceptionContext context = new OnExceptionContext();
-                context.setTopic(topic);
+                context.setTopic(message.getTopic());
                 context.setMessageId(msgId);
                 context.setException(onsEx);
                 sendCallback.onException(context);


[rocketmq-ons] 30/36: Add create pull consumer unsupport exception

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 6992b4ee81b309ec4945caa032702133d09d000d
Author: duhenglucky <du...@gmail.com>
AuthorDate: Tue Sep 3 18:18:29 2019 +0800

    Add create pull consumer unsupport exception
---
 .../main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
index 05cb230..3a0a96b 100644
--- a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
+++ b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
@@ -21,6 +21,7 @@ import io.openmessaging.Constants;
 import io.openmessaging.Consumer;
 import io.openmessaging.Message;
 import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMSResponseStatus;
 import io.openmessaging.Producer;
 import io.openmessaging.PullConsumer;
 import io.openmessaging.batch.BatchConsumer;
@@ -59,7 +60,7 @@ public class MessagingAccessPointImpl implements MessagingAccessPoint {
     }
 
     @Override public PullConsumer createPullConsumer(Properties properties) {
-        return null;
+        throw OMSResponseStatus.generateException(OMSResponseStatus.STATUS_1101);
     }
 
     @Override


[rocketmq-ons] 34/36: fix(PullConsumer) removed unused import

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit f1f969f1c76967aa2da8f444ed2271b6ae519050
Author: 翊名 <du...@alibaba-inc.com>
AuthorDate: Fri Nov 22 14:42:05 2019 +0800

    fix(PullConsumer) removed unused import
---
 .../java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java
index c3a5c4d..4d625a0 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/PullConsumerImpl.java
@@ -21,7 +21,6 @@ import io.openmessaging.api.PullConsumer;
 import io.openmessaging.api.TopicPartition;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;


[rocketmq-ons] 28/36: Add support for OpenMessaging

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit beb29e1e2f8dba3e2e00e04d91d0a2ba7f35f297
Author: duhenglucky <du...@gmail.com>
AuthorDate: Tue Sep 3 11:18:37 2019 +0800

    Add support for OpenMessaging
---
 ons-core/ons-api/pom.xml                           |  28 ---
 .../java/org/apache/rocketmq/ons/api/Action.java   |  26 ---
 .../java/org/apache/rocketmq/ons/api/Admin.java    |  37 ---
 .../org/apache/rocketmq/ons/api/Constants.java     |  21 --
 .../apache/rocketmq/ons/api/ConsumeContext.java    |  21 --
 .../java/org/apache/rocketmq/ons/api/Consumer.java |  29 ---
 .../apache/rocketmq/ons/api/ExpressionType.java    |  24 --
 .../java/org/apache/rocketmq/ons/api/MQType.java   |  38 ----
 .../java/org/apache/rocketmq/ons/api/Message.java  | 251 ---------------------
 .../apache/rocketmq/ons/api/MessageAccessor.java   |  41 ----
 .../apache/rocketmq/ons/api/MessageListener.java   |  23 --
 .../apache/rocketmq/ons/api/MessageSelector.java   |  49 ----
 .../org/apache/rocketmq/ons/api/ONSFactory.java    |  88 --------
 .../org/apache/rocketmq/ons/api/ONSFactoryAPI.java |  40 ----
 .../rocketmq/ons/api/OnExceptionContext.java       |  56 -----
 .../java/org/apache/rocketmq/ons/api/Producer.java |  37 ---
 .../rocketmq/ons/api/PropertyValueConst.java       |  27 ---
 .../org/apache/rocketmq/ons/api/SendCallback.java  |  24 --
 .../org/apache/rocketmq/ons/api/SendResult.java    |  47 ----
 .../rocketmq/ons/api/batch/BatchConsumer.java      |  27 ---
 .../ons/api/batch/BatchMessageListener.java        |  29 ---
 .../rocketmq/ons/api/bean/BatchConsumerBean.java   | 114 ----------
 .../apache/rocketmq/ons/api/bean/ConsumerBean.java | 157 -------------
 .../rocketmq/ons/api/bean/OrderConsumerBean.java   | 111 ---------
 .../rocketmq/ons/api/bean/OrderProducerBean.java   |  82 -------
 .../apache/rocketmq/ons/api/bean/ProducerBean.java |  98 --------
 .../apache/rocketmq/ons/api/bean/Subscription.java |  93 --------
 .../rocketmq/ons/api/bean/SubscriptionExt.java     |  47 ----
 .../ons/api/bean/TransactionProducerBean.java      |  95 --------
 .../ons/api/exception/ONSClientException.java      |  42 ----
 .../ons/api/order/ConsumeOrderContext.java         |  21 --
 .../ons/api/order/MessageOrderListener.java        |  25 --
 .../ons/api/order/MessageQueueSelector.java        |  25 --
 .../apache/rocketmq/ons/api/order/OrderAction.java |  26 ---
 .../rocketmq/ons/api/order/OrderConsumer.java      |  35 ---
 .../rocketmq/ons/api/order/OrderProducer.java      |  28 ---
 .../api/transaction/LocalTransactionChecker.java   |  24 --
 .../api/transaction/LocalTransactionExecuter.java  |  26 ---
 .../ons/api/transaction/TransactionProducer.java   |  38 ----
 .../ons/api/transaction/TransactionStatus.java     |  28 ---
 ons-core/ons-client/pom.xml                        |   9 +-
 .../rocketmq/MessagingAccessPointImpl.java}        |  53 +++--
 .../ons/api/impl/constant}/PropertyKeyConst.java   |   5 +-
 .../ons/api/impl/rocketmq/BatchConsumerImpl.java   |  25 +-
 .../ons/api/impl/rocketmq/ConsumerImpl.java        |  33 ++-
 .../ons/api/impl/rocketmq/ONSClientAbstract.java   |  29 +--
 .../ons/api/impl/rocketmq/ONSConsumerAbstract.java |  28 ++-
 .../rocketmq/ons/api/impl/rocketmq/ONSUtil.java    |  16 +-
 .../ons/api/impl/rocketmq/OrderConsumerImpl.java   |  27 ++-
 .../ons/api/impl/rocketmq/OrderProducerImpl.java   |  26 +--
 .../ons/api/impl/rocketmq/ProducerImpl.java        |  39 ++--
 .../api/impl/rocketmq/TransactionProducerImpl.java |  16 +-
 .../tracehook/OnsClientSendMessageHookImpl.java    |  11 +-
 .../impl/rocketmq/NameServerAutoUpdateTest.java    |  44 ++--
 .../impl/rocketmq/ONSClientTokenUpdateTest.java    |  47 ++--
 ons-core/pom.xml                                   |  12 +-
 ons-sample/pom.xml                                 |  10 +-
 .../ons/sample/consumer/MessageListenerImpl.java   |   8 +-
 .../ons/sample/consumer/SimpleMQConsumer.java      |  12 +-
 .../ons/sample/consumer/SimpleOrderConsumer.java   |  18 +-
 .../producer/LocalTransactionCheckerImpl.java      |   6 +-
 .../ons/sample/producer/MQTimerProducer.java       |  19 +-
 .../ons/sample/producer/SimpleMQProducer.java      |  19 +-
 .../ons/sample/producer/SimpleOrderProducer.java   |  19 +-
 .../sample/producer/SimpleTransactionProducer.java |  25 +-
 65 files changed, 299 insertions(+), 2335 deletions(-)

diff --git a/ons-core/ons-api/pom.xml b/ons-core/ons-api/pom.xml
deleted file mode 100644
index adbec96..0000000
--- a/ons-core/ons-api/pom.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <groupId>org.apache.rocketmq</groupId>
-        <artifactId>ons-all</artifactId>
-        <version>1.0.1-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
-    <artifactId>ons-api</artifactId>
-    <name>ons-api ${project.version}</name>
-</project>
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Action.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Action.java
deleted file mode 100644
index 2c0a2c9..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Action.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api;
-
-
-public enum Action {
-
-    CommitMessage,
-
-    ReconsumeLater,
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Admin.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Admin.java
deleted file mode 100644
index 702d9a5..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Admin.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-import java.util.Properties;
-
-
-public interface Admin {
-
-    boolean isStarted();
-
-
-    boolean isClosed();
-
-
-    void start();
-
-
-    void updateCredential(Properties credentialProperties);
-
-
-    void shutdown();
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Constants.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Constants.java
deleted file mode 100644
index a51ba20..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Constants.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-public class Constants {
-    public static final String TRANSACTION_ID = "__transactionId__";
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ConsumeContext.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ConsumeContext.java
deleted file mode 100644
index 5973428..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ConsumeContext.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-public class ConsumeContext {
-
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Consumer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Consumer.java
deleted file mode 100644
index a592559..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Consumer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-
-public interface Consumer extends Admin {
-
-    void subscribe(final String topic, final String subExpression, final MessageListener listener);
-
-
-    void subscribe(final String topic, final MessageSelector selector, final MessageListener listener);
-
-
-    void unsubscribe(final String topic);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ExpressionType.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ExpressionType.java
deleted file mode 100644
index 1980ac6..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ExpressionType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-public enum ExpressionType {
-
-    SQL92,
-
-    TAG
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MQType.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MQType.java
deleted file mode 100644
index 17d4afa..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MQType.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-public enum MQType {
-
-    NOTIFY("NOTIFY"),
-
-    METAQ("METAQ");
-
-    private String name;
-
-    MQType(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
deleted file mode 100644
index db56b15..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-
-public class Message implements Serializable {
-
-    private static final long serialVersionUID = -1385924226856188094L;
-
-
-    Properties systemProperties;
-
-
-    private String topic;
-
-
-    private Properties userProperties;
-
-
-    private byte[] body;
-
-
-    public Message() {
-        this(null, null, "", null);
-    }
-
-
-    public Message(String topic, String tag, String key, byte[] body) {
-        this.topic = topic;
-        this.body = body;
-
-        this.putSystemProperties(SystemPropKey.TAG, tag);
-        this.putSystemProperties(SystemPropKey.KEY, key);
-    }
-
-
-    public void putSystemProperties(final String key, final String value) {
-        if (null == this.systemProperties) {
-            this.systemProperties = new Properties();
-        }
-
-        if (key != null && value != null) {
-            this.systemProperties.put(key, value);
-        }
-    }
-
-
-    public Message(String topic, String tags, byte[] body) {
-        this(topic, tags, "", body);
-    }
-
-
-    public void putUserProperties(final String key, final String value) {
-        if (null == this.userProperties) {
-            this.userProperties = new Properties();
-        }
-
-        if (key != null && value != null) {
-            this.userProperties.put(key, value);
-        }
-    }
-
-
-    public String getUserProperties(final String key) {
-        if (null != this.userProperties) {
-            return (String) this.userProperties.get(key);
-        }
-
-        return null;
-    }
-
-
-    public String getTopic() {
-        return topic;
-    }
-
-
-    public void setTopic(String topic) {
-        this.topic = topic;
-    }
-
-
-    public String getTag() {
-        return this.getSystemProperties(SystemPropKey.TAG);
-    }
-
-
-    public String getSystemProperties(final String key) {
-        if (null != this.systemProperties) {
-            return this.systemProperties.getProperty(key);
-        }
-
-        return null;
-    }
-
-
-    public void setTag(String tag) {
-        this.putSystemProperties(SystemPropKey.TAG, tag);
-    }
-
-
-    public String getKey() {
-        return this.getSystemProperties(SystemPropKey.KEY);
-    }
-
-
-    public void setKey(String key) {
-        this.putSystemProperties(SystemPropKey.KEY, key);
-    }
-
-
-    public String getMsgID() {
-        return this.getSystemProperties(SystemPropKey.MSGID);
-    }
-
-
-    public void setMsgID(String msgid) {
-        this.putSystemProperties(SystemPropKey.MSGID, msgid);
-    }
-
-    public Properties getSystemProperties() {
-        if (null == systemProperties) {
-            return new Properties();
-        }
-        return systemProperties;
-    }
-
-    public void setSystemProperties(Properties systemProperties) {
-        this.systemProperties = systemProperties;
-    }
-
-    public Properties getUserProperties() {
-        if (null == userProperties) {
-            return new Properties();
-        }
-        return userProperties;
-    }
-
-    public void setUserProperties(Properties userProperties) {
-        this.userProperties = userProperties;
-    }
-
-    public byte[] getBody() {
-        return body;
-    }
-
-    public void setBody(byte[] body) {
-        this.body = body;
-    }
-
-
-    public int getReconsumeTimes() {
-        String pro = this.getSystemProperties(SystemPropKey.RECONSUMETIMES);
-        if (pro != null) {
-            return Integer.parseInt(pro);
-        }
-
-        return 0;
-    }
-
-
-    public void setReconsumeTimes(final int value) {
-        putSystemProperties(SystemPropKey.RECONSUMETIMES, String.valueOf(value));
-    }
-
-
-    public long getBornTimestamp() {
-        String pro = this.getSystemProperties(SystemPropKey.BORNTIMESTAMP);
-        if (pro != null) {
-            return Long.parseLong(pro);
-        }
-
-        return 0L;
-    }
-
-
-    public void setBornTimestamp(final long value) {
-        putSystemProperties(SystemPropKey.BORNTIMESTAMP, String.valueOf(value));
-    }
-
-
-    public String getBornHost() {
-        String pro = this.getSystemProperties(SystemPropKey.BORNHOST);
-        return pro == null ? "" : pro;
-    }
-
-
-    public void setBornHost(final String value) {
-        putSystemProperties(SystemPropKey.BORNHOST, value);
-    }
-
-
-    public long getStartDeliverTime() {
-        String pro = this.getSystemProperties(SystemPropKey.STARTDELIVERTIME);
-        if (pro != null) {
-            return Long.parseLong(pro);
-        }
-
-        return 0L;
-    }
-
-    public String getShardingKey() {
-        String pro = this.getSystemProperties(SystemPropKey.SHARDINGKEY);
-        return pro == null ? "" : pro;
-    }
-
-    public void setShardingKey(final String value) {
-        putSystemProperties(SystemPropKey.SHARDINGKEY, value);
-    }
-
-
-    public void setStartDeliverTime(final long value) {
-        putSystemProperties(SystemPropKey.STARTDELIVERTIME, String.valueOf(value));
-    }
-
-    @Override
-    public String toString() {
-        return "Message [topic=" + topic + ", systemProperties=" + systemProperties + ", userProperties=" + userProperties + ", body="
-            + (body != null ? body.length : 0) + "]";
-    }
-
-
-    static public class SystemPropKey {
-        public static final String TAG = "__TAG";
-        public static final String KEY = "__KEY";
-        public static final String MSGID = "__MSGID";
-        public static final String SHARDINGKEY = "__SHARDINGKEY";
-        public static final String RECONSUMETIMES = "__RECONSUMETIMES";
-        public static final String BORNTIMESTAMP = "__BORNTIMESTAMP";
-        public static final String BORNHOST = "__BORNHOST";
-
-        public static final String STARTDELIVERTIME = "__STARTDELIVERTIME";
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageAccessor.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageAccessor.java
deleted file mode 100644
index 61f23b1..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageAccessor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-import java.util.Properties;
-
-
-public class MessageAccessor {
-    public static Properties getSystemProperties(final Message msg) {
-        return msg.systemProperties;
-    }
-
-
-    public static void setSystemProperties(final Message msg, Properties systemProperties) {
-        msg.systemProperties = systemProperties;
-    }
-
-
-    public static void putSystemProperties(final Message msg, final String key, final String value) {
-        msg.putSystemProperties(key, value);
-    }
-
-
-    public static String getSystemProperties(final Message msg, final String key) {
-        return msg.getSystemProperties(key);
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageListener.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageListener.java
deleted file mode 100644
index 22b56c7..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-
-public interface MessageListener {
-
-    Action consume(final Message message, final ConsumeContext context);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageSelector.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageSelector.java
deleted file mode 100644
index f28bdae..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/MessageSelector.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api;
-
-public class MessageSelector {
-
-    private ExpressionType type;
-
-    private String subExpression;
-
-    public static MessageSelector bySql(String subExpression) {
-        return new MessageSelector(ExpressionType.SQL92, subExpression);
-    }
-
-    public static MessageSelector byTag(String subExpression) {
-        return new MessageSelector(ExpressionType.TAG, subExpression);
-    }
-
-    private MessageSelector() {
-    }
-
-    private MessageSelector(ExpressionType type, String subExpression) {
-        this.type = type;
-        this.subExpression = subExpression;
-    }
-
-    public ExpressionType getType() {
-        return type;
-    }
-
-    public String getSubExpression() {
-        return subExpression;
-    }
-}
\ No newline at end of file
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
deleted file mode 100644
index eaff503..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-import org.apache.rocketmq.ons.api.batch.BatchConsumer;
-import org.apache.rocketmq.ons.api.order.OrderConsumer;
-import org.apache.rocketmq.ons.api.order.OrderProducer;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
-import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
-import java.util.Properties;
-
-
-public class ONSFactory {
-
-
-    private static ONSFactoryAPI onsFactory = null;
-
-    static {
-        try {
-
-            Class<?> factoryClass =
-                    ONSFactory.class.getClassLoader().loadClass(
-                            "org.apache.rocketmq.ons.api.impl.ONSFactoryNotifyAndMetaQImpl");
-            onsFactory = (ONSFactoryAPI) factoryClass.newInstance();
-        } catch (Throwable e) {
-            try {
-                Class<?> factoryClass =
-                        ONSFactory.class.getClassLoader().loadClass(
-                                "org.apache.rocketmq.ons.api.impl.ONSFactoryImpl");
-                onsFactory = (ONSFactoryAPI) factoryClass.newInstance();
-            } catch (Throwable e1) {
-                e.printStackTrace();
-                e1.printStackTrace();
-            }
-        }
-    }
-
-
-
-    public static Producer createProducer(final Properties properties) {
-        return onsFactory.createProducer(properties);
-    }
-
-
-
-    public static OrderProducer createOrderProducer(final Properties properties) {
-        return onsFactory.createOrderProducer(properties);
-    }
-
-
-
-    public static TransactionProducer createTransactionProducer(final Properties properties,
-                                                                final LocalTransactionChecker checker) {
-        return onsFactory.createTransactionProducer(properties, checker);
-    }
-
-
-
-    public static Consumer createConsumer(final Properties properties) {
-        return onsFactory.createConsumer(properties);
-    }
-
-
-    public static BatchConsumer createBatchConsumer(final Properties properties) {
-        return onsFactory.createBatchConsumer(properties);
-    }
-
-
-
-    public static OrderConsumer createOrderedConsumer(final Properties properties) {
-        return onsFactory.createOrderedConsumer(properties);
-    }
-
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
deleted file mode 100644
index b4bdd8a..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-import org.apache.rocketmq.ons.api.batch.BatchConsumer;
-import org.apache.rocketmq.ons.api.order.OrderConsumer;
-import org.apache.rocketmq.ons.api.order.OrderProducer;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
-import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
-import java.util.Properties;
-
-public interface ONSFactoryAPI {
-
-    Producer createProducer(final Properties properties);
-
-    Consumer createConsumer(final Properties properties);
-
-    BatchConsumer createBatchConsumer(final Properties properties);
-
-    OrderProducer createOrderProducer(final Properties properties);
-
-    OrderConsumer createOrderedConsumer(final Properties properties);
-
-    TransactionProducer createTransactionProducer(final Properties properties,
-        final LocalTransactionChecker checker);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/OnExceptionContext.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/OnExceptionContext.java
deleted file mode 100644
index 3eb7620..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/OnExceptionContext.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-
-
-public class OnExceptionContext {
-
-
-    private String messageId;
-
-
-    private String topic;
-
-
-    private ONSClientException exception;
-
-    public String getMessageId() {
-        return messageId;
-    }
-
-    public void setMessageId(String messageId) {
-        this.messageId = messageId;
-    }
-
-    public String getTopic() {
-        return topic;
-    }
-
-    public void setTopic(String topic) {
-        this.topic = topic;
-    }
-
-    public ONSClientException getException() {
-        return exception;
-    }
-
-    public void setException(ONSClientException exception) {
-        this.exception = exception;
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Producer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Producer.java
deleted file mode 100644
index e45e613..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Producer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-import java.util.concurrent.ExecutorService;
-
-public interface Producer extends Admin {
-
-
-    @Override
-    void start();
-
-    @Override
-    void shutdown();
-
-    SendResult send(final Message message);
-
-    void sendOneway(final Message message);
-
-    void sendAsync(final Message message, final SendCallback sendCallback);
-
-    void setCallbackExecutor(final ExecutorService callbackExecutor);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java
deleted file mode 100644
index c748447..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-
-public class PropertyValueConst {
-
-
-    public static final String BROADCASTING = "BROADCASTING";
-
-
-    public static final String CLUSTERING = "CLUSTERING";
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendCallback.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendCallback.java
deleted file mode 100644
index ade3f70..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendCallback.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-public interface SendCallback {
-
-    void onSuccess(final SendResult sendResult);
-
-    void onException(final OnExceptionContext context);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendResult.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendResult.java
deleted file mode 100644
index 2dd0bb5..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/SendResult.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api;
-
-public class SendResult {
-
-    private String messageId;
-
-    private String topic;
-
-
-    public String getMessageId() {
-        return messageId;
-    }
-
-
-    public void setMessageId(String messageId) {
-        this.messageId = messageId;
-    }
-
-    public String getTopic() {
-        return topic;
-    }
-
-    public void setTopic(String topic) {
-        this.topic = topic;
-    }
-
-    @Override
-    public String toString() {
-        return "SendResult[topic=" + topic + ", messageId=" + messageId + ']';
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchConsumer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchConsumer.java
deleted file mode 100644
index 848a139..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchConsumer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.batch;
-
-import org.apache.rocketmq.ons.api.Admin;
-
-public interface BatchConsumer extends Admin {
-
-    void subscribe(final String topic, final String subExpression, final BatchMessageListener listener);
-
-    void unsubscribe(final String topic);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchMessageListener.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchMessageListener.java
deleted file mode 100644
index 3716a90..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/batch/BatchMessageListener.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.batch;
-
-import org.apache.rocketmq.ons.api.Action;
-import org.apache.rocketmq.ons.api.ConsumeContext;
-import org.apache.rocketmq.ons.api.Message;
-import java.util.List;
-
-
-public interface BatchMessageListener {
-
-    Action consume(final List<Message> messages, final ConsumeContext context);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java
deleted file mode 100644
index 1cfedde..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/BatchConsumerBean.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-import java.util.Map;
-import java.util.Properties;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.batch.BatchConsumer;
-import org.apache.rocketmq.ons.api.batch.BatchMessageListener;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-
-
-public class BatchConsumerBean implements BatchConsumer {
-
-    private Properties properties;
-
-
-    private Map<Subscription, BatchMessageListener> subscriptionTable;
-
-    private BatchConsumer batchConsumer;
-
-    @Override
-    public boolean isStarted() {
-        return this.batchConsumer.isStarted();
-    }
-
-    @Override
-    public boolean isClosed() {
-        return this.batchConsumer.isClosed();
-    }
-
-
-    @Override
-    public void start() {
-        if (null == this.properties) {
-            throw new ONSClientException("properties not set");
-        }
-
-        if (null == this.subscriptionTable) {
-            throw new ONSClientException("subscriptionTable not set");
-        }
-
-        this.batchConsumer = ONSFactory.createBatchConsumer(this.properties);
-
-        for (final Map.Entry<Subscription, BatchMessageListener> next : this.subscriptionTable.entrySet()) {
-            this.subscribe(next.getKey().getTopic(), next.getKey().getExpression(), next.getValue());
-        }
-
-        this.batchConsumer.start();
-    }
-
-    @Override
-    public void updateCredential(Properties credentialProperties) {
-        if (this.batchConsumer != null) {
-            this.batchConsumer.updateCredential(credentialProperties);
-        }
-    }
-
-
-    @Override
-    public void shutdown() {
-        if (this.batchConsumer != null) {
-            this.batchConsumer.shutdown();
-        }
-    }
-
-    @Override
-    public void subscribe(final String topic, final String subExpression, final BatchMessageListener listener) {
-        if (null == this.batchConsumer) {
-            throw new ONSClientException("subscribe must be called after BatchConsumerBean started");
-        }
-        this.batchConsumer.subscribe(topic, subExpression, listener);
-    }
-
-    @Override
-    public void unsubscribe(final String topic) {
-        if (null == this.batchConsumer) {
-            throw new ONSClientException("unsubscribe must be called after BatchConsumerBean started");
-        }
-        this.batchConsumer.unsubscribe(topic);
-    }
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(final Properties properties) {
-        this.properties = properties;
-    }
-
-    public Map<Subscription, BatchMessageListener> getSubscriptionTable() {
-        return subscriptionTable;
-    }
-
-    public void setSubscriptionTable(
-        final Map<Subscription, BatchMessageListener> subscriptionTable) {
-        this.subscriptionTable = subscriptionTable;
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java
deleted file mode 100644
index 839ad62..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ConsumerBean.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-import java.lang.reflect.Method;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import org.apache.rocketmq.ons.api.Consumer;
-import org.apache.rocketmq.ons.api.ExpressionType;
-import org.apache.rocketmq.ons.api.MessageListener;
-import org.apache.rocketmq.ons.api.MessageSelector;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-
-
-public class ConsumerBean implements Consumer {
-
-    private Properties properties;
-
-
-    private Map<Subscription, MessageListener> subscriptionTable;
-
-    private Consumer consumer;
-
-
-    @Override
-    public void start() {
-        if (null == this.properties) {
-            throw new ONSClientException("properties not set");
-        }
-
-        if (null == this.subscriptionTable) {
-            throw new ONSClientException("subscriptionTable not set");
-        }
-
-        this.consumer = ONSFactory.createConsumer(this.properties);
-
-        Iterator<Entry<Subscription, MessageListener>> it = this.subscriptionTable.entrySet().iterator();
-        while (it.hasNext()) {
-            Entry<Subscription, MessageListener> next = it.next();
-            if ("com.aliyun.openservices.ons.api.impl.notify.ConsumerImpl".equals(this.consumer.getClass().getCanonicalName())
-                && (next.getKey() instanceof SubscriptionExt)) {
-                SubscriptionExt subscription = (SubscriptionExt) next.getKey();
-                for (Method method : this.consumer.getClass().getMethods()) {
-                    if ("subscribeNotify".equals(method.getName())) {
-                        try {
-                            method.invoke(consumer, subscription.getTopic(), subscription.getExpression(),
-                                    subscription.isPersistence(), next.getValue());
-                        } catch (Exception e) {
-                            throw new ONSClientException("subscribeNotify invoke exception", e);
-                        }
-                        break;
-                    }
-                }
-
-            } else {
-                Subscription subscription = next.getKey();
-                if (subscription.getType() == null || ExpressionType.TAG.name().equals(subscription.getType())) {
-
-                    this.subscribe(subscription.getTopic(), subscription.getExpression(), next.getValue());
-
-                } else if (ExpressionType.SQL92.name().equals(subscription.getType())) {
-
-                    this.subscribe(subscription.getTopic(), MessageSelector.bySql(subscription.getExpression()), next.getValue());
-                } else {
-
-                    throw new ONSClientException(String.format("Expression type %s is unknown!", subscription.getType()));
-                }
-            }
-
-        }
-
-        this.consumer.start();
-    }
-
-    @Override
-    public void updateCredential(Properties credentialProperties) {
-        if (this.consumer != null) {
-            this.consumer.updateCredential(credentialProperties);
-        }
-    }
-
-
-    @Override
-    public void shutdown() {
-        if (this.consumer != null) {
-            this.consumer.shutdown();
-        }
-    }
-
-    @Override
-    public void subscribe(String topic, String subExpression, MessageListener listener) {
-        if (null == this.consumer) {
-            throw new ONSClientException("subscribe must be called after consumerBean started");
-        }
-        this.consumer.subscribe(topic, subExpression, listener);
-    }
-
-    @Override
-    public void subscribe(final String topic, final MessageSelector selector, final MessageListener listener) {
-        if (null == this.consumer) {
-            throw new ONSClientException("subscribe must be called after consumerBean started");
-        }
-        this.consumer.subscribe(topic, selector, listener);
-    }
-
-    @Override
-    public void unsubscribe(String topic) {
-        if (null == this.consumer) {
-            throw new ONSClientException("unsubscribe must be called after consumerBean started");
-        }
-        this.consumer.unsubscribe(topic);
-    }
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(Properties properties) {
-        this.properties = properties;
-    }
-
-    public Map<Subscription, MessageListener> getSubscriptionTable() {
-        return subscriptionTable;
-    }
-
-    public void setSubscriptionTable(Map<Subscription, MessageListener> subscriptionTable) {
-        this.subscriptionTable = subscriptionTable;
-    }
-
-    @Override
-    public boolean isStarted() {
-        return this.consumer.isStarted();
-    }
-
-    @Override
-    public boolean isClosed() {
-        return this.consumer.isClosed();
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java
deleted file mode 100644
index e5b6402..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderConsumerBean.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-import java.util.Map;
-import java.util.Properties;
-import org.apache.rocketmq.ons.api.MessageSelector;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-import org.apache.rocketmq.ons.api.order.MessageOrderListener;
-import org.apache.rocketmq.ons.api.order.OrderConsumer;
-
-public class OrderConsumerBean implements OrderConsumer {
-
-    private Properties properties;
-
-    private Map<Subscription, MessageOrderListener> subscriptionTable;
-
-    private OrderConsumer orderConsumer;
-
-    @Override
-    public boolean isStarted() {
-        return this.orderConsumer.isStarted();
-    }
-
-    @Override
-    public boolean isClosed() {
-        return this.orderConsumer.isClosed();
-    }
-
-    @Override
-    public void start() {
-        if (null == this.properties) {
-            throw new ONSClientException("properties not set");
-        }
-
-        if (null == this.subscriptionTable) {
-            throw new ONSClientException("subscriptionTable not set");
-        }
-
-        this.orderConsumer = ONSFactory.createOrderedConsumer(this.properties);
-
-        for (final Map.Entry<Subscription, MessageOrderListener> next : this.subscriptionTable.entrySet()) {
-            this.subscribe(next.getKey().getTopic(), next.getKey().getExpression(), next.getValue());
-        }
-
-        this.orderConsumer.start();
-    }
-
-    @Override
-    public void updateCredential(Properties credentialProperties) {
-        if (this.orderConsumer != null) {
-            this.orderConsumer.updateCredential(credentialProperties);
-        }
-    }
-
-    @Override
-    public void shutdown() {
-        if (this.orderConsumer != null) {
-            this.orderConsumer.shutdown();
-        }
-    }
-
-    @Override
-    public void subscribe(final String topic, final String subExpression, final MessageOrderListener listener) {
-        if (null == this.orderConsumer) {
-            throw new ONSClientException("subscribe must be called after OrderConsumerBean started");
-        }
-        this.orderConsumer.subscribe(topic, subExpression, listener);
-    }
-
-    @Override
-    public void subscribe(String topic, MessageSelector selector, MessageOrderListener listener) {
-        if (null == this.orderConsumer) {
-            throw new ONSClientException("subscribe must be called after OrderConsumerBean started");
-        }
-        this.orderConsumer.subscribe(topic, selector, listener);
-    }
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(final Properties properties) {
-        this.properties = properties;
-    }
-
-    public Map<Subscription, MessageOrderListener> getSubscriptionTable() {
-        return subscriptionTable;
-    }
-
-    public void setSubscriptionTable(
-        final Map<Subscription, MessageOrderListener> subscriptionTable) {
-        this.subscriptionTable = subscriptionTable;
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java
deleted file mode 100644
index 64cf25b..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/OrderProducerBean.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-import org.apache.rocketmq.ons.api.order.OrderProducer;
-import java.util.Properties;
-
-
-public class OrderProducerBean implements OrderProducer {
-
-    private Properties properties;
-
-    private OrderProducer orderProducer;
-
-
-    @Override
-    public void start() {
-        if (null == this.properties) {
-            throw new ONSClientException("properties not set");
-        }
-
-        this.orderProducer = ONSFactory.createOrderProducer(this.properties);
-        this.orderProducer.start();
-    }
-
-    @Override
-    public void updateCredential(Properties credentialProperties) {
-        if (this.orderProducer != null) {
-            this.orderProducer.updateCredential(credentialProperties);
-        }
-    }
-
-
-    @Override
-    public void shutdown() {
-        if (this.orderProducer != null) {
-            this.orderProducer.shutdown();
-        }
-    }
-
-    @Override
-    public boolean isStarted() {
-        return this.orderProducer.isStarted();
-    }
-
-    @Override
-    public boolean isClosed() {
-        return this.orderProducer.isClosed();
-    }
-
-    @Override
-    public SendResult send(final Message message, final String shardingKey) {
-        return this.orderProducer.send(message, shardingKey);
-    }
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(final Properties properties) {
-        this.properties = properties;
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java
deleted file mode 100644
index 2094158..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/ProducerBean.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.Producer;
-import org.apache.rocketmq.ons.api.SendCallback;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-
-
-public class ProducerBean implements Producer {
-
-    private Properties properties;
-    private Producer producer;
-
-    @Override
-    public void start() {
-        if (null == this.properties) {
-            throw new ONSClientException("properties not set");
-        }
-
-        this.producer = ONSFactory.createProducer(this.properties);
-        this.producer.start();
-    }
-
-    @Override
-    public void updateCredential(Properties credentialProperties) {
-        if (this.producer != null) {
-            this.producer.updateCredential(credentialProperties);
-        }
-    }
-
-    @Override
-    public void shutdown() {
-        if (this.producer != null) {
-            this.producer.shutdown();
-        }
-    }
-
-
-    @Override
-    public SendResult send(Message message) {
-        return this.producer.send(message);
-    }
-
-
-    @Override
-    public void sendOneway(Message message) {
-        this.producer.sendOneway(message);
-    }
-
-    @Override
-    public void sendAsync(Message message, SendCallback sendCallback) {
-        this.producer.sendAsync(message, sendCallback);
-    }
-
-    @Override
-    public void setCallbackExecutor(final ExecutorService callbackExecutor) {
-        this.producer.setCallbackExecutor(callbackExecutor);
-    }
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(Properties properties) {
-        this.properties = properties;
-    }
-
-    @Override
-    public boolean isStarted() {
-        return this.producer.isStarted();
-    }
-
-    @Override
-    public boolean isClosed() {
-        return this.producer.isClosed();
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/Subscription.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/Subscription.java
deleted file mode 100644
index 1840d4d..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/Subscription.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-import org.apache.rocketmq.ons.api.ExpressionType;
-
-public class Subscription {
-    private String topic;
-    private String expression;
-
-    /**
-     * TAG or SQL92
-     * <br>if null, equals to TAG
-     *
-     * @see ExpressionType#TAG
-     * @see ExpressionType#SQL92
-     */
-    private String type;
-
-    public String getTopic() {
-        return topic;
-    }
-
-    public void setTopic(String topic) {
-        this.topic = topic;
-    }
-
-    public String getExpression() {
-        return expression;
-    }
-
-    public void setExpression(String expression) {
-        this.expression = expression;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(final String type) {
-        this.type = type;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((topic == null) ? 0 : topic.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        Subscription other = (Subscription) obj;
-        if (topic == null) {
-            if (other.topic != null) {
-                return false;
-            }
-        } else if (!topic.equals(other.topic)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "Subscription [topic=" + topic + ", expression=" + expression + ", type=" + type + "]";
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/SubscriptionExt.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/SubscriptionExt.java
deleted file mode 100644
index 7413f90..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/SubscriptionExt.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-
-public class SubscriptionExt extends Subscription {
-    private boolean persistence = true;
-
-    public boolean isPersistence() {
-        return persistence;
-    }
-
-    public void setPersistence(boolean persistence) {
-        this.persistence = persistence;
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return super.equals(obj);
-    }
-
-    @Override
-    public String toString() {
-        return "Subscription [topic=" + super.getTopic() + ", expression=" + super.getExpression()
-            + ", persistence=" + persistence + "]";
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java
deleted file mode 100644
index cb55e14..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/bean/TransactionProducerBean.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.bean;
-
-import java.util.Properties;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionExecuter;
-import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
-
-
-public class TransactionProducerBean implements TransactionProducer {
-
-    private Properties properties;
-
-
-    private LocalTransactionChecker localTransactionChecker;
-
-    private TransactionProducer transactionProducer;
-
-
-    @Override
-    public void start() {
-        if (null == this.properties) {
-            throw new ONSClientException("properties not set");
-        }
-
-        this.transactionProducer = ONSFactory.createTransactionProducer(properties, localTransactionChecker);
-        this.transactionProducer.start();
-    }
-
-    @Override
-    public void updateCredential(Properties credentialProperties) {
-        if (this.transactionProducer != null) {
-            this.transactionProducer.updateCredential(credentialProperties);
-        }
-    }
-
-
-    @Override
-    public void shutdown() {
-        if (this.transactionProducer != null) {
-            this.transactionProducer.shutdown();
-        }
-    }
-
-    @Override
-    public SendResult send(Message message, LocalTransactionExecuter executer, Object arg) {
-        return this.transactionProducer.send(message, executer, arg);
-    }
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(Properties properties) {
-        this.properties = properties;
-    }
-
-    public LocalTransactionChecker getLocalTransactionChecker() {
-        return localTransactionChecker;
-    }
-
-    public void setLocalTransactionChecker(LocalTransactionChecker localTransactionChecker) {
-        this.localTransactionChecker = localTransactionChecker;
-    }
-
-    @Override
-    public boolean isStarted() {
-        return this.transactionProducer.isStarted();
-    }
-
-    @Override
-    public boolean isClosed() {
-        return this.transactionProducer.isClosed();
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java
deleted file mode 100644
index a761e3b..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.exception;
-
-
-public class ONSClientException extends RuntimeException {
-    private static final long serialVersionUID = 5755356574640041094L;
-
-
-    public ONSClientException() {
-    }
-
-
-    public ONSClientException(String message) {
-        super(message);
-    }
-
-
-    public ONSClientException(Throwable cause) {
-        super(cause);
-    }
-
-
-    public ONSClientException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/ConsumeOrderContext.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/ConsumeOrderContext.java
deleted file mode 100644
index f7102c3..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/ConsumeOrderContext.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api.order;
-
-public class ConsumeOrderContext {
-
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageOrderListener.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageOrderListener.java
deleted file mode 100644
index 20a4003..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageOrderListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.order;
-
-import org.apache.rocketmq.ons.api.Message;
-
-public interface MessageOrderListener {
-
-    OrderAction consume(final Message message, final ConsumeOrderContext context);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageQueueSelector.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageQueueSelector.java
deleted file mode 100644
index bee8d64..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/MessageQueueSelector.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.order;
-
-import org.apache.rocketmq.ons.api.Message;
-
-public interface MessageQueueSelector {
-
-    int select(final int queueTotal, final Message msg, final Object arg);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderAction.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderAction.java
deleted file mode 100644
index e2dc190..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderAction.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.order;
-
-
-public enum OrderAction {
-
-    Success,
-
-    Suspend,
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderConsumer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderConsumer.java
deleted file mode 100644
index 4e73c1b..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderConsumer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.order;
-
-import org.apache.rocketmq.ons.api.Admin;
-import org.apache.rocketmq.ons.api.MessageSelector;
-
-
-public interface OrderConsumer extends Admin {
-
-    @Override
-    void start();
-
-    @Override
-    void shutdown();
-
-    void subscribe(final String topic, final String subExpression, final MessageOrderListener listener);
-
-    void subscribe(final String topic, final MessageSelector selector, final MessageOrderListener listener);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderProducer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderProducer.java
deleted file mode 100644
index 4e9a0bb..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/order/OrderProducer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.order;
-
-import org.apache.rocketmq.ons.api.Admin;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.SendResult;
-
-
-public interface OrderProducer extends Admin {
-
-    SendResult send(final Message message, final String shardingKey);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionChecker.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionChecker.java
deleted file mode 100644
index eb46593..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionChecker.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.rocketmq.ons.api.transaction;
-
-import org.apache.rocketmq.ons.api.Message;
-
-public interface LocalTransactionChecker {
-
-    TransactionStatus check(final Message msg);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionExecuter.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionExecuter.java
deleted file mode 100644
index f3fe785..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/LocalTransactionExecuter.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.transaction;
-
-import org.apache.rocketmq.ons.api.Message;
-
-
-public interface LocalTransactionExecuter {
-
-    TransactionStatus execute(final Message msg, final Object arg);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionProducer.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionProducer.java
deleted file mode 100644
index c139db1..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionProducer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.transaction;
-
-import org.apache.rocketmq.ons.api.Admin;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.SendResult;
-
-
-public interface TransactionProducer extends Admin {
-
-    @Override
-    void start();
-
-
-    @Override
-    void shutdown();
-
-
-    SendResult send(final Message message,
-        final LocalTransactionExecuter executer,
-        final Object arg);
-}
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionStatus.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionStatus.java
deleted file mode 100644
index c98c9ef..0000000
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/transaction/TransactionStatus.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.ons.api.transaction;
-
-
-public enum TransactionStatus {
-
-    CommitTransaction,
-
-    RollbackTransaction,
-
-    Unknow
-}
diff --git a/ons-core/ons-client/pom.xml b/ons-core/ons-client/pom.xml
index 0bcab99..057bce5 100644
--- a/ons-core/ons-client/pom.xml
+++ b/ons-core/ons-client/pom.xml
@@ -15,7 +15,8 @@
   limitations under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-all</artifactId>
@@ -36,9 +37,9 @@
             <artifactId>commons-codec</artifactId>
         </dependency>
         <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>ons-api</artifactId>
-            <version>${project.version}</version>
+            <groupId>io.openmessaging</groupId>
+            <artifactId>openmessaging-api</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
similarity index 75%
rename from ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
rename to ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
index 4fca00e..05cb230 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
+++ b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
@@ -15,18 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.rocketmq.ons.api.impl;
+package io.openmessaging.rocketmq;
 
+import io.openmessaging.Constants;
+import io.openmessaging.Consumer;
+import io.openmessaging.Message;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.Producer;
+import io.openmessaging.PullConsumer;
+import io.openmessaging.batch.BatchConsumer;
+import io.openmessaging.order.OrderConsumer;
+import io.openmessaging.order.OrderProducer;
+import io.openmessaging.transaction.LocalTransactionChecker;
+import io.openmessaging.transaction.TransactionProducer;
+import io.openmessaging.transaction.TransactionStatus;
+import java.util.Properties;
 import org.apache.rocketmq.client.producer.LocalTransactionState;
 import org.apache.rocketmq.client.producer.TransactionCheckListener;
 import org.apache.rocketmq.common.message.MessageExt;
-import java.util.Properties;
-import org.apache.rocketmq.ons.api.Constants;
-import org.apache.rocketmq.ons.api.Consumer;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactoryAPI;
-import org.apache.rocketmq.ons.api.Producer;
-import org.apache.rocketmq.ons.api.batch.BatchConsumer;
 import org.apache.rocketmq.ons.api.impl.rocketmq.BatchConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ONSUtil;
@@ -34,19 +40,33 @@ import org.apache.rocketmq.ons.api.impl.rocketmq.OrderConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.OrderProducerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ProducerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.TransactionProducerImpl;
-import org.apache.rocketmq.ons.api.order.OrderConsumer;
-import org.apache.rocketmq.ons.api.order.OrderProducer;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
-import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
-import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
 
-public class ONSFactoryImpl implements ONSFactoryAPI {
+public class MessagingAccessPointImpl implements MessagingAccessPoint {
+
+    private Properties attributes;
+
+    public MessagingAccessPointImpl(Properties attributes) {
+        this.attributes = attributes;
+    }
+
+    @Override
+    public String version() {
+        return "1.1.3";
+    }
+
+    @Override public Properties attributes() {
+        return null;
+    }
+
+    @Override public PullConsumer createPullConsumer(Properties properties) {
+        return null;
+    }
+
     @Override
     public Producer createProducer(final Properties properties) {
         return new ProducerImpl(ONSUtil.extractProperties(properties));
     }
 
-
     @Override
     public Consumer createConsumer(final Properties properties) {
         return new ConsumerImpl(ONSUtil.extractProperties(properties));
@@ -62,7 +82,6 @@ public class ONSFactoryImpl implements ONSFactoryAPI {
         return new OrderProducerImpl(ONSUtil.extractProperties(properties));
     }
 
-
     @Override
     public OrderConsumer createOrderedConsumer(final Properties properties) {
         return new OrderConsumerImpl(ONSUtil.extractProperties(properties));
@@ -70,7 +89,7 @@ public class ONSFactoryImpl implements ONSFactoryAPI {
 
     @Override
     public TransactionProducer createTransactionProducer(Properties properties,
-                                                         final LocalTransactionChecker checker) {
+        final LocalTransactionChecker checker) {
         return new TransactionProducerImpl(ONSUtil.extractProperties(properties), new TransactionCheckListener() {
             @Override
             public LocalTransactionState checkLocalTransactionState(MessageExt msg) {
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/constant/PropertyKeyConst.java
similarity index 97%
rename from ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
rename to ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/constant/PropertyKeyConst.java
index 6862189..ce4cf50 100644
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/constant/PropertyKeyConst.java
@@ -14,11 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.rocketmq.ons.api;
+package org.apache.rocketmq.ons.api.impl.constant;
 
-import javax.annotation.Generated;
-
-@Generated("ons-api")
 public class PropertyKeyConst {
 
     public static final String MessageModel = "MessageModel";
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
index 592a40c..8a77c5e 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
@@ -17,6 +17,14 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Action;
+import io.openmessaging.Constants;
+import io.openmessaging.ConsumeContext;
+import io.openmessaging.Message;
+import io.openmessaging.PropertyValueConst;
+import io.openmessaging.batch.BatchConsumer;
+import io.openmessaging.batch.BatchMessageListener;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -31,16 +39,7 @@ import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.message.MessageExt;
 import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
-
-import org.apache.rocketmq.ons.api.Action;
-import org.apache.rocketmq.ons.api.Constants;
-import org.apache.rocketmq.ons.api.ConsumeContext;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.PropertyValueConst;
-import org.apache.rocketmq.ons.api.batch.BatchConsumer;
-import org.apache.rocketmq.ons.api.batch.BatchMessageListener;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 
 @Generated("ons-client")
 public class BatchConsumerImpl extends ONSConsumerAbstract implements BatchConsumer {
@@ -74,11 +73,11 @@ public class BatchConsumerImpl extends ONSConsumerAbstract implements BatchConsu
     @Override
     public void subscribe(String topic, String subExpression, BatchMessageListener listener) {
         if (null == topic) {
-            throw new ONSClientException("topic is null");
+            throw new OMSRuntimeException("topic is null");
         }
 
         if (null == listener) {
-            throw new ONSClientException("listener is null");
+            throw new OMSRuntimeException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, subExpression);
@@ -110,7 +109,7 @@ public class BatchConsumerImpl extends ONSConsumerAbstract implements BatchConsu
 
             BatchMessageListener listener = BatchConsumerImpl.this.subscribeTable.get(msgList.get(0).getTopic());
             if (null == listener) {
-                throw new ONSClientException("BatchMessageListener is null");
+                throw new OMSRuntimeException("BatchMessageListener is null");
             }
 
             final ConsumeContext context = new ConsumeContext();
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
index 415482f..0c5c696 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
@@ -17,11 +17,20 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Action;
+import io.openmessaging.Constants;
+import io.openmessaging.ConsumeContext;
+import io.openmessaging.Consumer;
+import io.openmessaging.Message;
+import io.openmessaging.MessageListener;
+import io.openmessaging.MessageSelector;
+import io.openmessaging.PropertyValueConst;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
 
+import java.util.concurrent.ConcurrentHashMap;
 import javax.annotation.Generated;
 
 import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
@@ -29,17 +38,7 @@ import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
 import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
 import org.apache.rocketmq.common.message.MessageExt;
 import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
-
-import org.apache.rocketmq.ons.api.Action;
-import org.apache.rocketmq.ons.api.Constants;
-import org.apache.rocketmq.ons.api.ConsumeContext;
-import org.apache.rocketmq.ons.api.Consumer;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.MessageListener;
-import org.apache.rocketmq.ons.api.MessageSelector;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.PropertyValueConst;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 
 @Generated("ons-client")
 public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
@@ -64,11 +63,11 @@ public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
     @Override
     public void subscribe(String topic, String subExpression, MessageListener listener) {
         if (null == topic) {
-            throw new ONSClientException("topic is null");
+            throw new OMSRuntimeException("topic is null");
         }
 
         if (null == listener) {
-            throw new ONSClientException("listener is null");
+            throw new OMSRuntimeException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, subExpression);
@@ -77,11 +76,11 @@ public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
     @Override
     public void subscribe(final String topic, final MessageSelector selector, final MessageListener listener) {
         if (null == topic) {
-            throw new ONSClientException("topic is null");
+            throw new OMSRuntimeException("topic is null");
         }
 
         if (null == listener) {
-            throw new ONSClientException("listener is null");
+            throw new OMSRuntimeException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, selector);
@@ -111,7 +110,7 @@ public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
             }
             MessageListener listener = ConsumerImpl.this.subscribeTable.get(msg.getTopic());
             if (null == listener) {
-                throw new ONSClientException("MessageListener is null");
+                throw new OMSRuntimeException("MessageListener is null");
             }
 
             final ConsumeContext context = new ConsumeContext();
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
index 74735e6..1471c56 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
@@ -17,6 +17,9 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Credentials;
+import io.openmessaging.LifeCycle;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.util.Properties;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -30,10 +33,8 @@ import org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.namesrv.TopAddressing;
 import org.apache.rocketmq.logging.InternalLogger;
-import org.apache.rocketmq.ons.api.Admin;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.rocketmq.ons.api.impl.util.NameAddrUtils;
 import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
@@ -41,7 +42,7 @@ import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
 import static org.apache.rocketmq.common.UtilAll.getPid;
 
 @Generated("ons-client")
-public abstract class ONSClientAbstract implements Admin {
+public abstract class ONSClientAbstract implements LifeCycle, Credentials {
 
     protected static final String WSADDR_INTERNAL = System.getProperty("com.aliyun.openservices.ons.addr.internal",
         "http://onsaddr-internal.aliyun.com:8080/rocketmq/nsaddr4client-internal");
@@ -74,16 +75,16 @@ public abstract class ONSClientAbstract implements Admin {
         this.sessionCredentials.updateContent(properties);
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == this.sessionCredentials.getAccessKey() || "".equals(this.sessionCredentials.getAccessKey()))) {
-            throw new ONSClientException("please set access key");
+            throw new OMSRuntimeException("please set access key");
         }
 
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == this.sessionCredentials.getSecretKey() || "".equals(this.sessionCredentials.getSecretKey()))) {
-            throw new ONSClientException("please set secret key");
+            throw new OMSRuntimeException("please set secret key");
         }
 
         if (null == this.sessionCredentials.getOnsChannel()) {
-            throw new ONSClientException("please set ons channel");
+            throw new OMSRuntimeException("please set ons channel");
         }
 
         this.nameServerAddr = getNameSrvAddrFromProperties();
@@ -95,7 +96,7 @@ public abstract class ONSClientAbstract implements Admin {
         }
         this.nameServerAddr = fetchNameServerAddr();
         if (null == nameServerAddr) {
-            throw new ONSClientException(FAQ.errorMessage("Can not find name server, May be your network problem.", FAQ.FIND_NS_FAILED));
+            throw new OMSRuntimeException(FAQ.errorMessage("Can not find name server, May be your network problem.", FAQ.FIND_NS_FAILED));
         }
 
         this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@@ -139,7 +140,7 @@ public abstract class ONSClientAbstract implements Admin {
                     LOGGER.info("connected to user-defined ons addr server, {} success, {}", property, nsAddrs);
                     return nsAddrs;
                 } else {
-                    throw new ONSClientException(FAQ.errorMessage("Can not find name server with onsAddr " + property, FAQ.FIND_NS_FAILED));
+                    throw new OMSRuntimeException(FAQ.errorMessage("Can not find name server with onsAddr " + property, FAQ.FIND_NS_FAILED));
                 }
             }
         }
@@ -208,14 +209,14 @@ public abstract class ONSClientAbstract implements Admin {
     protected void checkONSProducerServiceState(DefaultMQProducerImpl producer) {
         switch (producer.getServiceState()) {
             case CREATE_JUST:
-                throw new ONSClientException(
+                throw new OMSRuntimeException(
                     FAQ.errorMessage(String.format("You do not have start the producer[" + getPid() + "], %s", producer.getServiceState()),
                         FAQ.SERVICE_STATE_WRONG));
             case SHUTDOWN_ALREADY:
-                throw new ONSClientException(FAQ.errorMessage(String.format("Your producer has been shut down, %s", producer.getServiceState()),
+                throw new OMSRuntimeException(FAQ.errorMessage(String.format("Your producer has been shut down, %s", producer.getServiceState()),
                     FAQ.SERVICE_STATE_WRONG));
             case START_FAILED:
-                throw new ONSClientException(FAQ.errorMessage(
+                throw new OMSRuntimeException(FAQ.errorMessage(
                     String.format("When you start your service throws an exception, %s", producer.getServiceState()), FAQ.SERVICE_STATE_WRONG));
             case RUNNING:
                 break;
@@ -240,13 +241,13 @@ public abstract class ONSClientAbstract implements Admin {
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == credentialProperties.getProperty(SessionCredentials.AccessKey)
                 || "".equals(credentialProperties.getProperty(SessionCredentials.AccessKey)))) {
-            throw new ONSClientException("update credential failed. please set access key.");
+            throw new OMSRuntimeException("update credential failed. please set access key.");
         }
 
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == credentialProperties.getProperty(SessionCredentials.SecretKey)
                 || "".equals(credentialProperties.getProperty(SessionCredentials.SecretKey)))) {
-            throw new ONSClientException("update credential failed. please set secret key");
+            throw new OMSRuntimeException("update credential failed. please set secret key");
         }
         this.sessionCredentials.updateContent(credentialProperties);
     }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
index 5844ebc..f9488d5 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
@@ -17,22 +17,20 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.MessageSelector;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.util.Properties;
-
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
-import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
 import org.apache.rocketmq.client.exception.MQClientException;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.logging.InternalLogger;
-
-import org.apache.rocketmq.ons.api.MessageSelector;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsConsumeMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
 import org.apache.rocketmq.remoting.protocol.LanguageCode;
 
 public class ONSConsumerAbstract extends ONSClientAbstract {
@@ -52,7 +50,7 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
 
         String consumerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ConsumerId));
         if (StringUtils.isEmpty(consumerGroup)) {
-            throw new ONSClientException("ConsumerId property is null");
+            throw new OMSRuntimeException("ConsumerId property is null");
         }
 
         this.defaultMQPushConsumer =
@@ -146,7 +144,7 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
         try {
             this.defaultMQPushConsumer.subscribe(topic, subExpression);
         } catch (MQClientException e) {
-            throw new ONSClientException("defaultMQPushConsumer subscribe exception", e);
+            throw new OMSRuntimeException("defaultMQPushConsumer subscribe exception", e);
         }
     }
 
@@ -155,7 +153,7 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
         String type = org.apache.rocketmq.common.filter.ExpressionType.TAG;
         if (selector != null) {
             if (selector.getType() == null) {
-                throw new ONSClientException("Expression type is null!");
+                throw new OMSRuntimeException("Expression type is null!");
             }
             subExpression = selector.getSubExpression();
             type = selector.getType().name();
@@ -167,13 +165,13 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
         } else if (org.apache.rocketmq.common.filter.ExpressionType.TAG.equals(type)) {
             messageSelector = org.apache.rocketmq.client.consumer.MessageSelector.byTag(subExpression);
         } else {
-            throw new ONSClientException(String.format("Expression type %s is unknown!", type));
+            throw new OMSRuntimeException(String.format("Expression type %s is unknown!", type));
         }
 
         try {
             this.defaultMQPushConsumer.subscribe(topic, messageSelector);
         } catch (MQClientException e) {
-            throw new ONSClientException("Consumer subscribe exception", e);
+            throw new OMSRuntimeException("Consumer subscribe exception", e);
         }
     }
 
@@ -189,7 +187,7 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
                 super.start();
             }
         } catch (Exception e) {
-            throw new ONSClientException(e.getMessage());
+            throw new OMSRuntimeException(e.getMessage());
         }
     }
 
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
index e6fac51..c90d9c3 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
@@ -17,6 +17,9 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Message;
+import io.openmessaging.MessageAccessor;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.lang.reflect.Field;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -24,20 +27,14 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
-
 import org.apache.rocketmq.common.message.MessageConst;
 import org.apache.rocketmq.common.message.MessageExt;
 
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.MessageAccessor;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-
 public class ONSUtil {
     private static final Set<String> RESERVED_KEY_SET_RMQ = new HashSet<String>();
 
     private static final Set<String> RESERVED_KEY_SET_ONS = new HashSet<String>();
 
-
     static {
 
         /**
@@ -68,11 +65,10 @@ public class ONSUtil {
         RESERVED_KEY_SET_ONS.add(Message.SystemPropKey.SHARDINGKEY);
     }
 
-
     public static org.apache.rocketmq.common.message.Message msgConvert(Message message) {
         org.apache.rocketmq.common.message.Message msgRMQ = new org.apache.rocketmq.common.message.Message();
         if (message == null) {
-            throw new ONSClientException("\'message\' is null");
+            throw new OMSRuntimeException("\'message\' is null");
         }
 
         if (message.getTopic() != null) {
@@ -102,7 +98,7 @@ public class ONSUtil {
                 Entry<Object, Object> next = it.next();
                 if (!RESERVED_KEY_SET_ONS.contains(next.getKey().toString())) {
                     org.apache.rocketmq.common.message.MessageAccessor.putProperty(msgRMQ, next.getKey().toString(),
-                            next.getValue().toString());
+                        next.getValue().toString());
                 }
             }
         }
@@ -114,7 +110,7 @@ public class ONSUtil {
                 Entry<Object, Object> next = it.next();
                 if (!RESERVED_KEY_SET_RMQ.contains(next.getKey().toString())) {
                     org.apache.rocketmq.common.message.MessageAccessor.putProperty(msgRMQ, next.getKey().toString(),
-                            next.getValue().toString());
+                        next.getValue().toString());
                 }
             }
         }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
index 4004f3e..d9c9b8a 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
@@ -17,6 +17,13 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Message;
+import io.openmessaging.MessageSelector;
+import io.openmessaging.exception.OMSRuntimeException;
+import io.openmessaging.order.ConsumeOrderContext;
+import io.openmessaging.order.MessageOrderListener;
+import io.openmessaging.order.OrderAction;
+import io.openmessaging.order.OrderConsumer;
 import java.util.List;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
@@ -26,15 +33,7 @@ import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyStatus;
 import org.apache.rocketmq.client.consumer.listener.MessageListenerOrderly;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.message.MessageExt;
-
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.MessageSelector;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-import org.apache.rocketmq.ons.api.order.ConsumeOrderContext;
-import org.apache.rocketmq.ons.api.order.MessageOrderListener;
-import org.apache.rocketmq.ons.api.order.OrderAction;
-import org.apache.rocketmq.ons.api.order.OrderConsumer;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 
 public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsumer {
     private final ConcurrentHashMap<String, MessageOrderListener> subscribeTable = new ConcurrentHashMap<String, MessageOrderListener>();
@@ -59,11 +58,11 @@ public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsu
     @Override
     public void subscribe(String topic, String subExpression, MessageOrderListener listener) {
         if (null == topic) {
-            throw new ONSClientException("topic is null");
+            throw new OMSRuntimeException("topic is null");
         }
 
         if (null == listener) {
-            throw new ONSClientException("listener is null");
+            throw new OMSRuntimeException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, subExpression);
@@ -72,11 +71,11 @@ public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsu
     @Override
     public void subscribe(final String topic, final MessageSelector selector, final MessageOrderListener listener) {
         if (null == topic) {
-            throw new ONSClientException("topic is null");
+            throw new OMSRuntimeException("topic is null");
         }
 
         if (null == listener) {
-            throw new ONSClientException("listener is null");
+            throw new OMSRuntimeException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, selector);
@@ -92,7 +91,7 @@ public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsu
 
             MessageOrderListener listener = OrderConsumerImpl.this.subscribeTable.get(msg.getTopic());
             if (null == listener) {
-                throw new ONSClientException("MessageOrderListener is null");
+                throw new OMSRuntimeException("MessageOrderListener is null");
             }
 
             final ConsumeOrderContext context = new ConsumeOrderContext();
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
index 651c65b..d46b769 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
@@ -17,25 +17,24 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Message;
+import io.openmessaging.SendResult;
+import io.openmessaging.exception.OMSRuntimeException;
+import io.openmessaging.order.OrderProducer;
 import java.util.List;
 import java.util.Properties;
-
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
-import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.client.producer.DefaultMQProducer;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.message.MessageQueue;
 import org.apache.rocketmq.logging.InternalLogger;
 
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
-import org.apache.rocketmq.ons.api.order.OrderProducer;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
 import org.apache.rocketmq.remoting.protocol.LanguageCode;
 
 public class OrderProducerImpl extends ONSClientAbstract implements OrderProducer {
@@ -63,6 +62,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
 
 //        boolean addExtendUniqInfo = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.EXACTLYONCE_DELIVERY, "false"));
 //        this.defaultMQProducer.setAddExtendUniqInfo(addExtendUniqInfo);
+
         if (properties.containsKey(PropertyKeyConst.LANGUAGE_IDENTIFIER)) {
             int language = Integer.valueOf(properties.get(PropertyKeyConst.LANGUAGE_IDENTIFIER).toString());
             byte languageByte = (byte) language;
@@ -109,7 +109,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
                 super.start();
             }
         } catch (Exception e) {
-            throw new ONSClientException(e.getMessage());
+            throw new OMSRuntimeException(e.getMessage());
         }
     }
 
@@ -124,7 +124,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
     @Override
     public SendResult send(final Message message, final String shardingKey) {
         if (UtilAll.isBlank(shardingKey)) {
-            throw new ONSClientException("\'shardingKey\' is blank.");
+            throw new OMSRuntimeException("\'shardingKey\' is blank.");
         }
         message.setShardingKey(shardingKey);
         this.checkONSProducerServiceState(this.defaultMQProducer.getDefaultMQProducerImpl());
@@ -148,7 +148,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
             sendResult.setMessageId(sendResultRMQ.getMsgId());
             return sendResult;
         } catch (Exception e) {
-            throw new ONSClientException("defaultMQProducer send order exception", e);
+            throw new OMSRuntimeException("defaultMQProducer send order exception", e);
         }
     }
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index 08f104d..d40b785 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -17,9 +17,16 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Message;
+import io.openmessaging.OnExceptionContext;
+import io.openmessaging.Producer;
+import io.openmessaging.SendCallback;
+import io.openmessaging.SendResult;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
 
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
 import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
@@ -33,13 +40,7 @@ import org.apache.rocketmq.logging.InternalLogger;
 import org.apache.rocketmq.remoting.exception.RemotingConnectException;
 import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
 
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.OnExceptionContext;
-import org.apache.rocketmq.ons.api.Producer;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendCallback;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
+
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -74,6 +75,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
 //        if (properties.containsKey(PropertyKeyConst.EXACTLYONCE_DELIVERY)) {
 //            this.defaultMQProducer.setAddExtendUniqInfo(Boolean.valueOf(properties.get(PropertyKeyConst.EXACTLYONCE_DELIVERY).toString()));
 //        }
+
         if (properties.containsKey(PropertyKeyConst.LANGUAGE_IDENTIFIER)) {
             int language = Integer.valueOf(properties.get(PropertyKeyConst.LANGUAGE_IDENTIFIER).toString());
             byte languageByte = (byte) language;
@@ -121,7 +123,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
                 super.start();
             }
         } catch (Exception e) {
-            throw new ONSClientException(e.getMessage());
+            throw new OMSRuntimeException(e.getMessage());
         }
     }
 
@@ -200,7 +202,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
                 //String topic = new String(message.getTopic());
                 //String msgId = new String(message.getMsgID());
                 LOGGER.error(String.format("Send message async Exception, %s", message), e);
-                ONSClientException onsEx = checkProducerException(message.getTopic(), message.getMsgID(), e);
+                OMSRuntimeException onsEx = checkProducerException(message.getTopic(), message.getMsgID(), e);
                 OnExceptionContext context = new OnExceptionContext();
                 context.setTopic(message.getTopic());
                 context.setMessageId(message.getMsgID());
@@ -219,34 +221,39 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
         return sendResult;
     }
 
-    private ONSClientException checkProducerException(String topic, String msgId, Throwable e) {
+    @Override
+    public SendResult send(Message message, String shardingKey) {
+        return null;
+    }
+
+    private OMSRuntimeException checkProducerException(String topic, String msgId, Throwable e) {
         if (e instanceof MQClientException) {
             if (e.getCause() != null) {
                 if (e.getCause() instanceof RemotingConnectException) {
-                    return new ONSClientException(
+                    return new OMSRuntimeException(
                         FAQ.errorMessage(String.format("Connect broker failed, Topic=%s, msgId=%s", topic, msgId), FAQ.CONNECT_BROKER_FAILED));
                 } else if (e.getCause() instanceof RemotingTimeoutException) {
-                    return new ONSClientException(FAQ.errorMessage(String.format("Send message to broker timeout, %dms, Topic=%s, msgId=%s",
+                    return new OMSRuntimeException(FAQ.errorMessage(String.format("Send message to broker timeout, %dms, Topic=%s, msgId=%s",
                         this.defaultMQProducer.getSendMsgTimeout(), topic, msgId), FAQ.SEND_MSG_TO_BROKER_TIMEOUT));
                 } else if (e.getCause() instanceof MQBrokerException) {
                     MQBrokerException excep = (MQBrokerException) e.getCause();
-                    return new ONSClientException(FAQ.errorMessage(
+                    return new OMSRuntimeException(FAQ.errorMessage(
                         String.format("Receive a broker exception, Topic=%s, msgId=%s, %s", topic, msgId, excep.getErrorMessage()),
                         FAQ.BROKER_RESPONSE_EXCEPTION));
                 }
             } else {
                 MQClientException excep = (MQClientException) e;
                 if (-1 == excep.getResponseCode()) {
-                    return new ONSClientException(
+                    return new OMSRuntimeException(
                         FAQ.errorMessage(String.format("Topic does not exist, Topic=%s, msgId=%s", topic, msgId), FAQ.TOPIC_ROUTE_NOT_EXIST));
                 } else if (ResponseCode.MESSAGE_ILLEGAL == excep.getResponseCode()) {
-                    return new ONSClientException(
+                    return new OMSRuntimeException(
                         FAQ.errorMessage(String.format("ONS Client check message exception, Topic=%s, msgId=%s", topic, msgId),
                             FAQ.CLIENT_CHECK_MSG_EXCEPTION));
                 }
             }
         }
 
-        return new ONSClientException("defaultMQProducer send exception", e);
+        return new OMSRuntimeException("defaultMQProducer send exception", e);
     }
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
index 13ed7e4..3c44f14 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
@@ -17,6 +17,12 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Constants;
+import io.openmessaging.Message;
+import io.openmessaging.SendResult;
+import io.openmessaging.transaction.LocalTransactionExecutor;
+import io.openmessaging.transaction.TransactionProducer;
+import io.openmessaging.transaction.TransactionStatus;
 import java.util.Properties;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.client.exception.MQClientException;
@@ -25,15 +31,9 @@ import org.apache.rocketmq.client.producer.TransactionCheckListener;
 import org.apache.rocketmq.client.producer.TransactionMQProducer;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.logging.InternalLogger;
-import org.apache.rocketmq.ons.api.Constants;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendResult;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionExecuter;
-import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
-import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
 import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
@@ -123,7 +123,7 @@ public class TransactionProducerImpl extends ONSClientAbstract implements Transa
     }
 
     @Override
-    public SendResult send(final Message message, final LocalTransactionExecuter executer, Object arg) {
+    public SendResult send(final Message message, final LocalTransactionExecutor executer, Object arg) {
         this.checkONSProducerServiceState(this.transactionMQProducer.getDefaultMQProducerImpl());
         org.apache.rocketmq.common.message.Message msgRMQ = ONSUtil.msgConvert(message);
         org.apache.rocketmq.client.producer.TransactionSendResult sendResultRMQ = null;
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsClientSendMessageHookImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsClientSendMessageHookImpl.java
index c6fbe10..6385ad9 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsClientSendMessageHookImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/tracehook/OnsClientSendMessageHookImpl.java
@@ -17,17 +17,16 @@
 package org.apache.rocketmq.ons.api.impl.tracehook;
 
 import java.util.ArrayList;
-
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceBean;
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceContext;
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceType;
-import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
 import org.apache.rocketmq.client.hook.SendMessageContext;
 import org.apache.rocketmq.client.hook.SendMessageHook;
 import org.apache.rocketmq.client.producer.SendStatus;
 import org.apache.rocketmq.common.MixAll;
 import org.apache.rocketmq.common.protocol.NamespaceUtil;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceBean;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceContext;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
 
 public class OnsClientSendMessageHookImpl implements SendMessageHook {
 
diff --git a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
index e04d890..52e7d2d 100644
--- a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
+++ b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
@@ -17,77 +17,83 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import org.apache.rocketmq.ons.api.Consumer;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.Producer;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-import org.apache.rocketmq.ons.api.order.OrderProducer;
+import io.openmessaging.Consumer;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
+import io.openmessaging.Producer;
+import io.openmessaging.exception.OMSRuntimeException;
+import io.openmessaging.order.OrderProducer;
+import java.util.Properties;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.rules.ExpectedException;
 
-import java.util.Properties;
-
 public class NameServerAutoUpdateTest {
 
     @Rule
     public ExpectedException expectedException = ExpectedException.none();
 
+    private MessagingAccessPoint messagingAccessPoint;
+
+    @Before
+    public void init() {
+        messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+    }
+
     @org.junit.Test
     public void testNamesrv_setNsAddr() {
         Properties prop = buildProps();
         prop.setProperty(PropertyKeyConst.NAMESRV_ADDR, "xxx-whatever");
-        Consumer consumer = ONSFactory.createConsumer(prop);
+        Consumer consumer = messagingAccessPoint.createConsumer(prop);
         consumer.start();
     }
 
     @org.junit.Test
     public void testNamesrv_setOnsAddr_invalid() {
-        expectedException.expect(ONSClientException.class);
+        expectedException.expect(OMSRuntimeException.class);
         expectedException.expectMessage("onsAddr " + "xxx");
 
         Properties prop = buildProps();
         prop.setProperty(PropertyKeyConst.ONSAddr, "xxx");
-        Consumer consumer = ONSFactory.createConsumer(prop);
+        Consumer consumer = messagingAccessPoint.createConsumer(prop);
         consumer.start();
     }
 
     @org.junit.Test
     public void testNamesrv_setOnsAddr_valid() throws InterruptedException {
         Properties prop = buildProps();
-        prop.setProperty(PropertyKeyConst.ONSAddr, "http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet");
-        Consumer consumer = ONSFactory.createConsumer(prop);
+        prop.setProperty(PropertyKeyConst.ONSAddr, "http://xxxx/rocketmq/nsaddr4client-internet");
+        Consumer consumer = messagingAccessPoint.createConsumer(prop);
         consumer.start();
     }
 
     @org.junit.Test
     public void testNamesrv_notSetOnsAddr_useInternet_default() throws InterruptedException {
         Properties prop = buildProps();
-        Consumer consumer = ONSFactory.createConsumer(prop);
+        Consumer consumer = messagingAccessPoint.createConsumer(prop);
         consumer.start();
     }
 
     @org.junit.Test
     public void testNamesrv_notSetOnsAddr_useInternet_default_Producer() throws InterruptedException {
         Properties prop = buildProps();
-        Producer producer = ONSFactory.createProducer(prop);
+        Producer producer = messagingAccessPoint.createProducer(prop);
         producer.start();
     }
 
     @org.junit.Test
     public void testNamesrv_notSetOnsAddr_useInternet_default_OrderProcucer() throws InterruptedException {
         Properties prop = buildProps();
-        OrderProducer producer = ONSFactory.createOrderProducer(prop);
+        OrderProducer producer = messagingAccessPoint.createOrderProducer(prop);
         producer.start();
     }
 
     private static Properties buildProps() {
         Properties properties = new Properties();
 
-        properties.put(PropertyKeyConst.ConsumerId, "metaq-consumer-01_SELF");
-        // 鉴权用 AccessKey,在阿里云服务器管理控制台创建
+        properties.put(PropertyKeyConst.GROUP_ID, "group");
         properties.put(PropertyKeyConst.AccessKey, "XXX");
-        // 鉴权用 SecretKey,在阿里云服务器管理控制台创建
         properties.put(PropertyKeyConst.SecretKey, "XXX");
         return properties;
     }
diff --git a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
index 245fddd..8a7386d 100644
--- a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
+++ b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
@@ -17,20 +17,23 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
+import io.openmessaging.Consumer;
+import io.openmessaging.Message;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
+import io.openmessaging.OMSBuiltinKeys;
+import io.openmessaging.Producer;
+import io.openmessaging.SendResult;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.Consumer;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.Producer;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.remoting.netty.NettyRemotingClient;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -38,6 +41,14 @@ public class ONSClientTokenUpdateTest {
 
     private static final String TOPIC = "STS_TOPIC_TEST_MOLING";
 
+    private MessagingAccessPoint messagingAccessPoint;
+
+    @Before
+    public void init() {
+        messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+    }
+
+
     @Ignore
     public void testSend() throws InterruptedException {
 
@@ -62,7 +73,7 @@ public class ONSClientTokenUpdateTest {
             }
         };
 
-        Producer producer = ONSFactory.createProducer(buildProps(
+        Producer producer = messagingAccessPoint.createProducer(buildProps(
             "ak",
             "sk",
             "token",
@@ -88,15 +99,15 @@ public class ONSClientTokenUpdateTest {
 
     @Test
     public void test_ConsumerImpl() throws NoSuchFieldException, IllegalAccessException {
-        Consumer consumer = ONSFactory.createConsumer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
+        Consumer consumer = messagingAccessPoint.createConsumer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
         ONSConsumerAbstract subImpl = (ONSConsumerAbstract) consumer;
         consumer.start();
 
         Assert.assertTrue(subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient() instanceof NettyRemotingClient);
         NettyRemotingClient remotingClient =
             (NettyRemotingClient) subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient();
-        Assert.assertTrue(remotingClient.getRPCHooks() instanceof ClientRPCHook);
-        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks();
+        Assert.assertTrue(remotingClient.getRPCHooks() instanceof List);
+        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks().get(0);
         Field field = ClientRPCHook.class.getDeclaredField("sessionCredentials");
         field.setAccessible(true);
         SessionCredentials credentials = (SessionCredentials) field.get(clientRPCHook);
@@ -116,15 +127,15 @@ public class ONSClientTokenUpdateTest {
 
     @Test
     public void test_ProducerImpl() throws NoSuchFieldException, IllegalAccessException {
-        Producer producer = ONSFactory.createProducer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
+        Producer producer = messagingAccessPoint.createProducer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
         ProducerImpl subImpl = (ProducerImpl) producer;
         producer.start();
 
         Assert.assertTrue(subImpl.getDefaultMQProducer().getDefaultMQProducerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient() instanceof NettyRemotingClient);
         NettyRemotingClient remotingClient =
             (NettyRemotingClient) subImpl.getDefaultMQProducer().getDefaultMQProducerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient();
-        Assert.assertTrue(remotingClient.getRPCHooks() instanceof ClientRPCHook);
-        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks();
+        Assert.assertTrue(remotingClient.getRPCHooks() instanceof List);
+        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks().get(0);
         Field field = ClientRPCHook.class.getDeclaredField("sessionCredentials");
         field.setAccessible(true);
         SessionCredentials credentials = (SessionCredentials) field.get(clientRPCHook);
@@ -144,15 +155,15 @@ public class ONSClientTokenUpdateTest {
 
     @Test
     public void test_ConsumerImpl_updateNull() throws NoSuchFieldException, IllegalAccessException {
-        Consumer consumer = ONSFactory.createConsumer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
+        Consumer consumer = messagingAccessPoint.createConsumer(buildProps("ak", "sk", "token", ONSChannel.ALIYUN.name()));
         ONSConsumerAbstract subImpl = (ONSConsumerAbstract) consumer;
         consumer.start();
 
         Assert.assertTrue(subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient() instanceof NettyRemotingClient);
         NettyRemotingClient remotingClient =
             (NettyRemotingClient) subImpl.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getmQClientFactory().getMQClientAPIImpl().getRemotingClient();
-        Assert.assertTrue(remotingClient.getRPCHooks() instanceof ClientRPCHook);
-        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks();
+        Assert.assertTrue(remotingClient.getRPCHooks() instanceof List);
+        ClientRPCHook clientRPCHook = (ClientRPCHook) remotingClient.getRPCHooks().get(0);
         Field field = ClientRPCHook.class.getDeclaredField("sessionCredentials");
         field.setAccessible(true);
         SessionCredentials credentials = (SessionCredentials) field.get(clientRPCHook);
@@ -165,7 +176,7 @@ public class ONSClientTokenUpdateTest {
         try {
             consumer.updateCredential(buildProps("nak", "", "ntoken", ONSChannel.CLOUD.name()));
         } catch (Exception e) {
-            Assert.assertTrue(e instanceof ONSClientException);
+            Assert.assertTrue(e instanceof OMSRuntimeException);
         }
 
         Assert.assertEquals("ak", credentials.getAccessKey());
diff --git a/ons-core/pom.xml b/ons-core/pom.xml
index 27e4142..f93ca53 100644
--- a/ons-core/pom.xml
+++ b/ons-core/pom.xml
@@ -30,7 +30,6 @@
     <description>https://github.com/alibaba/RocketMQ/blob/develop/README.md</description>
     <modules>
         <module>ons-client</module>
-        <module>ons-api</module>
         <module>ons-trace-core</module>
         <module>ons-auth4client</module>
     </modules>
@@ -41,11 +40,11 @@
         <maven.jdoc.skip>true</maven.jdoc.skip>
         <downloadSources>true</downloadSources>
         <!-- compiler settings properties -->
-        <java_source_version>1.6</java_source_version>
-        <java_target_version>1.6</java_target_version>
+        <java_source_version>1.8</java_source_version>
+        <java_target_version>1.8</java_target_version>
         <file_encoding>UTF-8</file_encoding>
         <!-- Always use stable version of RocketMQ -->
-        <rocketmq.version>4.5.1</rocketmq.version>
+        <rocketmq.version>4.5.2</rocketmq.version>
         <auth.version>${project.version}</auth.version>
         <spring.version>4.1.2.RELEASE</spring.version>
         <diamond.version>3.7.4</diamond.version>
@@ -218,11 +217,6 @@
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
-                <artifactId>ons-api</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
                 <artifactId>ons-client</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/ons-sample/pom.xml b/ons-sample/pom.xml
index 710b0af..7846256 100644
--- a/ons-sample/pom.xml
+++ b/ons-sample/pom.xml
@@ -30,13 +30,13 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
-            <artifactId>ons-api</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <artifactId>ons-client</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.rocketmq</groupId>
-            <artifactId>ons-client</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <groupId>io.openmessaging</groupId>
+            <artifactId>openmessaging-api</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
index 1205ce9..90c3f4b 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
@@ -16,10 +16,10 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
-import org.apache.rocketmq.ons.api.Action;
-import org.apache.rocketmq.ons.api.ConsumeContext;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.MessageListener;
+import io.openmessaging.Action;
+import io.openmessaging.ConsumeContext;
+import io.openmessaging.Message;
+import io.openmessaging.MessageListener;
 
 public class MessageListenerImpl implements MessageListener {
     @Override
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
index df95829..513a67b 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
@@ -16,22 +16,24 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
-
+import io.openmessaging.Consumer;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.Consumer;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleMQConsumer {
 
     public static void main(String[] args) {
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+
         Properties consumerProperties = new Properties();
         consumerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         consumerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
-        Consumer consumer = ONSFactory.createConsumer(consumerProperties);
+        Consumer consumer = messagingAccessPoint.createConsumer(consumerProperties);
         consumer.subscribe(MQConfig.TOPIC, MQConfig.TAG, new MessageListenerImpl());
         consumer.start();
         System.out.printf("Consumer start success. %n");
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
index b51a6a0..35a9458 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
@@ -16,25 +16,27 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
+import io.openmessaging.Message;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
+import io.openmessaging.order.ConsumeOrderContext;
+import io.openmessaging.order.MessageOrderListener;
+import io.openmessaging.order.OrderAction;
+import io.openmessaging.order.OrderConsumer;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.order.ConsumeOrderContext;
-import org.apache.rocketmq.ons.api.order.MessageOrderListener;
-import org.apache.rocketmq.ons.api.order.OrderAction;
-import org.apache.rocketmq.ons.api.order.OrderConsumer;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleOrderConsumer {
 
     public static void main(String[] args) {
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
         Properties consumerProperties = new Properties();
         consumerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.ORDER_GROUP_ID);
         consumerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         consumerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         consumerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
-        OrderConsumer consumer = ONSFactory.createOrderedConsumer(consumerProperties);
+        OrderConsumer consumer = messagingAccessPoint.createOrderedConsumer(consumerProperties);
         consumer.subscribe(MQConfig.ORDER_TOPIC, MQConfig.TAG, new MessageOrderListener() {
 
             @Override
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
index f21db81..1d76cf6 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
@@ -16,9 +16,9 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionChecker;
-import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
+import io.openmessaging.Message;
+import io.openmessaging.transaction.LocalTransactionChecker;
+import io.openmessaging.transaction.TransactionStatus;
 
 public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
index 26a6bf2..aa9f7f2 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
@@ -16,23 +16,26 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
+import io.openmessaging.Message;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
+import io.openmessaging.Producer;
+import io.openmessaging.SendResult;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.Producer;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class MQTimerProducer {
     public static void main(String[] args) {
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
-        Producer producer = ONSFactory.createProducer(producerProperties);
+        Producer producer = messagingAccessPoint.createProducer(producerProperties);
         producer.start();
         System.out.printf("Producer Started. %n");
 
@@ -44,7 +47,7 @@ public class MQTimerProducer {
                 SendResult sendResult = producer.send(message);
                 assert sendResult != null;
                 System.out.printf("Send mq timer message success! Topic is: %s msgId is: %s%n", MQConfig.TOPIC, sendResult.getMessageId());
-            } catch (ONSClientException e) {
+            } catch (OMSRuntimeException e) {
                 System.out.printf("Send mq message failed. Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
index e3cb192..8d25ef4 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
@@ -16,25 +16,28 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
+import io.openmessaging.Message;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
+import io.openmessaging.Producer;
+import io.openmessaging.SendResult;
+import io.openmessaging.exception.OMSRuntimeException;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.Producer;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleMQProducer {
 
 
     public static void main(String[] args) {
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
-        Producer producer = ONSFactory.createProducer(producerProperties);
+        Producer producer = messagingAccessPoint.createProducer(producerProperties);
         producer.start();
         System.out.printf("Producer Started %n");
 
@@ -44,7 +47,7 @@ public class SimpleMQProducer {
                 SendResult sendResult = producer.send(message);
                 assert sendResult != null;
                 System.out.printf("Send mq timer message success! Topic is: %s msgId is: %s%n", MQConfig.TOPIC, sendResult.getMessageId());
-            } catch (ONSClientException e) {
+            } catch (OMSRuntimeException e) {
                 System.out.printf("Send mq message failed. Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
index 43ab7f0..82282aa 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
@@ -16,24 +16,27 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
+import io.openmessaging.Message;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
+import io.openmessaging.SendResult;
+import io.openmessaging.exception.OMSRuntimeException;
+import io.openmessaging.order.OrderProducer;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-import org.apache.rocketmq.ons.api.order.OrderProducer;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleOrderProducer {
 
     public static void main(String[] args) {
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.ORDER_GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
-        OrderProducer producer = ONSFactory.createOrderProducer(producerProperties);
+        OrderProducer producer = messagingAccessPoint.createOrderProducer(producerProperties);
         producer.start();
         System.out.printf("Producer Started. %n");
 
@@ -46,7 +49,7 @@ public class SimpleOrderProducer {
                 SendResult sendResult = producer.send(msg, shardingKey);
                 assert sendResult != null;
                 System.out.printf("Send mq timer message success! Topic is: %s msgId is: %s%n", MQConfig.TOPIC, sendResult.getMessageId());
-            } catch (ONSClientException e) {
+            } catch (OMSRuntimeException e) {
                 System.out.printf("Send mq message failed. Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
index 4d16d51..c8790b9 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
@@ -16,35 +16,38 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
+import io.openmessaging.Message;
+import io.openmessaging.MessagingAccessPoint;
+import io.openmessaging.OMS;
+import io.openmessaging.SendResult;
+import io.openmessaging.exception.OMSRuntimeException;
+import io.openmessaging.transaction.LocalTransactionExecutor;
+import io.openmessaging.transaction.TransactionProducer;
+import io.openmessaging.transaction.TransactionStatus;
 import java.util.Date;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.Message;
-import org.apache.rocketmq.ons.api.ONSFactory;
-import org.apache.rocketmq.ons.api.PropertyKeyConst;
-import org.apache.rocketmq.ons.api.SendResult;
-import org.apache.rocketmq.ons.api.exception.ONSClientException;
-import org.apache.rocketmq.ons.api.transaction.LocalTransactionExecuter;
-import org.apache.rocketmq.ons.api.transaction.TransactionProducer;
-import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
+import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleTransactionProducer {
 
     public static void main(String[] args) {
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+
         Properties tranProducerProperties = new Properties();
         tranProducerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         tranProducerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         tranProducerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         tranProducerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         LocalTransactionCheckerImpl localTransactionChecker = new LocalTransactionCheckerImpl();
-        TransactionProducer transactionProducer = ONSFactory.createTransactionProducer(tranProducerProperties, localTransactionChecker);
+        TransactionProducer transactionProducer = messagingAccessPoint.createTransactionProducer(tranProducerProperties, localTransactionChecker);
         transactionProducer.start();
 
         Message message = new Message(MQConfig.TOPIC, MQConfig.TAG, "MQ send transaction message test".getBytes());
 
         for (int i = 0; i < 10; i++) {
             try {
-                SendResult sendResult = transactionProducer.send(message, new LocalTransactionExecuter() {
+                SendResult sendResult = transactionProducer.send(message, new LocalTransactionExecutor() {
                     @Override
                     public TransactionStatus execute(Message msg, Object arg) {
                         System.out.printf("Execute local transaction and return TransactionStatus. %n");
@@ -52,7 +55,7 @@ public class SimpleTransactionProducer {
                     }
                 }, null);
                 assert sendResult != null;
-            } catch (ONSClientException e) {
+            } catch (OMSRuntimeException e) {
                 System.out.printf(new Date() + " Send mq message failed! Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }


[rocketmq-ons] 14/36: Modify apache 2.0 license

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit b1be94d3095408a4a3204c83815c184a144ec738
Author: duhenglucky <du...@gmail.com>
AuthorDate: Mon Jul 1 16:55:00 2019 +0800

    Modify apache 2.0 license
---
 ons-sample/pom.xml                                     | 18 +++++++++++++++++-
 .../java/org/apache/rocketmq/ons/sample/MQConfig.java  | 13 ++++++++-----
 .../ons/sample/consumer/MessageListenerImpl.java       | 13 ++++++++-----
 .../sample/producer/LocalTransactionCheckerImpl.java   | 15 +++++++++++++++
 .../rocketmq/ons/sample/producer/MQTimerProducer.java  | 13 ++++++++-----
 .../ons/sample/producer/SimpleOrderProducer.java       | 13 ++++++++-----
 .../ons/sample/producer/SimpleTransactionProducer.java | 15 +++++++++++++++
 7 files changed, 79 insertions(+), 21 deletions(-)

diff --git a/ons-sample/pom.xml b/ons-sample/pom.xml
index 2cebaaf..8f52602 100644
--- a/ons-sample/pom.xml
+++ b/ons-sample/pom.xml
@@ -1,4 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
index 17937d4..a7d8094 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
@@ -1,14 +1,17 @@
 /**
  * Copyright (C) 2010-2016 Alibaba Group Holding Limited
  * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  * <p>
  * http://www.apache.org/licenses/LICENSE-2.0
  * <p>
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.rocketmq.ons.sample;
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
index f51d16f..f8e8ec1 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
@@ -1,14 +1,17 @@
 /**
  * Copyright (C) 2010-2016 Alibaba Group Holding Limited
  * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  * <p>
  * http://www.apache.org/licenses/LICENSE-2.0
  * <p>
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
index 32a756f..f5dbd1a 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
@@ -1,3 +1,18 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.rocketmq.ons.sample.producer;
 
 import org.apache.rocketmq.ons.api.Message;
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
index 1f70ad3..471b8bd 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
@@ -1,14 +1,17 @@
 /**
  * Copyright (C) 2010-2016 Alibaba Group Holding Limited
  * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  * <p>
  * http://www.apache.org/licenses/LICENSE-2.0
  * <p>
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.rocketmq.ons.sample.producer;
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
index 550005c..dd0b3ae 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
@@ -1,14 +1,17 @@
 /**
  * Copyright (C) 2010-2016 Alibaba Group Holding Limited
  * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  * <p>
  * http://www.apache.org/licenses/LICENSE-2.0
  * <p>
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.rocketmq.ons.sample.producer;
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
index bbb97e3..4ab6805 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
@@ -1,3 +1,18 @@
+/**
+ * Copyright (C) 2010-2016 Alibaba Group Holding Limited
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.rocketmq.ons.sample.producer;
 
 import java.util.Date;


[rocketmq-ons] 16/36: Update README.md

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 17916c20cc615b67413919fa2488e1c327bccff5
Author: Heng Du <du...@gmail.com>
AuthorDate: Wed Jul 3 14:38:31 2019 +0800

    Update README.md
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index cae1bae..6ad473d 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 ## Overview
- Apache RocketMQ ons is a RocketMQ lightweight client.
+ Apache RocketMQ ONS is a RocketMQ lightweight client.
 
 ----------
 ## Contributing


[rocketmq-ons] 08/36: Merge pull request #2 from ShannonDing/fix_async_send

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 4a72b449741769f9e59f61e3a3a652c10630ffba
Merge: e28b1a9 2a87d33
Author: Heng Du <du...@gmail.com>
AuthorDate: Mon Jun 17 17:37:21 2019 +0800

    Merge pull request #2 from ShannonDing/fix_async_send
    
    Call onException instead when async sending with NULL topic

 .../apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)


[rocketmq-ons] 26/36: Merge pull request #7 from davidpdw/master

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 4e8d8fb280ae24524016ac88d21ecc699760e8f3
Merge: 6da9b49 efe9ba0
Author: Heng Du <du...@apache.org>
AuthorDate: Wed Jul 17 13:35:04 2019 +0800

    Merge pull request #7 from davidpdw/master
    
    fix spelling mistakes

 .../java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[rocketmq-ons] 22/36: [maven-release-plugin] prepare for next development iteration

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 6da9b49cc63035f6900148ca3b491707f398d836
Author: duhenglucky <du...@gmail.com>
AuthorDate: Fri Jul 12 11:09:03 2019 +0800

    [maven-release-plugin] prepare for next development iteration
---
 ons-core/ons-api/pom.xml         | 2 +-
 ons-core/ons-auth4client/pom.xml | 2 +-
 ons-core/ons-client/pom.xml      | 2 +-
 ons-core/ons-trace-core/pom.xml  | 2 +-
 ons-core/pom.xml                 | 2 +-
 ons-sample/pom.xml               | 6 +++---
 pom.xml                          | 4 ++--
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ons-core/ons-api/pom.xml b/ons-core/ons-api/pom.xml
index 95ba4c4..adbec96 100644
--- a/ons-core/ons-api/pom.xml
+++ b/ons-core/ons-api/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-all</artifactId>
-        <version>1.0.0</version>
+        <version>1.0.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>
diff --git a/ons-core/ons-auth4client/pom.xml b/ons-core/ons-auth4client/pom.xml
index 2c6db2a..fe24766 100644
--- a/ons-core/ons-auth4client/pom.xml
+++ b/ons-core/ons-auth4client/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <artifactId>ons-all</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.0.0</version>
+        <version>1.0.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>ons-auth4client</artifactId>
diff --git a/ons-core/ons-client/pom.xml b/ons-core/ons-client/pom.xml
index 0840795..0bcab99 100644
--- a/ons-core/ons-client/pom.xml
+++ b/ons-core/ons-client/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-all</artifactId>
-        <version>1.0.0</version>
+        <version>1.0.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>
diff --git a/ons-core/ons-trace-core/pom.xml b/ons-core/ons-trace-core/pom.xml
index 48f872d..579e842 100644
--- a/ons-core/ons-trace-core/pom.xml
+++ b/ons-core/ons-trace-core/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>ons-all</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.0.0</version>
+        <version>1.0.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>ons-trace-core</artifactId>
diff --git a/ons-core/pom.xml b/ons-core/pom.xml
index bfb2dc4..27e4142 100644
--- a/ons-core/pom.xml
+++ b/ons-core/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-parent</artifactId>
-        <version>1.0.0</version>
+        <version>1.0.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <inceptionYear>2012</inceptionYear>
diff --git a/ons-sample/pom.xml b/ons-sample/pom.xml
index bedea83..710b0af 100644
--- a/ons-sample/pom.xml
+++ b/ons-sample/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <artifactId>ons-parent</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.0.0</version>
+        <version>1.0.1-SNAPSHOT</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -31,12 +31,12 @@
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
             <artifactId>ons-api</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
             <artifactId>ons-client</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
     </dependencies>
 
diff --git a/pom.xml b/pom.xml
index 803a101..ec1c4fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.rocketmq</groupId>
     <artifactId>ons-parent</artifactId>
-    <version>1.0.0</version>
+    <version>1.0.1-SNAPSHOT</version>
     <packaging>pom</packaging>
     <name>ons-parent ${project.version}</name>
     <description>
@@ -274,6 +274,6 @@
         <url>git@github.com:apache/rocketmq-ons.git</url>
         <connection>scm:git:git@github.com:apache/rocketmq-ons.git</connection>
         <developerConnection>scm:git:git@github.com:apache/rocketmq-ons.git</developerConnection>
-        <tag>ons-parent-1.0.0</tag>
+        <tag>HEAD</tag>
     </scm>
 </project>


[rocketmq-ons] 07/36: Keep runtime exception throw

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 2a87d338e3fa56f54fa70fd1d335bd02150f0961
Author: ShannonDing <li...@163.com>
AuthorDate: Mon Jun 17 17:17:37 2019 +0800

    Keep runtime exception throw
---
 .../rocketmq/ons/api/impl/rocketmq/ProducerImpl.java       | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index 921861a..9710b33 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -169,13 +169,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
             message.setMsgID(MessageClientIDSetter.getUniqID(msgRMQ));
         } catch (Exception e) {
             LOGGER.error(String.format("Send message async Exception, %s", message), e);
-            //throw checkProducerException(message.getTopic(), message.getMsgID(), e);
-            ONSClientException clientException = checkProducerException(message.getTopic(), message.getMsgID(), e);
-            OnExceptionContext context = new OnExceptionContext();
-            context.setException(clientException);
-            context.setTopic(message.getTopic());
-            context.setMessageId(message.getMsgID());
-            sendCallback.onException(context);
+            throw checkProducerException(message.getTopic(), message.getMsgID(), e);
         }
     }
 
@@ -199,11 +193,11 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
             @Override
             public void onException(Throwable e) {
                 //String topic = new String(message.getTopic());
-                String msgId = new String(message.getMsgID());
-                ONSClientException onsEx = checkProducerException(message.getTopic(), msgId, e);
+                //String msgId = new String(message.getMsgID());
+                ONSClientException onsEx = checkProducerException(message.getTopic(), message.getMsgID(), e);
                 OnExceptionContext context = new OnExceptionContext();
                 context.setTopic(message.getTopic());
-                context.setMessageId(msgId);
+                context.setMessageId(message.getMsgID());
                 context.setException(onsEx);
                 sendCallback.onException(context);
             }


[rocketmq-ons] 06/36: Add language identifier to support native image for cpp

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit 47687022311b0167e5dfb817030090c21658244c
Author: ShannonDing <li...@163.com>
AuthorDate: Mon Jun 17 16:44:24 2019 +0800

    Add language identifier to support native image for cpp
---
 .../src/main/java/org/apache/rocketmq/ons/api/Message.java | 14 ++++++++++----
 .../java/org/apache/rocketmq/ons/api/PropertyKeyConst.java |  2 ++
 .../ons/api/impl/rocketmq/ONSConsumerAbstract.java         |  7 ++++++-
 .../rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java  |  7 ++++++-
 .../rocketmq/ons/api/impl/rocketmq/ProducerImpl.java       |  7 ++++++-
 .../ons/api/impl/rocketmq/TransactionProducerImpl.java     |  7 ++++++-
 6 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
index 5d1f999..db56b15 100644
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/Message.java
@@ -51,7 +51,7 @@ public class Message implements Serializable {
     }
 
 
-    void putSystemProperties(final String key, final String value) {
+    public void putSystemProperties(final String key, final String value) {
         if (null == this.systemProperties) {
             this.systemProperties = new Properties();
         }
@@ -102,7 +102,7 @@ public class Message implements Serializable {
     }
 
 
-    String getSystemProperties(final String key) {
+    public String getSystemProperties(final String key) {
         if (null != this.systemProperties) {
             return this.systemProperties.getProperty(key);
         }
@@ -135,15 +135,21 @@ public class Message implements Serializable {
         this.putSystemProperties(SystemPropKey.MSGID, msgid);
     }
 
-    Properties getSystemProperties() {
+    public Properties getSystemProperties() {
+        if (null == systemProperties) {
+            return new Properties();
+        }
         return systemProperties;
     }
 
-    void setSystemProperties(Properties systemProperties) {
+    public void setSystemProperties(Properties systemProperties) {
         this.systemProperties = systemProperties;
     }
 
     public Properties getUserProperties() {
+        if (null == userProperties) {
+            return new Properties();
+        }
         return userProperties;
     }
 
diff --git a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
index d98d49c..6862189 100644
--- a/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
+++ b/ons-core/ons-api/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
@@ -99,4 +99,6 @@ public class PropertyKeyConst {
 
     public static final String MAX_BATCH_MESSAGE_COUNT = "maxBatchMessageCount";
 
+    public static final String LANGUAGE_IDENTIFIER = "languageIdentifier";
+
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
index d2bb38b..5844ebc 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
@@ -33,6 +33,7 @@ import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsConsumeMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.remoting.protocol.LanguageCode;
 
 public class ONSConsumerAbstract extends ONSClientAbstract {
     final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
@@ -81,7 +82,11 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
 
         boolean isVipChannelEnabled = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.isVipChannelEnabled, "false"));
         this.defaultMQPushConsumer.setVipChannelEnabled(isVipChannelEnabled);
-
+        if (properties.containsKey(PropertyKeyConst.LANGUAGE_IDENTIFIER)) {
+            int language = Integer.valueOf(properties.get(PropertyKeyConst.LANGUAGE_IDENTIFIER).toString());
+            byte languageByte = (byte) language;
+            this.defaultMQPushConsumer.setLanguage(LanguageCode.valueOf(languageByte));
+        }
         String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
         this.defaultMQPushConsumer.setInstanceName(instanceName);
         this.defaultMQPushConsumer.setNamesrvAddr(this.getNameServerAddr());
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
index 218a8c2..651c65b 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
@@ -36,6 +36,7 @@ import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.rocketmq.ons.api.order.OrderProducer;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.remoting.protocol.LanguageCode;
 
 public class OrderProducerImpl extends ONSClientAbstract implements OrderProducer {
     private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
@@ -62,7 +63,11 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
 
 //        boolean addExtendUniqInfo = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.EXACTLYONCE_DELIVERY, "false"));
 //        this.defaultMQProducer.setAddExtendUniqInfo(addExtendUniqInfo);
-
+        if (properties.containsKey(PropertyKeyConst.LANGUAGE_IDENTIFIER)) {
+            int language = Integer.valueOf(properties.get(PropertyKeyConst.LANGUAGE_IDENTIFIER).toString());
+            byte languageByte = (byte) language;
+            this.defaultMQProducer.setLanguage(LanguageCode.valueOf(languageByte));
+        }
         String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
         this.defaultMQProducer.setInstanceName(instanceName);
         this.defaultMQProducer.setNamesrvAddr(this.getNameServerAddr());
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index bd1dede..2658c7a 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -43,6 +43,7 @@ import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.remoting.protocol.LanguageCode;
 
 public class ProducerImpl extends ONSClientAbstract implements Producer {
     private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
@@ -73,7 +74,11 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
 //        if (properties.containsKey(PropertyKeyConst.EXACTLYONCE_DELIVERY)) {
 //            this.defaultMQProducer.setAddExtendUniqInfo(Boolean.valueOf(properties.get(PropertyKeyConst.EXACTLYONCE_DELIVERY).toString()));
 //        }
-
+        if (properties.containsKey(PropertyKeyConst.LANGUAGE_IDENTIFIER)) {
+            int language = Integer.valueOf(properties.get(PropertyKeyConst.LANGUAGE_IDENTIFIER).toString());
+            byte languageByte = (byte) language;
+            this.defaultMQProducer.setLanguage(LanguageCode.valueOf(languageByte));
+        }
         String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
         this.defaultMQProducer.setInstanceName(instanceName);
         this.defaultMQProducer.setNamesrvAddr(this.getNameServerAddr());
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
index bc03867..13ed7e4 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
@@ -37,6 +37,7 @@ import org.apache.rocketmq.ons.api.transaction.TransactionStatus;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
 import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.rocketmq.remoting.protocol.LanguageCode;
 
 public class TransactionProducerImpl extends ONSClientAbstract implements TransactionProducer {
     private final static InternalLogger LOGGER = ClientLoggerUtil.getClientLogger();
@@ -55,7 +56,11 @@ public class TransactionProducerImpl extends ONSClientAbstract implements Transa
 
         boolean isVipChannelEnabled = Boolean.parseBoolean(properties.getProperty(PropertyKeyConst.isVipChannelEnabled, "false"));
         transactionMQProducer.setVipChannelEnabled(isVipChannelEnabled);
-
+        if (properties.containsKey(PropertyKeyConst.LANGUAGE_IDENTIFIER)) {
+            int language = Integer.valueOf(properties.get(PropertyKeyConst.LANGUAGE_IDENTIFIER).toString());
+            byte languageByte = (byte) language;
+            this.transactionMQProducer.setLanguage(LanguageCode.valueOf(languageByte));
+        }
         String instanceName = properties.getProperty(PropertyKeyConst.InstanceName, this.buildIntanceName());
         this.transactionMQProducer.setInstanceName(instanceName);
 


[rocketmq-ons] 31/36: feat(client) adapt to OpenMessaging api

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit c2b46201ef46bfb4dfefc1933f1c492c3eb8c734
Author: 翊名 <du...@alibaba-inc.com>
AuthorDate: Tue Nov 19 17:13:59 2019 +0800

    feat(client) adapt to OpenMessaging api
---
 ons-core/ons-auth4client/pom.xml                   |   2 +-
 ons-core/ons-client/pom.xml                        |   4 +-
 .../rocketmq/MessagingAccessPointImpl.java         |  46 +++--
 .../org/apache/rocketmq/ons/api/Constants.java     |  14 +-
 .../org/apache/rocketmq/ons/api/ONSFactory.java    | 225 +++++++++++++++++++++
 .../org/apache/rocketmq/ons/api/ONSFactoryAPI.java |  52 +++++
 .../api/{impl/constant => }/PropertyKeyConst.java  |  45 ++---
 .../rocketmq/ons/api/PropertyValueConst.java       |  17 +-
 .../ons/api/exception/ONSClientException.java      |  25 ++-
 .../apache/rocketmq/ons/api/impl/MQClientInfo.java |   5 +-
 .../rocketmq/ons/api/impl/ONSFactoryImpl.java}     |  54 ++---
 .../ons/api/impl/rocketmq/BatchConsumerImpl.java   |  26 +--
 .../ons/api/impl/rocketmq/ConsumerImpl.java        |  32 +--
 .../ons/api/impl/rocketmq/ONSClientAbstract.java   |  29 +--
 .../ons/api/impl/rocketmq/ONSConsumerAbstract.java |  21 +-
 .../rocketmq/ons/api/impl/rocketmq/ONSUtil.java    |   9 +-
 .../ons/api/impl/rocketmq/OrderConsumerImpl.java   |  27 +--
 .../ons/api/impl/rocketmq/OrderProducerImpl.java   |  19 +-
 .../ons/api/impl/rocketmq/ProducerImpl.java        |  58 +++---
 .../api/impl/rocketmq/TransactionProducerImpl.java |  19 +-
 .../services/io.openmessaging.api.ONSFactoryAPI    |   1 +
 .../impl/rocketmq/NameServerAutoUpdateTest.java    |  17 +-
 .../impl/rocketmq/ONSClientTokenUpdateTest.java    |  23 +--
 ons-core/ons-trace-core/pom.xml                    |   2 +-
 ons-core/pom.xml                                   |   2 +-
 ons-sample/pom.xml                                 |   4 +-
 .../org/apache/rocketmq/ons/sample/MQConfig.java   |   4 +-
 .../ons/sample/consumer/MessageListenerImpl.java   |   8 +-
 .../ons/sample/consumer/SimpleMQConsumer.java      |   9 +-
 .../ons/sample/consumer/SimpleOrderConsumer.java   |  17 +-
 .../producer/LocalTransactionCheckerImpl.java      |   6 +-
 .../ons/sample/producer/MQTimerProducer.java       |  18 +-
 .../ons/sample/producer/SimpleMQProducer.java      |  22 +-
 .../ons/sample/producer/SimpleOrderProducer.java   |  17 +-
 .../sample/producer/SimpleTransactionProducer.java |  24 ++-
 pom.xml                                            |   2 +-
 36 files changed, 586 insertions(+), 319 deletions(-)

diff --git a/ons-core/ons-auth4client/pom.xml b/ons-core/ons-auth4client/pom.xml
index fe24766..cfd6185 100644
--- a/ons-core/ons-auth4client/pom.xml
+++ b/ons-core/ons-auth4client/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <artifactId>ons-all</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.0.1-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>ons-auth4client</artifactId>
diff --git a/ons-core/ons-client/pom.xml b/ons-core/ons-client/pom.xml
index 057bce5..b9558d8 100644
--- a/ons-core/ons-client/pom.xml
+++ b/ons-core/ons-client/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-all</artifactId>
-        <version>1.0.1-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>
@@ -39,7 +39,7 @@
         <dependency>
             <groupId>io.openmessaging</groupId>
             <artifactId>openmessaging-api</artifactId>
-            <version>1.1.0-SNAPSHOT</version>
+            <version>1.2.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
diff --git a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
index 3a0a96b..bb90f64 100644
--- a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
+++ b/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
@@ -17,23 +17,26 @@
 
 package io.openmessaging.rocketmq;
 
-import io.openmessaging.Constants;
-import io.openmessaging.Consumer;
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMSResponseStatus;
-import io.openmessaging.Producer;
-import io.openmessaging.PullConsumer;
-import io.openmessaging.batch.BatchConsumer;
-import io.openmessaging.order.OrderConsumer;
-import io.openmessaging.order.OrderProducer;
-import io.openmessaging.transaction.LocalTransactionChecker;
-import io.openmessaging.transaction.TransactionProducer;
-import io.openmessaging.transaction.TransactionStatus;
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMSBuiltinKeys;
+import io.openmessaging.api.OMSResponseStatus;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.PullConsumer;
+import io.openmessaging.api.batch.BatchConsumer;
+import io.openmessaging.api.order.OrderConsumer;
+import io.openmessaging.api.order.OrderProducer;
+import io.openmessaging.api.transaction.LocalTransactionChecker;
+import io.openmessaging.api.transaction.TransactionProducer;
+import io.openmessaging.api.transaction.TransactionStatus;
 import java.util.Properties;
 import org.apache.rocketmq.client.producer.LocalTransactionState;
 import org.apache.rocketmq.client.producer.TransactionCheckListener;
 import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.impl.MQClientInfo;
 import org.apache.rocketmq.ons.api.impl.rocketmq.BatchConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ONSUtil;
@@ -52,45 +55,60 @@ public class MessagingAccessPointImpl implements MessagingAccessPoint {
 
     @Override
     public String version() {
-        return "1.1.3";
+        return MQClientInfo.currentVersion;
     }
 
     @Override public Properties attributes() {
         return null;
     }
 
+    private void injectNameServerAddress(Properties properties) {
+        if (properties.getProperty(PropertyKeyConst.NAMESRV_ADDR) == null) {
+            String nameServerAddress = this.attributes.getProperty(OMSBuiltinKeys.ACCESS_POINTS);
+            properties.put(PropertyKeyConst.NAMESRV_ADDR, nameServerAddress);
+        }
+    }
+
     @Override public PullConsumer createPullConsumer(Properties properties) {
+        injectNameServerAddress(properties);
+        properties.put(PropertyKeyConst.NAMESRV_ADDR, this.attributes.getProperty(OMSBuiltinKeys.ACCESS_POINTS));
         throw OMSResponseStatus.generateException(OMSResponseStatus.STATUS_1101);
     }
 
     @Override
     public Producer createProducer(final Properties properties) {
+        injectNameServerAddress(properties);
         return new ProducerImpl(ONSUtil.extractProperties(properties));
     }
 
     @Override
     public Consumer createConsumer(final Properties properties) {
+        injectNameServerAddress(properties);
         return new ConsumerImpl(ONSUtil.extractProperties(properties));
     }
 
     @Override
     public BatchConsumer createBatchConsumer(final Properties properties) {
+        injectNameServerAddress(properties);
         return new BatchConsumerImpl(ONSUtil.extractProperties(properties));
     }
 
     @Override
     public OrderProducer createOrderProducer(final Properties properties) {
+        injectNameServerAddress(properties);
         return new OrderProducerImpl(ONSUtil.extractProperties(properties));
     }
 
     @Override
     public OrderConsumer createOrderedConsumer(final Properties properties) {
+        injectNameServerAddress(properties);
         return new OrderConsumerImpl(ONSUtil.extractProperties(properties));
     }
 
     @Override
     public TransactionProducer createTransactionProducer(Properties properties,
         final LocalTransactionChecker checker) {
+        injectNameServerAddress(properties);
         return new TransactionProducerImpl(ONSUtil.extractProperties(properties), new TransactionCheckListener() {
             @Override
             public LocalTransactionState checkLocalTransactionState(MessageExt msg) {
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/Constants.java
similarity index 61%
copy from ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
copy to ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/Constants.java
index 1d76cf6..48d8f67 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/Constants.java
@@ -14,17 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.rocketmq.ons.sample.producer;
 
-import io.openmessaging.Message;
-import io.openmessaging.transaction.LocalTransactionChecker;
-import io.openmessaging.transaction.TransactionStatus;
+package org.apache.rocketmq.ons.api;
 
-public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
-
-    @Override
-    public TransactionStatus check(Message msg) {
-        System.out.printf("Receive transaction check back request, MsgId: %s%n", msg.getMsgID());
-        return TransactionStatus.CommitTransaction;
-    }
+public class Constants {
+    public static final String TRANSACTION_ID = "__transactionId__";
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
new file mode 100644
index 0000000..847a6ae
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactory.java
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.batch.BatchConsumer;
+import io.openmessaging.api.order.OrderConsumer;
+import io.openmessaging.api.order.OrderProducer;
+import io.openmessaging.api.transaction.LocalTransactionChecker;
+import io.openmessaging.api.transaction.TransactionProducer;
+import java.util.Properties;
+
+/**
+ * {@link OMS} is recommended.
+ */
+@Deprecated
+public class ONSFactory {
+
+    private static ONSFactoryAPI onsFactory = null;
+
+    static {
+
+        try {
+            Class<?> factoryClass =
+                ONSFactory.class.getClassLoader().loadClass(
+                    "org.apache.rocketmq.ons.api.impl.ONSFactoryImpl");
+            onsFactory = (ONSFactoryAPI) factoryClass.newInstance();
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * Create Producer
+     *
+     * <p>
+     * <code>properties</code>
+     * Require:
+     * <ol>
+     * <li>{@link PropertyKeyConst#GROUP_ID}</li>
+     * <li>{@link PropertyKeyConst#AccessKey}</li>
+     * <li>{@link PropertyKeyConst#SecretKey}</li>
+     * <li>{@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * Optional:
+     * <ol>
+     * <li>{@link PropertyKeyConst#OnsChannel}</li>
+     * <li>{@link PropertyKeyConst#SendMsgTimeoutMillis}</li>
+     * <li>{@link PropertyKeyConst#NAMESRV_ADDR} will override {@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * </p>
+     *
+     *
+     * <p>
+     * sample:
+     * <pre>
+     *        Properties props = ...;
+     *        Producer producer = ONSFactory.createProducer(props);
+     *        producer.start();
+     *
+     *
+     *        Message msg = ...;
+     *        SendResult result = producer.send(msg);
+     *
+     *        producer.shutdown();
+     *   </pre>
+     * </p>
+     *
+     * @param properties Producer's configuration
+     * @return {@link Producer}  Thread safe {@link Producer} instance
+     */
+    public static Producer createProducer(final Properties properties) {
+        return onsFactory.createProducer(properties);
+    }
+
+    /**
+     * Create OrderProducer
+     * <p>
+     * <code>properties</code>
+     * Require:
+     * <ol>
+     * <li>{@link PropertyKeyConst#GROUP_ID}</li>
+     * <li>{@link PropertyKeyConst#AccessKey}</li>
+     * <li>{@link PropertyKeyConst#SecretKey}</li>
+     * <li>{@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * Optional:
+     * <ul>
+     * <li>{@link PropertyKeyConst#NAMESRV_ADDR}</li>
+     * <li>{@link PropertyKeyConst#OnsChannel}</li>
+     * <li>{@link PropertyKeyConst#SendMsgTimeoutMillis}</li>
+     * </ul>
+     * </p>
+     *
+     * @param properties Producer configuration
+     * @return {@code OrderProducer} Thread safe {@link OrderProducer} instance
+     */
+    public static OrderProducer createOrderProducer(final Properties properties) {
+        return onsFactory.createOrderProducer(properties);
+    }
+
+    /**
+     * Create Transaction Producer
+     * <p>
+     * <code>properties</code>Requires:
+     * <ol>
+     * <li>{@link PropertyKeyConst#GROUP_ID}</li>
+     * <li>{@link PropertyKeyConst#AccessKey}</li>
+     * <li>{@link PropertyKeyConst#SecretKey}</li>
+     * <li>{@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * Optional:
+     * <ul>
+     * <li>{@link PropertyKeyConst#NAMESRV_ADDR}</li>
+     * <li>{@link PropertyKeyConst#OnsChannel}</li>
+     * <li>{@link PropertyKeyConst#SendMsgTimeoutMillis}</li>
+     * <li>{@link PropertyKeyConst#CheckImmunityTimeInSeconds}</li>
+     * </ul>
+     * </p>
+     *
+     * @param properties Producer configuration
+     * @return {@code TransactionProducer} Thread safe {@link TransactionProducer}  instance
+     */
+    public static TransactionProducer createTransactionProducer(final Properties properties,
+        final LocalTransactionChecker checker) {
+        return onsFactory.createTransactionProducer(properties, checker);
+    }
+
+    /**
+     * Create Consumer
+     * <p>
+     * <code>properties</code>
+     * Requires:
+     * <ol>
+     * <li>{@link PropertyKeyConst#GROUP_ID}</li>
+     * <li>{@link PropertyKeyConst#AccessKey}</li>
+     * <li>{@link PropertyKeyConst#SecretKey}</li>
+     * <li>{@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * Optional:
+     * <ul>
+     * <li>{@link PropertyKeyConst#ConsumeThreadNums}</li>
+     * <li>{@link PropertyKeyConst#ConsumeTimeout}</li>
+     * <li>{@link PropertyKeyConst#OnsChannel}</li>
+     * </ul>
+     * </p>
+     *
+     * @param properties Consumer's configuration
+     * @return {@code Consumer} Thread safe {@link Consumer} instance
+     */
+    public static Consumer createConsumer(final Properties properties) {
+        return onsFactory.createConsumer(properties);
+    }
+
+    /**
+     * Create BatchConsumer
+     * <p>
+     * <code>properties</code>
+     * Requires:
+     * <ol>
+     * <li>{@link PropertyKeyConst#GROUP_ID}</li>
+     * <li>{@link PropertyKeyConst#AccessKey}</li>
+     * <li>{@link PropertyKeyConst#SecretKey}</li>
+     * <li>{@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * Optional:
+     * <ul>
+     * <li>{@link PropertyKeyConst#ConsumeThreadNums}</li>
+     * <li>{@link PropertyKeyConst#ConsumeTimeout}</li>
+     * <li>{@link PropertyKeyConst#ConsumeMessageBatchMaxSize}</li>
+     * <li>{@link PropertyKeyConst#OnsChannel}</li>
+     * </ul>
+     * </p>
+     *
+     * @param properties BatchConsumer's configuration
+     * @return {@code BatchConsumer} Thread safe {@link BatchConsumer} instance
+     */
+    public static BatchConsumer createBatchConsumer(final Properties properties) {
+        return onsFactory.createBatchConsumer(properties);
+    }
+
+    /**
+     * Create Order Consumer
+     * <p>
+     * <code>properties</code>
+     * Requires:
+     * <ol>
+     * <li>{@link PropertyKeyConst#GROUP_ID}</li>
+     * <li>{@link PropertyKeyConst#AccessKey}</li>
+     * <li>{@link PropertyKeyConst#SecretKey}</li>
+     * <li>{@link PropertyKeyConst#ONSAddr}</li>
+     * </ol>
+     * Optional:
+     * <ul>
+     * <li>{@link PropertyKeyConst#ConsumeThreadNums}</li>
+     * <li>{@link PropertyKeyConst#ConsumeTimeout}</li>
+     * <li>{@link PropertyKeyConst#OnsChannel}</li>
+     * </ul>
+     * </p>
+     *
+     * @param properties Consumer's configuration
+     * @return {@code OrderConsumer} Thread safe {@link OrderConsumer} instance
+     */
+    public static OrderConsumer createOrderedConsumer(final Properties properties) {
+        return onsFactory.createOrderedConsumer(properties);
+    }
+
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
new file mode 100644
index 0000000..67186b4
--- /dev/null
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/ONSFactoryAPI.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.ons.api;
+
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.batch.BatchConsumer;
+import io.openmessaging.api.order.OrderConsumer;
+import io.openmessaging.api.order.OrderProducer;
+import io.openmessaging.api.transaction.LocalTransactionChecker;
+import io.openmessaging.api.transaction.TransactionProducer;
+import java.util.Properties;
+
+/**
+ * {@link MessagingAccessPoint} is recommended.
+ */
+@Deprecated
+public interface ONSFactoryAPI {
+
+    Producer createProducer(final Properties properties);
+
+
+    Consumer createConsumer(final Properties properties);
+
+
+    BatchConsumer createBatchConsumer(final Properties properties);
+
+
+    OrderProducer createOrderProducer(final Properties properties);
+
+
+    OrderConsumer createOrderedConsumer(final Properties properties);
+
+
+    TransactionProducer createTransactionProducer(final Properties properties,
+        final LocalTransactionChecker checker);
+}
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/constant/PropertyKeyConst.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
similarity index 74%
rename from ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/constant/PropertyKeyConst.java
rename to ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
index ce4cf50..b3d2670 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/constant/PropertyKeyConst.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/PropertyKeyConst.java
@@ -14,23 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.rocketmq.ons.api.impl.constant;
+package org.apache.rocketmq.ons.api;
 
-public class PropertyKeyConst {
+import io.openmessaging.api.OMSBuiltinKeys;
 
-    public static final String MessageModel = "MessageModel";
-
-    /**
-     * Deprecated, replaced with GROUP_ID
-     */
-    @Deprecated
-    public static final String ProducerId = "ProducerId";
+public class PropertyKeyConst implements OMSBuiltinKeys {
 
-    /**
-     * Deprecated, replaced with GROUP_ID
-     */
-    @Deprecated
-    public static final String ConsumerId = "ConsumerId";
+    public static final String MessageModel = "MessageModel";
 
     public static final String GROUP_ID = "GROUP_ID";
 
@@ -42,8 +32,10 @@ public class PropertyKeyConst {
 
     public static final String SendMsgTimeoutMillis = "SendMsgTimeoutMillis";
 
+    @Deprecated
     public static final String ONSAddr = "ONSAddr";
 
+    @Deprecated
     public static final String NAMESRV_ADDR = "NAMESRV_ADDR";
 
     public static final String ConsumeThreadNums = "ConsumeThreadNums";
@@ -72,30 +64,21 @@ public class PropertyKeyConst {
 
     public static final String InstanceName = "InstanceName";
 
-    public static final String MsgTraceSwitch = "MsgTraceSwitch";
-
-    public static final String MqttMessageId = "mqttMessageId";
-
-    public static final String MqttMessage = "mqttMessage";
-
-    public static final String MqttPublishRetain = "mqttRetain";
-
-    public static final String MqttPublishDubFlag = "mqttPublishDubFlag";
+    @Deprecated
+    public static final String EXACTLYONCE_DELIVERY = "exactlyOnceDelivery";
 
-    public static final String MqttSecondTopic = "mqttSecondTopic";
+    public static final String QOS = "qos";
 
-    public static final String MqttClientId = "clientId";
+    public static final String EXACTLYONCE_RM_REFRESHINTERVAL = "exactlyOnceRmRefreshInterval";
 
-    public static final String MqttQOS = "qoslevel";
+    public static final String MAX_BATCH_MESSAGE_COUNT = "maxBatchMessageCount";
 
-    public static final String INSTANCE_ID = "INSTANCE_ID";
+    public static final String INSTANCE_ID = "instanceId";
 
-    public static final String EXACTLYONCE_DELIVERY = "exactlyOnceDelivery";
+    public static final String LANGUAGE_IDENTIFIER = "languageIdentifier";
 
-    public static final String EXACTLYONCE_RM_REFRESHINTERVAL = "exactlyOnceRmRefreshInterval";
+    public static final String MsgTraceSwitch = "msgTraceSwitch";
 
-    public static final String MAX_BATCH_MESSAGE_COUNT = "maxBatchMessageCount";
 
-    public static final String LANGUAGE_IDENTIFIER = "languageIdentifier";
 
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java
similarity index 61%
copy from ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
copy to ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java
index 1d76cf6..c748447 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/PropertyValueConst.java
@@ -14,17 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.rocketmq.ons.sample.producer;
+package org.apache.rocketmq.ons.api;
 
-import io.openmessaging.Message;
-import io.openmessaging.transaction.LocalTransactionChecker;
-import io.openmessaging.transaction.TransactionStatus;
 
-public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
+public class PropertyValueConst {
 
-    @Override
-    public TransactionStatus check(Message msg) {
-        System.out.printf("Receive transaction check back request, MsgId: %s%n", msg.getMsgID());
-        return TransactionStatus.CommitTransaction;
-    }
+
+    public static final String BROADCASTING = "BROADCASTING";
+
+
+    public static final String CLUSTERING = "CLUSTERING";
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java
similarity index 62%
copy from ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
copy to ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java
index 1d76cf6..7f6daaf 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/exception/ONSClientException.java
@@ -14,17 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.rocketmq.ons.sample.producer;
+package org.apache.rocketmq.ons.api.exception;
 
-import io.openmessaging.Message;
-import io.openmessaging.transaction.LocalTransactionChecker;
-import io.openmessaging.transaction.TransactionStatus;
+import io.openmessaging.api.exception.OMSRuntimeException;
 
-public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
+public class ONSClientException extends OMSRuntimeException {
 
-    @Override
-    public TransactionStatus check(Message msg) {
-        System.out.printf("Receive transaction check back request, MsgId: %s%n", msg.getMsgID());
-        return TransactionStatus.CommitTransaction;
+    public ONSClientException() {
+    }
+
+    public ONSClientException(Throwable cause) {
+        super(cause);
+    }
+
+    public ONSClientException(String message) {
+        super(message);
+    }
+
+    public ONSClientException(String message, Throwable cause) {
+        super(message, cause);
     }
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/MQClientInfo.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/MQClientInfo.java
index 96ce1ca..aaca85c 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/MQClientInfo.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/MQClientInfo.java
@@ -24,14 +24,15 @@ import org.apache.rocketmq.common.MQVersion;
 public class MQClientInfo {
 
     public static int versionCode = MQVersion.CURRENT_VERSION;
+    public static String currentVersion;
 
     static {
         try {
             InputStream stream = MQClientInfo.class.getClassLoader().getResourceAsStream("ons_client_info.properties");
             Properties properties = new Properties();
             properties.load(stream);
-            String pkgVersion = String.valueOf(properties.get("version"));
-            versionCode = Integer.MAX_VALUE - Integer.valueOf(pkgVersion.replaceAll("[^0-9]", ""));
+            currentVersion = String.valueOf(properties.get("version"));
+            versionCode = Integer.MAX_VALUE - Integer.valueOf(currentVersion.replaceAll("[^0-9]", ""));
         } catch (Exception ignore) {
         }
     }
diff --git a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
similarity index 74%
copy from ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
copy to ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
index 3a0a96b..18ac9e4 100644
--- a/ons-core/ons-client/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/ONSFactoryImpl.java
@@ -14,26 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.rocketmq.ons.api.impl;
 
-package io.openmessaging.rocketmq;
-
-import io.openmessaging.Constants;
-import io.openmessaging.Consumer;
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMSResponseStatus;
-import io.openmessaging.Producer;
-import io.openmessaging.PullConsumer;
-import io.openmessaging.batch.BatchConsumer;
-import io.openmessaging.order.OrderConsumer;
-import io.openmessaging.order.OrderProducer;
-import io.openmessaging.transaction.LocalTransactionChecker;
-import io.openmessaging.transaction.TransactionProducer;
-import io.openmessaging.transaction.TransactionStatus;
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.batch.BatchConsumer;
+import io.openmessaging.api.order.OrderConsumer;
+import io.openmessaging.api.order.OrderProducer;
+import io.openmessaging.api.transaction.LocalTransactionChecker;
+import io.openmessaging.api.transaction.TransactionProducer;
+import io.openmessaging.api.transaction.TransactionStatus;
 import java.util.Properties;
 import org.apache.rocketmq.client.producer.LocalTransactionState;
 import org.apache.rocketmq.client.producer.TransactionCheckListener;
 import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.ONSFactoryAPI;
 import org.apache.rocketmq.ons.api.impl.rocketmq.BatchConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ConsumerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ONSUtil;
@@ -42,27 +40,11 @@ import org.apache.rocketmq.ons.api.impl.rocketmq.OrderProducerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.ProducerImpl;
 import org.apache.rocketmq.ons.api.impl.rocketmq.TransactionProducerImpl;
 
-public class MessagingAccessPointImpl implements MessagingAccessPoint {
-
-    private Properties attributes;
-
-    public MessagingAccessPointImpl(Properties attributes) {
-        this.attributes = attributes;
-    }
-
-    @Override
-    public String version() {
-        return "1.1.3";
-    }
-
-    @Override public Properties attributes() {
-        return null;
-    }
-
-    @Override public PullConsumer createPullConsumer(Properties properties) {
-        throw OMSResponseStatus.generateException(OMSResponseStatus.STATUS_1101);
-    }
-
+/**
+ * Recommend to use {@link OMS} to create Producer or Consumer instance.
+ */
+@Deprecated
+public class ONSFactoryImpl implements ONSFactoryAPI {
     @Override
     public Producer createProducer(final Properties properties) {
         return new ProducerImpl(ONSUtil.extractProperties(properties));
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
index 8a77c5e..81dd7ec 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/BatchConsumerImpl.java
@@ -17,14 +17,13 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Action;
-import io.openmessaging.Constants;
-import io.openmessaging.ConsumeContext;
-import io.openmessaging.Message;
-import io.openmessaging.PropertyValueConst;
-import io.openmessaging.batch.BatchConsumer;
-import io.openmessaging.batch.BatchMessageListener;
-import io.openmessaging.exception.OMSRuntimeException;
+
+import io.openmessaging.api.Action;
+import io.openmessaging.api.ConsumeContext;
+import io.openmessaging.api.Message;
+
+import io.openmessaging.api.batch.BatchConsumer;
+import io.openmessaging.api.batch.BatchMessageListener;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -39,7 +38,10 @@ import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.message.MessageExt;
 import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyValueConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 
 @Generated("ons-client")
 public class BatchConsumerImpl extends ONSConsumerAbstract implements BatchConsumer {
@@ -73,11 +75,11 @@ public class BatchConsumerImpl extends ONSConsumerAbstract implements BatchConsu
     @Override
     public void subscribe(String topic, String subExpression, BatchMessageListener listener) {
         if (null == topic) {
-            throw new OMSRuntimeException("topic is null");
+            throw new ONSClientException("topic is null");
         }
 
         if (null == listener) {
-            throw new OMSRuntimeException("listener is null");
+            throw new ONSClientException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, subExpression);
@@ -109,7 +111,7 @@ public class BatchConsumerImpl extends ONSConsumerAbstract implements BatchConsu
 
             BatchMessageListener listener = BatchConsumerImpl.this.subscribeTable.get(msgList.get(0).getTopic());
             if (null == listener) {
-                throw new OMSRuntimeException("BatchMessageListener is null");
+                throw new ONSClientException("BatchMessageListener is null");
             }
 
             final ConsumeContext context = new ConsumeContext();
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
index 0c5c696..8a45880 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ConsumerImpl.java
@@ -17,19 +17,16 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Action;
-import io.openmessaging.Constants;
-import io.openmessaging.ConsumeContext;
-import io.openmessaging.Consumer;
-import io.openmessaging.Message;
-import io.openmessaging.MessageListener;
-import io.openmessaging.MessageSelector;
-import io.openmessaging.PropertyValueConst;
-import io.openmessaging.exception.OMSRuntimeException;
+
+import io.openmessaging.api.Action;
+import io.openmessaging.api.ConsumeContext;
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessageListener;
+import io.openmessaging.api.MessageSelector;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-
 import java.util.concurrent.ConcurrentHashMap;
 import javax.annotation.Generated;
 
@@ -38,7 +35,10 @@ import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
 import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
 import org.apache.rocketmq.common.message.MessageExt;
 import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyValueConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 
 @Generated("ons-client")
 public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
@@ -63,11 +63,11 @@ public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
     @Override
     public void subscribe(String topic, String subExpression, MessageListener listener) {
         if (null == topic) {
-            throw new OMSRuntimeException("topic is null");
+            throw new ONSClientException("topic is null");
         }
 
         if (null == listener) {
-            throw new OMSRuntimeException("listener is null");
+            throw new ONSClientException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, subExpression);
@@ -76,11 +76,11 @@ public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
     @Override
     public void subscribe(final String topic, final MessageSelector selector, final MessageListener listener) {
         if (null == topic) {
-            throw new OMSRuntimeException("topic is null");
+            throw new ONSClientException("topic is null");
         }
 
         if (null == listener) {
-            throw new OMSRuntimeException("listener is null");
+            throw new ONSClientException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, selector);
@@ -110,7 +110,7 @@ public class ConsumerImpl extends ONSConsumerAbstract implements Consumer {
             }
             MessageListener listener = ConsumerImpl.this.subscribeTable.get(msg.getTopic());
             if (null == listener) {
-                throw new OMSRuntimeException("MessageListener is null");
+                throw new ONSClientException("MessageListener is null");
             }
 
             final ConsumeContext context = new ConsumeContext();
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
index 1471c56..6b78740 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientAbstract.java
@@ -17,9 +17,9 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Credentials;
-import io.openmessaging.LifeCycle;
-import io.openmessaging.exception.OMSRuntimeException;
+
+import io.openmessaging.api.Credentials;
+import io.openmessaging.api.LifeCycle;
 import java.util.Properties;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -33,8 +33,9 @@ import org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.namesrv.TopAddressing;
 import org.apache.rocketmq.logging.InternalLogger;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.rocketmq.ons.api.impl.util.NameAddrUtils;
 import org.apache.rocketmq.ons.open.trace.core.dispatch.AsyncDispatcher;
@@ -75,16 +76,16 @@ public abstract class ONSClientAbstract implements LifeCycle, Credentials {
         this.sessionCredentials.updateContent(properties);
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == this.sessionCredentials.getAccessKey() || "".equals(this.sessionCredentials.getAccessKey()))) {
-            throw new OMSRuntimeException("please set access key");
+            throw new ONSClientException("please set access key");
         }
 
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == this.sessionCredentials.getSecretKey() || "".equals(this.sessionCredentials.getSecretKey()))) {
-            throw new OMSRuntimeException("please set secret key");
+            throw new ONSClientException("please set secret key");
         }
 
         if (null == this.sessionCredentials.getOnsChannel()) {
-            throw new OMSRuntimeException("please set ons channel");
+            throw new ONSClientException("please set ons channel");
         }
 
         this.nameServerAddr = getNameSrvAddrFromProperties();
@@ -96,7 +97,7 @@ public abstract class ONSClientAbstract implements LifeCycle, Credentials {
         }
         this.nameServerAddr = fetchNameServerAddr();
         if (null == nameServerAddr) {
-            throw new OMSRuntimeException(FAQ.errorMessage("Can not find name server, May be your network problem.", FAQ.FIND_NS_FAILED));
+            throw new ONSClientException(FAQ.errorMessage("Can not find name server, May be your network problem.", FAQ.FIND_NS_FAILED));
         }
 
         this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@@ -140,7 +141,7 @@ public abstract class ONSClientAbstract implements LifeCycle, Credentials {
                     LOGGER.info("connected to user-defined ons addr server, {} success, {}", property, nsAddrs);
                     return nsAddrs;
                 } else {
-                    throw new OMSRuntimeException(FAQ.errorMessage("Can not find name server with onsAddr " + property, FAQ.FIND_NS_FAILED));
+                    throw new ONSClientException(FAQ.errorMessage("Can not find name server with onsAddr " + property, FAQ.FIND_NS_FAILED));
                 }
             }
         }
@@ -209,14 +210,14 @@ public abstract class ONSClientAbstract implements LifeCycle, Credentials {
     protected void checkONSProducerServiceState(DefaultMQProducerImpl producer) {
         switch (producer.getServiceState()) {
             case CREATE_JUST:
-                throw new OMSRuntimeException(
+                throw new ONSClientException(
                     FAQ.errorMessage(String.format("You do not have start the producer[" + getPid() + "], %s", producer.getServiceState()),
                         FAQ.SERVICE_STATE_WRONG));
             case SHUTDOWN_ALREADY:
-                throw new OMSRuntimeException(FAQ.errorMessage(String.format("Your producer has been shut down, %s", producer.getServiceState()),
+                throw new ONSClientException(FAQ.errorMessage(String.format("Your producer has been shut down, %s", producer.getServiceState()),
                     FAQ.SERVICE_STATE_WRONG));
             case START_FAILED:
-                throw new OMSRuntimeException(FAQ.errorMessage(
+                throw new ONSClientException(FAQ.errorMessage(
                     String.format("When you start your service throws an exception, %s", producer.getServiceState()), FAQ.SERVICE_STATE_WRONG));
             case RUNNING:
                 break;
@@ -241,13 +242,13 @@ public abstract class ONSClientAbstract implements LifeCycle, Credentials {
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == credentialProperties.getProperty(SessionCredentials.AccessKey)
                 || "".equals(credentialProperties.getProperty(SessionCredentials.AccessKey)))) {
-            throw new OMSRuntimeException("update credential failed. please set access key.");
+            throw new ONSClientException("update credential failed. please set access key.");
         }
 
         if (this.sessionCredentials.getOnsChannel().equals(ONSChannel.ALIYUN) &&
             (null == credentialProperties.getProperty(SessionCredentials.SecretKey)
                 || "".equals(credentialProperties.getProperty(SessionCredentials.SecretKey)))) {
-            throw new OMSRuntimeException("update credential failed. please set secret key");
+            throw new ONSClientException("update credential failed. please set secret key");
         }
         this.sessionCredentials.updateContent(credentialProperties);
     }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
index f9488d5..d82feeb 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSConsumerAbstract.java
@@ -17,15 +17,16 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.MessageSelector;
-import io.openmessaging.exception.OMSRuntimeException;
+
+import io.openmessaging.api.MessageSelector;
 import java.util.Properties;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
 import org.apache.rocketmq.client.exception.MQClientException;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.logging.InternalLogger;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsConsumeMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
@@ -48,9 +49,9 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
     public ONSConsumerAbstract(final Properties properties) {
         super(properties);
 
-        String consumerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ConsumerId));
+        String consumerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.GROUP_ID));
         if (StringUtils.isEmpty(consumerGroup)) {
-            throw new OMSRuntimeException("ConsumerId property is null");
+            throw new ONSClientException("ConsumerId property is null");
         }
 
         this.defaultMQPushConsumer =
@@ -144,7 +145,7 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
         try {
             this.defaultMQPushConsumer.subscribe(topic, subExpression);
         } catch (MQClientException e) {
-            throw new OMSRuntimeException("defaultMQPushConsumer subscribe exception", e);
+            throw new ONSClientException("defaultMQPushConsumer subscribe exception", e);
         }
     }
 
@@ -153,7 +154,7 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
         String type = org.apache.rocketmq.common.filter.ExpressionType.TAG;
         if (selector != null) {
             if (selector.getType() == null) {
-                throw new OMSRuntimeException("Expression type is null!");
+                throw new ONSClientException("Expression type is null!");
             }
             subExpression = selector.getSubExpression();
             type = selector.getType().name();
@@ -165,13 +166,13 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
         } else if (org.apache.rocketmq.common.filter.ExpressionType.TAG.equals(type)) {
             messageSelector = org.apache.rocketmq.client.consumer.MessageSelector.byTag(subExpression);
         } else {
-            throw new OMSRuntimeException(String.format("Expression type %s is unknown!", type));
+            throw new ONSClientException(String.format("Expression type %s is unknown!", type));
         }
 
         try {
             this.defaultMQPushConsumer.subscribe(topic, messageSelector);
         } catch (MQClientException e) {
-            throw new OMSRuntimeException("Consumer subscribe exception", e);
+            throw new ONSClientException("Consumer subscribe exception", e);
         }
     }
 
@@ -187,7 +188,7 @@ public class ONSConsumerAbstract extends ONSClientAbstract {
                 super.start();
             }
         } catch (Exception e) {
-            throw new OMSRuntimeException(e.getMessage());
+            throw new ONSClientException(e.getMessage());
         }
     }
 
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
index c90d9c3..14c581c 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSUtil.java
@@ -17,9 +17,9 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Message;
-import io.openmessaging.MessageAccessor;
-import io.openmessaging.exception.OMSRuntimeException;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessageAccessor;
 import java.lang.reflect.Field;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -29,6 +29,7 @@ import java.util.Properties;
 import java.util.Set;
 import org.apache.rocketmq.common.message.MessageConst;
 import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 
 public class ONSUtil {
     private static final Set<String> RESERVED_KEY_SET_RMQ = new HashSet<String>();
@@ -68,7 +69,7 @@ public class ONSUtil {
     public static org.apache.rocketmq.common.message.Message msgConvert(Message message) {
         org.apache.rocketmq.common.message.Message msgRMQ = new org.apache.rocketmq.common.message.Message();
         if (message == null) {
-            throw new OMSRuntimeException("\'message\' is null");
+            throw new ONSClientException("\'message\' is null");
         }
 
         if (message.getTopic() != null) {
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
index d9c9b8a..07dc23c 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderConsumerImpl.java
@@ -17,13 +17,13 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Message;
-import io.openmessaging.MessageSelector;
-import io.openmessaging.exception.OMSRuntimeException;
-import io.openmessaging.order.ConsumeOrderContext;
-import io.openmessaging.order.MessageOrderListener;
-import io.openmessaging.order.OrderAction;
-import io.openmessaging.order.OrderConsumer;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessageSelector;
+import io.openmessaging.api.order.ConsumeOrderContext;
+import io.openmessaging.api.order.MessageOrderListener;
+import io.openmessaging.api.order.OrderAction;
+import io.openmessaging.api.order.OrderConsumer;
 import java.util.List;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
@@ -33,7 +33,8 @@ import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyStatus;
 import org.apache.rocketmq.client.consumer.listener.MessageListenerOrderly;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.message.MessageExt;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 
 public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsumer {
     private final ConcurrentHashMap<String, MessageOrderListener> subscribeTable = new ConcurrentHashMap<String, MessageOrderListener>();
@@ -58,11 +59,11 @@ public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsu
     @Override
     public void subscribe(String topic, String subExpression, MessageOrderListener listener) {
         if (null == topic) {
-            throw new OMSRuntimeException("topic is null");
+            throw new ONSClientException("topic is null");
         }
 
         if (null == listener) {
-            throw new OMSRuntimeException("listener is null");
+            throw new ONSClientException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, subExpression);
@@ -71,11 +72,11 @@ public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsu
     @Override
     public void subscribe(final String topic, final MessageSelector selector, final MessageOrderListener listener) {
         if (null == topic) {
-            throw new OMSRuntimeException("topic is null");
+            throw new ONSClientException("topic is null");
         }
 
         if (null == listener) {
-            throw new OMSRuntimeException("listener is null");
+            throw new ONSClientException("listener is null");
         }
         this.subscribeTable.put(topic, listener);
         super.subscribe(topic, selector);
@@ -91,7 +92,7 @@ public class OrderConsumerImpl extends ONSConsumerAbstract implements OrderConsu
 
             MessageOrderListener listener = OrderConsumerImpl.this.subscribeTable.get(msg.getTopic());
             if (null == listener) {
-                throw new OMSRuntimeException("MessageOrderListener is null");
+                throw new ONSClientException("MessageOrderListener is null");
             }
 
             final ConsumeOrderContext context = new ConsumeOrderContext();
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
index d46b769..c840bb2 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/OrderProducerImpl.java
@@ -17,10 +17,10 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Message;
-import io.openmessaging.SendResult;
-import io.openmessaging.exception.OMSRuntimeException;
-import io.openmessaging.order.OrderProducer;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.order.OrderProducer;
 import java.util.List;
 import java.util.Properties;
 import org.apache.commons.lang3.StringUtils;
@@ -29,7 +29,8 @@ import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.message.MessageQueue;
 import org.apache.rocketmq.logging.InternalLogger;
 
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
@@ -43,7 +44,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
 
     public OrderProducerImpl(final Properties properties) {
         super(properties);
-        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ProducerId));
+        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.GROUP_ID));
         if (StringUtils.isEmpty(producerGroup)) {
             producerGroup = "__ONS_PRODUCER_DEFAULT_GROUP";
         }
@@ -109,7 +110,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
                 super.start();
             }
         } catch (Exception e) {
-            throw new OMSRuntimeException(e.getMessage());
+            throw new ONSClientException(e.getMessage());
         }
     }
 
@@ -124,7 +125,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
     @Override
     public SendResult send(final Message message, final String shardingKey) {
         if (UtilAll.isBlank(shardingKey)) {
-            throw new OMSRuntimeException("\'shardingKey\' is blank.");
+            throw new ONSClientException("\'shardingKey\' is blank.");
         }
         message.setShardingKey(shardingKey);
         this.checkONSProducerServiceState(this.defaultMQProducer.getDefaultMQProducerImpl());
@@ -148,7 +149,7 @@ public class OrderProducerImpl extends ONSClientAbstract implements OrderProduce
             sendResult.setMessageId(sendResultRMQ.getMsgId());
             return sendResult;
         } catch (Exception e) {
-            throw new OMSRuntimeException("defaultMQProducer send order exception", e);
+            throw new ONSClientException("defaultMQProducer send order exception", e);
         }
     }
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index d40b785..cccdf05 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -17,19 +17,14 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Message;
-import io.openmessaging.OnExceptionContext;
-import io.openmessaging.Producer;
-import io.openmessaging.SendCallback;
-import io.openmessaging.SendResult;
-import io.openmessaging.exception.OMSRuntimeException;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.OnExceptionContext;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.SendCallback;
+import io.openmessaging.api.SendResult;
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
-
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
-import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
-import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.client.exception.MQBrokerException;
 import org.apache.rocketmq.client.exception.MQClientException;
 import org.apache.rocketmq.client.producer.DefaultMQProducer;
@@ -37,13 +32,15 @@ import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.common.message.MessageClientIDSetter;
 import org.apache.rocketmq.common.protocol.ResponseCode;
 import org.apache.rocketmq.logging.InternalLogger;
-import org.apache.rocketmq.remoting.exception.RemotingConnectException;
-import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
-
-
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
+import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceDispatcherType;
+import org.apache.rocketmq.ons.open.trace.core.dispatch.impl.AsyncArrayDispatcher;
+import org.apache.rocketmq.remoting.exception.RemotingConnectException;
+import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
 import org.apache.rocketmq.remoting.protocol.LanguageCode;
 
 public class ProducerImpl extends ONSClientAbstract implements Producer {
@@ -53,7 +50,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
     public ProducerImpl(final Properties properties) {
         super(properties);
 
-        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ProducerId));
+        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.GROUP_ID));
         if (StringUtils.isEmpty(producerGroup)) {
             producerGroup = "__ONS_PRODUCER_DEFAULT_GROUP";
         }
@@ -123,7 +120,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
                 super.start();
             }
         } catch (Exception e) {
-            throw new OMSRuntimeException(e.getMessage());
+            throw new ONSClientException(e.getMessage());
         }
     }
 
@@ -199,10 +196,10 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
 
             @Override
             public void onException(Throwable e) {
-                //String topic = new String(message.getTopic());
-                //String msgId = new String(message.getMsgID());
+                String topic = new String(message.getTopic());
+                String msgId = new String(message.getMsgID());
                 LOGGER.error(String.format("Send message async Exception, %s", message), e);
-                OMSRuntimeException onsEx = checkProducerException(message.getTopic(), message.getMsgID(), e);
+                ONSClientException onsEx = checkProducerException(topic, msgId, e);
                 OnExceptionContext context = new OnExceptionContext();
                 context.setTopic(message.getTopic());
                 context.setMessageId(message.getMsgID());
@@ -221,39 +218,34 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
         return sendResult;
     }
 
-    @Override
-    public SendResult send(Message message, String shardingKey) {
-        return null;
-    }
-
-    private OMSRuntimeException checkProducerException(String topic, String msgId, Throwable e) {
+    private ONSClientException checkProducerException(String topic, String msgId, Throwable e) {
         if (e instanceof MQClientException) {
             if (e.getCause() != null) {
                 if (e.getCause() instanceof RemotingConnectException) {
-                    return new OMSRuntimeException(
+                    return new ONSClientException(
                         FAQ.errorMessage(String.format("Connect broker failed, Topic=%s, msgId=%s", topic, msgId), FAQ.CONNECT_BROKER_FAILED));
                 } else if (e.getCause() instanceof RemotingTimeoutException) {
-                    return new OMSRuntimeException(FAQ.errorMessage(String.format("Send message to broker timeout, %dms, Topic=%s, msgId=%s",
+                    return new ONSClientException(FAQ.errorMessage(String.format("Send message to broker timeout, %dms, Topic=%s, msgId=%s",
                         this.defaultMQProducer.getSendMsgTimeout(), topic, msgId), FAQ.SEND_MSG_TO_BROKER_TIMEOUT));
                 } else if (e.getCause() instanceof MQBrokerException) {
                     MQBrokerException excep = (MQBrokerException) e.getCause();
-                    return new OMSRuntimeException(FAQ.errorMessage(
+                    return new ONSClientException(FAQ.errorMessage(
                         String.format("Receive a broker exception, Topic=%s, msgId=%s, %s", topic, msgId, excep.getErrorMessage()),
                         FAQ.BROKER_RESPONSE_EXCEPTION));
                 }
             } else {
                 MQClientException excep = (MQClientException) e;
                 if (-1 == excep.getResponseCode()) {
-                    return new OMSRuntimeException(
+                    return new ONSClientException(
                         FAQ.errorMessage(String.format("Topic does not exist, Topic=%s, msgId=%s", topic, msgId), FAQ.TOPIC_ROUTE_NOT_EXIST));
                 } else if (ResponseCode.MESSAGE_ILLEGAL == excep.getResponseCode()) {
-                    return new OMSRuntimeException(
+                    return new ONSClientException(
                         FAQ.errorMessage(String.format("ONS Client check message exception, Topic=%s, msgId=%s", topic, msgId),
                             FAQ.CLIENT_CHECK_MSG_EXCEPTION));
                 }
             }
         }
 
-        return new OMSRuntimeException("defaultMQProducer send exception", e);
+        return new ONSClientException("defaultMQProducer send exception", e);
     }
 }
diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
index 3c44f14..66b3014 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/TransactionProducerImpl.java
@@ -17,12 +17,12 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Constants;
-import io.openmessaging.Message;
-import io.openmessaging.SendResult;
-import io.openmessaging.transaction.LocalTransactionExecutor;
-import io.openmessaging.transaction.TransactionProducer;
-import io.openmessaging.transaction.TransactionStatus;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.transaction.LocalTransactionExecuter;
+import io.openmessaging.api.transaction.TransactionProducer;
+import io.openmessaging.api.transaction.TransactionStatus;
 import java.util.Properties;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.client.exception.MQClientException;
@@ -31,7 +31,8 @@ import org.apache.rocketmq.client.producer.TransactionCheckListener;
 import org.apache.rocketmq.client.producer.TransactionMQProducer;
 import org.apache.rocketmq.common.UtilAll;
 import org.apache.rocketmq.logging.InternalLogger;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.Constants;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.api.impl.tracehook.OnsClientSendMessageHookImpl;
 import org.apache.rocketmq.ons.api.impl.util.ClientLoggerUtil;
 import org.apache.rocketmq.ons.open.trace.core.common.OnsTraceConstants;
@@ -47,7 +48,7 @@ public class TransactionProducerImpl extends ONSClientAbstract implements Transa
     public TransactionProducerImpl(Properties properties, TransactionCheckListener transactionCheckListener) {
         super(properties);
         this.properties = properties;
-        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.ProducerId));
+        String producerGroup = properties.getProperty(PropertyKeyConst.GROUP_ID, properties.getProperty(PropertyKeyConst.GROUP_ID));
         if (StringUtils.isEmpty(producerGroup)) {
             producerGroup = "__ONS_PRODUCER_DEFAULT_GROUP";
         }
@@ -123,7 +124,7 @@ public class TransactionProducerImpl extends ONSClientAbstract implements Transa
     }
 
     @Override
-    public SendResult send(final Message message, final LocalTransactionExecutor executer, Object arg) {
+    public SendResult send(final Message message, final LocalTransactionExecuter executer, Object arg) {
         this.checkONSProducerServiceState(this.transactionMQProducer.getDefaultMQProducerImpl());
         org.apache.rocketmq.common.message.Message msgRMQ = ONSUtil.msgConvert(message);
         org.apache.rocketmq.client.producer.TransactionSendResult sendResultRMQ = null;
diff --git a/ons-core/ons-client/src/main/resources/META-INF/services/io.openmessaging.api.ONSFactoryAPI b/ons-core/ons-client/src/main/resources/META-INF/services/io.openmessaging.api.ONSFactoryAPI
new file mode 100644
index 0000000..057a032
--- /dev/null
+++ b/ons-core/ons-client/src/main/resources/META-INF/services/io.openmessaging.api.ONSFactoryAPI
@@ -0,0 +1 @@
+org.apache.rocketmq.ons.api.impl.ONSFactoryImpl
\ No newline at end of file
diff --git a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
index 52e7d2d..3d94d74 100644
--- a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
+++ b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/NameServerAutoUpdateTest.java
@@ -17,14 +17,15 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Consumer;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
-import io.openmessaging.Producer;
-import io.openmessaging.exception.OMSRuntimeException;
-import io.openmessaging.order.OrderProducer;
+
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.order.OrderProducer;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.rules.ExpectedException;
@@ -51,7 +52,7 @@ public class NameServerAutoUpdateTest {
 
     @org.junit.Test
     public void testNamesrv_setOnsAddr_invalid() {
-        expectedException.expect(OMSRuntimeException.class);
+        expectedException.expect(ONSClientException.class);
         expectedException.expectMessage("onsAddr " + "xxx");
 
         Properties prop = buildProps();
diff --git a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
index 8a7386d..f97d5d7 100644
--- a/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
+++ b/ons-core/ons-client/src/test/java/org/apache/rocketmq/ons/api/impl/rocketmq/ONSClientTokenUpdateTest.java
@@ -17,20 +17,20 @@
 
 package org.apache.rocketmq.ons.api.impl.rocketmq;
 
-import io.openmessaging.Consumer;
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
-import io.openmessaging.OMSBuiltinKeys;
-import io.openmessaging.Producer;
-import io.openmessaging.SendResult;
-import io.openmessaging.exception.OMSRuntimeException;
+
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.SendResult;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.api.impl.authority.SessionCredentials;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
 import org.apache.rocketmq.remoting.netty.NettyRemotingClient;
 import org.junit.Assert;
 import org.junit.Before;
@@ -176,7 +176,7 @@ public class ONSClientTokenUpdateTest {
         try {
             consumer.updateCredential(buildProps("nak", "", "ntoken", ONSChannel.CLOUD.name()));
         } catch (Exception e) {
-            Assert.assertTrue(e instanceof OMSRuntimeException);
+            Assert.assertTrue(e instanceof ONSClientException);
         }
 
         Assert.assertEquals("ak", credentials.getAccessKey());
@@ -187,8 +187,7 @@ public class ONSClientTokenUpdateTest {
 
     private static Properties buildProps(String ak, String sk, String token, String channel) {
         Properties properties = new Properties();
-        properties.put(PropertyKeyConst.ConsumerId, "CID_STS_TEST_MOLING");
-        properties.put(PropertyKeyConst.ProducerId, "PID_STS_TEST_MOLING");
+        properties.put(PropertyKeyConst.GROUP_ID, "CID_STS_TEST_MOLING");
         properties.put(PropertyKeyConst.AccessKey, ak);
         properties.put(PropertyKeyConst.SecretKey, sk);
         properties.put(PropertyKeyConst.SecurityToken, token);
diff --git a/ons-core/ons-trace-core/pom.xml b/ons-core/ons-trace-core/pom.xml
index 579e842..422b192 100644
--- a/ons-core/ons-trace-core/pom.xml
+++ b/ons-core/ons-trace-core/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>ons-all</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.0.1-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>ons-trace-core</artifactId>
diff --git a/ons-core/pom.xml b/ons-core/pom.xml
index f93ca53..7a3da6a 100644
--- a/ons-core/pom.xml
+++ b/ons-core/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.apache.rocketmq</groupId>
         <artifactId>ons-parent</artifactId>
-        <version>1.0.1-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <inceptionYear>2012</inceptionYear>
diff --git a/ons-sample/pom.xml b/ons-sample/pom.xml
index 7846256..271f7bb 100644
--- a/ons-sample/pom.xml
+++ b/ons-sample/pom.xml
@@ -19,7 +19,7 @@
     <parent>
         <artifactId>ons-parent</artifactId>
         <groupId>org.apache.rocketmq</groupId>
-        <version>1.0.1-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -36,7 +36,7 @@
         <dependency>
             <groupId>io.openmessaging</groupId>
             <artifactId>openmessaging-api</artifactId>
-            <version>1.1.0-SNAPSHOT</version>
+            <version>1.2.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
index 2ef0e44..8a59dc3 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/MQConfig.java
@@ -20,7 +20,7 @@ public class MQConfig {
     /**
      * RocketMQ config
      */
-    public static final String TOPIC = "xxxx";
+    public static final String TOPIC = "TopicTest";
     public static final String GROUP_ID = "GID-xxxx";
     public static final String ORDER_TOPIC = "xxxx";
     public static final String ORDER_GROUP_ID = "GID-xxxx";
@@ -31,6 +31,6 @@ public class MQConfig {
     /**
      * NAMESRV_ADDR
      */
-    public static final String NAMESRV_ADDR = "xxxxxx";
+    public static final String NAMESRV_ADDR = "47.107.167.190:9876";
 
 }
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
index 90c3f4b..5ed0a48 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/MessageListenerImpl.java
@@ -16,10 +16,10 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
-import io.openmessaging.Action;
-import io.openmessaging.ConsumeContext;
-import io.openmessaging.Message;
-import io.openmessaging.MessageListener;
+import io.openmessaging.api.Action;
+import io.openmessaging.api.ConsumeContext;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessageListener;
 
 public class MessageListenerImpl implements MessageListener {
     @Override
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
index 513a67b..34fe915 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleMQConsumer.java
@@ -16,11 +16,12 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
-import io.openmessaging.Consumer;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
+
+import io.openmessaging.api.Consumer;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleMQConsumer {
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
index 35a9458..d3aaa07 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/consumer/SimpleOrderConsumer.java
@@ -16,15 +16,16 @@
  */
 package org.apache.rocketmq.ons.sample.consumer;
 
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
-import io.openmessaging.order.ConsumeOrderContext;
-import io.openmessaging.order.MessageOrderListener;
-import io.openmessaging.order.OrderAction;
-import io.openmessaging.order.OrderConsumer;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.order.ConsumeOrderContext;
+import io.openmessaging.api.order.MessageOrderListener;
+import io.openmessaging.api.order.OrderAction;
+import io.openmessaging.api.order.OrderConsumer;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleOrderConsumer {
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
index 1d76cf6..973dc4d 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/LocalTransactionCheckerImpl.java
@@ -16,9 +16,9 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import io.openmessaging.Message;
-import io.openmessaging.transaction.LocalTransactionChecker;
-import io.openmessaging.transaction.TransactionStatus;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.transaction.LocalTransactionChecker;
+import io.openmessaging.api.transaction.TransactionStatus;
 
 public class LocalTransactionCheckerImpl implements LocalTransactionChecker {
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
index aa9f7f2..7cc5682 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/MQTimerProducer.java
@@ -16,25 +16,25 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
-import io.openmessaging.Producer;
-import io.openmessaging.SendResult;
-import io.openmessaging.exception.OMSRuntimeException;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.exception.OMSRuntimeException;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class MQTimerProducer {
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://47.107.167.190:9876");
 
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
-        producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
         Producer producer = messagingAccessPoint.createProducer(producerProperties);
         producer.start();
         System.out.printf("Producer Started. %n");
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
index 8d25ef4..2b53968 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleMQProducer.java
@@ -16,28 +16,32 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
-import io.openmessaging.Producer;
-import io.openmessaging.SendResult;
-import io.openmessaging.exception.OMSRuntimeException;
+import io.openmessaging.api.Message;
+import io.openmessaging.api.Producer;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.exception.OMSRuntimeException;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.ONSFactory;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
+
+//    io.openmessaging.api.xxx => com.aliyun.openservices.ons.api.xxxx
+
+
+
 public class SimpleMQProducer {
 
 
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
 
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.GROUP_ID);
         producerProperties.setProperty(PropertyKeyConst.AccessKey, MQConfig.ACCESS_KEY);
         producerProperties.setProperty(PropertyKeyConst.SecretKey, MQConfig.SECRET_KEY);
         producerProperties.setProperty(PropertyKeyConst.NAMESRV_ADDR, MQConfig.NAMESRV_ADDR);
-        Producer producer = messagingAccessPoint.createProducer(producerProperties);
+        Producer producer = ONSFactory.createProducer(producerProperties);
+
         producer.start();
         System.out.printf("Producer Started %n");
 
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
index 82282aa..2d49a48 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleOrderProducer.java
@@ -16,20 +16,21 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
-import io.openmessaging.SendResult;
-import io.openmessaging.exception.OMSRuntimeException;
-import io.openmessaging.order.OrderProducer;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.exception.OMSRuntimeException;
+import io.openmessaging.api.order.OrderProducer;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleOrderProducer {
 
     public static void main(String[] args) {
-        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east");
+        MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@47.107.167.190/us-east");
 
         Properties producerProperties = new Properties();
         producerProperties.setProperty(PropertyKeyConst.GROUP_ID, MQConfig.ORDER_GROUP_ID);
diff --git a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
index c8790b9..e5834f7 100644
--- a/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
+++ b/ons-sample/src/main/java/org/apache/rocketmq/ons/sample/producer/SimpleTransactionProducer.java
@@ -16,17 +16,19 @@
  */
 package org.apache.rocketmq.ons.sample.producer;
 
-import io.openmessaging.Message;
-import io.openmessaging.MessagingAccessPoint;
-import io.openmessaging.OMS;
-import io.openmessaging.SendResult;
-import io.openmessaging.exception.OMSRuntimeException;
-import io.openmessaging.transaction.LocalTransactionExecutor;
-import io.openmessaging.transaction.TransactionProducer;
-import io.openmessaging.transaction.TransactionStatus;
+
+import io.openmessaging.api.Message;
+import io.openmessaging.api.MessagingAccessPoint;
+import io.openmessaging.api.OMS;
+import io.openmessaging.api.SendResult;
+import io.openmessaging.api.exception.OMSRuntimeException;
+import io.openmessaging.api.transaction.LocalTransactionExecuter;
+import io.openmessaging.api.transaction.TransactionProducer;
+import io.openmessaging.api.transaction.TransactionStatus;
 import java.util.Date;
 import java.util.Properties;
-import org.apache.rocketmq.ons.api.impl.constant.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.PropertyKeyConst;
+import org.apache.rocketmq.ons.api.exception.ONSClientException;
 import org.apache.rocketmq.ons.sample.MQConfig;
 
 public class SimpleTransactionProducer {
@@ -47,7 +49,7 @@ public class SimpleTransactionProducer {
 
         for (int i = 0; i < 10; i++) {
             try {
-                SendResult sendResult = transactionProducer.send(message, new LocalTransactionExecutor() {
+                SendResult sendResult = transactionProducer.send(message, new LocalTransactionExecuter() {
                     @Override
                     public TransactionStatus execute(Message msg, Object arg) {
                         System.out.printf("Execute local transaction and return TransactionStatus. %n");
@@ -55,7 +57,7 @@ public class SimpleTransactionProducer {
                     }
                 }, null);
                 assert sendResult != null;
-            } catch (OMSRuntimeException e) {
+            } catch (ONSClientException e) {
                 System.out.printf(new Date() + " Send mq message failed! Topic is: %s%n", MQConfig.TOPIC);
                 e.printStackTrace();
             }
diff --git a/pom.xml b/pom.xml
index ec1c4fa..71433c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.rocketmq</groupId>
     <artifactId>ons-parent</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>1.2.0-SNAPSHOT</version>
     <packaging>pom</packaging>
     <name>ons-parent ${project.version}</name>
     <description>


[rocketmq-ons] 24/36: Update ProducerImpl.java

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit c315d148f6458786a6edbe87834b9f7353856236
Author: davidpdw <40...@qq.com>
AuthorDate: Wed Jul 17 11:50:20 2019 +0800

    Update ProducerImpl.java
    
    spelling mistake
---
 .../java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index cfbe212..08f104d 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -231,7 +231,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
                 } else if (e.getCause() instanceof MQBrokerException) {
                     MQBrokerException excep = (MQBrokerException) e.getCause();
                     return new ONSClientException(FAQ.errorMessage(
-                        String.format("Receive a broker exception, Topi=%s, msgId=%s, %s", topic, msgId, excep.getErrorMessage()),
+                        String.format("Receive a broker exception, Topic=%s, msgId=%s, %s", topic, msgId, excep.getErrorMessage()),
                         FAQ.BROKER_RESPONSE_EXCEPTION));
                 }
             } else {


[rocketmq-ons] 09/36: Merge remote-tracking branch 'origin' into graalvm-sdk

Posted by du...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch OpenMessaging
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons.git

commit ee4b1bf6e0f4a95386e8d7680fa440760368a9dc
Merge: 4768702 4a72b44
Author: ShannonDing <li...@163.com>
AuthorDate: Mon Jun 17 17:43:58 2019 +0800

    Merge remote-tracking branch 'origin' into graalvm-sdk

 .../apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)