[
  {
    "path": ".gitignore",
    "content": "target/\n*/target/\n*/classes/\n*.jar\n*.class\n*.iml\n*/application-test.properties\n*/application-prod.properties\n"
  },
  {
    "path": "LICENSE",
    "content": "\n\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n   Copyright [2016] [io.xream]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License\n   \n"
  },
  {
    "path": "README.md",
    "content": "# acku\r\n   [http://acku.xream.io](http://acku.xream.io)\r\n\r\n[![license](https://img.shields.io/github/license/x-ream/acku.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)\r\n[![maven](https://img.shields.io/maven-central/v/io.xream.acku/acku.svg)](https://search.maven.org/search?q=io.xream)\r\n\r\n    mq transaction, with tcc option\r\n\r\n\r\n## code annotation\r\n    @EnableAckuManagement\r\n    @AckuProducer\r\n    @AckuOnConsumed\r\n\r\n## code config\r\n    implements DtoConverter\r\n    \r\n## spring boot properties\r\n    acku.app=acku-app (k8s service name)\r\n    #acku.app=http://ip:7717 (ip:port)\r\n    \r\n## maven dependency\r\n```xml\r\n<acku.version>0.2.0</acku.version>\r\n\r\n<dependency>\r\n    <groupId>io.xream.acku</groupId>\r\n    <artifactId>acku-spring-boot-starter</artifactId>\r\n    <version>${acku.version}</version>\r\n</dependency>\r\n\r\n```  \r\n"
  },
  {
    "path": "_config.yml",
    "content": "theme: jekyll-theme-architect"
  },
  {
    "path": "acku-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-api</artifactId>\r\n\r\n\r\n</project>"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/api/AckuOnConsumed.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.api;\r\n\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target({ElementType.METHOD})\r\npublic @interface AckuOnConsumed {\r\n\r\n    String svc() default \"\";\r\n\r\n    /**\r\n     * next produce\r\n     */\r\n    String nextTopic() default \"\";\r\n    int nextRetryMax() default 0;\r\n\r\n    /**\r\n     *  Atleast one svc need, to confirm consumed ok,\r\n     */\r\n    String[] nextSvcs() default {};\r\n}\r\n"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/api/AckuProducer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.api;\r\n\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\n\r\n/**\r\n * 1. retryMax=0,useTcc=false,async=false, mean: simple prepare,\r\n *      producer local tx create preparing status record or log record\r\n *      listener local tx create preparing status record or log record\r\n * 2. useTcc=true, anyway, framework will set retryMax = 0\r\n * 3. retryMax=3, final consistent; if underConstruction, will save the message\r\n *\r\n * usage:\r\n * 1. create orderBean: (useTcc=true) or (retryMax=0,useTcc=false,async=false)\r\n * 2. pay:  preparing(retryMax=0,useTcc=false,async=false), paid callback(retryMax=3,async=true)\r\n * 3. logistics warehousing: (retryMax=3), and client ui vision compensation\r\n *\r\n * @author Sim\r\n */\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target({ElementType.METHOD})\r\npublic @interface AckuProducer {\r\n\r\n    boolean useTcc() default false;\r\n\r\n    String topic() default \"\";\r\n\r\n    /**\r\n     * define which arg is the message body, while has multi args\r\n     */\r\n    Class<?> type() default Void.class;\r\n\r\n    String[] svcs() default {};\r\n\r\n    int retryMax() default 0;\r\n\r\n    /**\r\n     * to avoid long tx waiting, <br>\r\n     * if async == false, not suggest to write data in db of the method  annotated by ReliableProducer <br>\r\n     */\r\n    boolean async() default false;\r\n\r\n    boolean underConstruction() default false;\r\n}\r\n"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/exception/BusyException.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.exception;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class BusyException extends RuntimeException{\r\n\r\n    public BusyException(String message) {\r\n        super(message);\r\n    }\r\n\r\n    public BusyException(Exception e) {\r\n        super(e);\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/interner/AckuBackend.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements.  See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License.  You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage io.xream.acku.interner;\n\nimport java.util.concurrent.Callable;\n\n/**\n * @author Sim 8966188@qq.com\n * @apiNote to use @EnableReliabilityManagement, @ReliableProducer and @ReliableOnConsumed, <br>\n *     has to implements ReliableBackend, develop and deploy 'Reliable Message Center'\n */\npublic interface AckuBackend {\n\n    /**\n     * @param useTcc\n     * as regards to TCC, TCC implemented to check all resources, <br>\n     *     at first, produce 'TOPIC'_TCC_TRY <br>\n     *     if all resouces ok, produce 'TOPIC'_TCC_CONFIRM <br>\n     *     any exception occured, produce 'TOPIC'_TCC_CANCEL <br>\n     *     anyway, when isTcc = true, has to prepare 3 listeners <br>\n     * @param id framework generate id\n     * @param retryMax message retryMax\n     * @param underConstruction message underConstruction\n     * @param topic message topic\n     * @param body  message body\n     * @param messageTraceable getMsgId(), set tracingId\n     * @param svcs  the nameList of other listening domain service\n     * @param callable  the service or controller handle the bisiness\n     */\n    Object produceReliably(Boolean useTcc, String id, int retryMax, boolean underConstruction, String topic, Object body, MessageTraceable messageTraceable, String[] svcs, Callable callable);\n\n    /**\n     *\n     * @param svc  the name of listening domain service\n     * @param message message body\n     * @param runnable  listener handle the bisiness\n     */\n    void onConsumed(String svc, Object message, Runnable runnable);\n    boolean createNext(String id, int retryMax, String topic, Object body, Object preMessage, String[] svcs);\n    /**\n     * TCC\n     * @param msgId\n     */\n    boolean tryToConfirm(String msgId);\n\n    /**\n     * TCC\n     * @param msgId\n     */\n    boolean cancel(String msgId);\n\n}\n"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/interner/AckuOnConsumedAspect.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.interner;\r\n\r\nimport io.xream.acku.api.AckuOnConsumed;\r\nimport io.xream.internal.util.ExceptionUtil;\r\nimport io.xream.internal.util.StringUtil;\r\nimport io.xream.internal.util.VerifyUtil;\r\nimport org.aspectj.lang.ProceedingJoinPoint;\r\nimport org.aspectj.lang.Signature;\r\nimport org.aspectj.lang.annotation.Around;\r\nimport org.aspectj.lang.annotation.Aspect;\r\nimport org.aspectj.lang.annotation.Pointcut;\r\nimport org.aspectj.lang.reflect.MethodSignature;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Aspect\r\npublic class AckuOnConsumedAspect {\r\n\r\n    private final static Logger logger = LoggerFactory.getLogger(AckuBackend.class);\r\n\r\n\r\n    public AckuOnConsumedAspect() {\r\n        logger.info(\"Acku OnConsumed Enabled\");\r\n    }\r\n\r\n    @Autowired\r\n    private AckuBackend backend;\r\n\r\n    @Pointcut(\"@annotation(io.xream.acku.api.AckuOnConsumed))\")\r\n    public void cut() {\r\n\r\n    }\r\n\r\n    @Around(\"cut() && @annotation(ackuOnConsumed) \")\r\n    public void around(ProceedingJoinPoint proceedingJoinPoint, AckuOnConsumed ackuOnConsumed) {\r\n\r\n        Object[] args = proceedingJoinPoint.getArgs();\r\n        Object message = args[0];\r\n\r\n        Signature signature = proceedingJoinPoint.getSignature();\r\n        String logStr = signature.getDeclaringTypeName() + \".\" + signature.getName();\r\n\r\n        String nextTopic = ackuOnConsumed.nextTopic();\r\n        String[] svcs = ackuOnConsumed.nextSvcs();\r\n        if (StringUtil.isNotNull(nextTopic)){\r\n            if (svcs == null || svcs.length == 0){\r\n                throw new IllegalArgumentException(logStr + \", if config nextTopic, svcs of io.xream.x7.acku.AckuOnConsumed can not null, nextTopic: \" + nextTopic);\r\n            }\r\n        }\r\n\r\n        String svc = ackuOnConsumed.svc();\r\n        if (StringUtil.isNullOrEmpty(svc)){\r\n            svc = VerifyUtil.toMD5(logStr).substring(0,10);\r\n        }\r\n\r\n        this.backend.onConsumed(svc, message,\r\n                () -> {\r\n                    try {\r\n                        MethodSignature ms = ((MethodSignature) signature);\r\n                        if (ms.getReturnType() == void.class) {\r\n                            proceedingJoinPoint.proceed();\r\n                        } else {\r\n                            Object nextBody = proceedingJoinPoint.proceed();\r\n                            String id = MessageIdGenerator.get();\r\n                            int maxTry = ackuOnConsumed.nextRetryMax();\r\n                            if (StringUtil.isNotNull(nextTopic)){\r\n                                boolean flag = this.backend.createNext(id,maxTry,nextTopic,nextBody,message,svcs);\r\n                                if (!flag){\r\n                                    throw new RuntimeException(logStr + \", produce next topic failed: topic: \" + nextTopic + \", message:\"+ message + \",next body: \" + nextBody);\r\n                                }\r\n                            }\r\n                        }\r\n                    } catch (Throwable e) {\r\n                        if (e instanceof RuntimeException){\r\n                            throw (RuntimeException) e;\r\n                        }\r\n                        throw new RuntimeException(ExceptionUtil.getMessage(e));\r\n                    }\r\n                }\r\n        );\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/interner/AckuProducerAspect.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.interner;\r\n\r\n\r\nimport io.xream.acku.api.AckuProducer;\r\nimport io.xream.acku.exception.BusyException;\r\nimport io.xream.internal.util.ExceptionUtil;\r\nimport org.aspectj.lang.ProceedingJoinPoint;\r\nimport org.aspectj.lang.Signature;\r\nimport org.aspectj.lang.annotation.Around;\r\nimport org.aspectj.lang.annotation.Aspect;\r\nimport org.aspectj.lang.annotation.Pointcut;\r\nimport org.aspectj.lang.reflect.MethodSignature;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\n\r\nimport java.util.concurrent.TimeUnit;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Aspect\r\npublic class AckuProducerAspect {\r\n\r\n\r\n    private final static Logger logger = LoggerFactory.getLogger(AckuBackend.class);\r\n\r\n    public AckuProducerAspect() {\r\n        logger.info(\"Acku Producer Enabled\");\r\n    }\r\n\r\n    @Autowired\r\n    private AckuBackend backend;\r\n\r\n    @Pointcut(\"@annotation(io.xream.acku.api.AckuProducer))\")\r\n    public void cut() {\r\n\r\n    }\r\n\r\n    @Around(\"cut() && @annotation(ackuProducer) \")\r\n    public Object around(ProceedingJoinPoint proceedingJoinPoint, AckuProducer ackuProducer) {\r\n\r\n        long startTime = System.currentTimeMillis();\r\n\r\n        Object[] args = proceedingJoinPoint.getArgs();\r\n\r\n        Signature signature = proceedingJoinPoint.getSignature();\r\n        String logStr = signature.getDeclaringTypeName() + \".\" + signature.getName();\r\n\r\n        if (args == null || args.length == 0)\r\n            throw new IllegalArgumentException(logStr + \", for AckuMessage body can not be null, no args\");\r\n\r\n        Object body = null;\r\n        if (ackuProducer.type() != Void.class) {\r\n            for (Object arg : args) {\r\n                if (arg.getClass() == ackuProducer.type()) {\r\n                    body = arg;\r\n                    break;\r\n                }\r\n            }\r\n            if (body == null)\r\n                throw new IllegalArgumentException(logStr + \", for AckuMessage body can not be null, reliableProducer.type: \" + ackuProducer.type());\r\n        }\r\n        if (body == null) {\r\n            body = args[0];\r\n        }\r\n\r\n        MessageTraceable tracing = null;\r\n        for (Object arg : args) {\r\n            if (arg instanceof MessageTraceable) {\r\n                tracing = (MessageTraceable) arg;\r\n                break;\r\n            }\r\n        }\r\n\r\n        final int retryMax = ackuProducer.useTcc() ? 0 : ackuProducer.retryMax();\r\n\r\n        final String msgId = MessageIdGenerator.get();\r\n\r\n        String[] svcs = ackuProducer.svcs();\r\n        for (String svc : svcs) {\r\n            if (svc.contains(\",\")) {\r\n                throw new IllegalArgumentException(logStr + \", \" + AckuProducer.class.getName() + \", svcs: \" + svcs);\r\n            }\r\n        }\r\n\r\n        Object result = this.backend.produceReliably(\r\n                ackuProducer.useTcc(),//\r\n                msgId,//\r\n                retryMax,//\r\n                ackuProducer.underConstruction(),//\r\n                ackuProducer.topic(),//\r\n                body,//\r\n                tracing,//\r\n                ackuProducer.svcs(),//\r\n                () -> {\r\n                    try {\r\n                        MethodSignature ms = ((MethodSignature) signature);\r\n                        if (ms.getReturnType() == void.class) {\r\n                            proceedingJoinPoint.proceed();\r\n                            return null;\r\n                        } else {\r\n                            return proceedingJoinPoint.proceed();\r\n                        }\r\n                    } catch (Throwable e) {\r\n                        if (e instanceof RuntimeException){\r\n                            throw (RuntimeException) e;\r\n                        }\r\n                        throw new RuntimeException(ExceptionUtil.getMessage(e));\r\n                    }\r\n                }\r\n        );\r\n\r\n        if (ackuProducer.async() && !ackuProducer.useTcc())\r\n            return result;\r\n\r\n        final long intervalBaseOne = 100;//FIXME： require test\r\n        boolean isOk = false;\r\n        int replayMax = 3;\r\n        long interval = intervalBaseOne;\r\n        int replay = 0;\r\n        while (replay < replayMax) {\r\n            try {\r\n                TimeUnit.MILLISECONDS.sleep(interval);\r\n                isOk = this.backend.tryToConfirm(msgId);\r\n                if (isOk) {\r\n                    logger.info(\"handled OK time: {} ,replay = {} ,for {}\", System.currentTimeMillis() - startTime, replay, logStr);\r\n                    return result;\r\n                }\r\n                replay++;\r\n            } catch (Exception e) {\r\n                break;\r\n            }\r\n            interval += intervalBaseOne;\r\n        }\r\n\r\n        final long intervalBaseTwo = 1000;\r\n        interval = intervalBaseTwo;\r\n        replayMax = replay + 3;\r\n        while (replay < replayMax) {\r\n            try {\r\n                TimeUnit.MILLISECONDS.sleep(interval);\r\n                isOk = this.backend.tryToConfirm(msgId);\r\n                if (isOk) {\r\n                    logger.info(\"handled OK, time: {} ,replay = {} ,for {}\", System.currentTimeMillis() - startTime, replay, logStr);\r\n                    return result;\r\n                }\r\n                replay++;\r\n            } catch (Exception e) {\r\n                break;\r\n            }\r\n            interval += intervalBaseTwo;\r\n        }\r\n\r\n        if (retryMax == 0) {\r\n            if (ackuProducer.useTcc()) {\r\n                boolean flag = this.backend.cancel(msgId);\r\n                while (!flag) {\r\n                    // has to wait for a long time to try to cancel\r\n                    try {\r\n                        TimeUnit.MILLISECONDS.sleep(intervalBaseTwo);\r\n                        isOk = this.backend.tryToConfirm(msgId);\r\n                        if (isOk) {\r\n                            logger.info(\"handled OK, time: {} ,replay = {} ,for {}\", System.currentTimeMillis() - startTime, replay, logStr);\r\n                            return result;\r\n                        }\r\n                        flag = this.backend.cancel(msgId);\r\n                    }catch (Exception e){\r\n                        flag = true;\r\n                    }\r\n                }\r\n            }\r\n            logger.info(\"handled FAIL, time: {} ,replay = {} ,for {}\", System.currentTimeMillis() - startTime, replay, logStr);\r\n            throw new BusyException(\"TIMEOUT, X TRANSACTION UN FINISHED\");\r\n        }\r\n\r\n        return result;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/interner/MessageIdGenerator.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.interner;\r\n\r\nimport java.util.UUID;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class MessageIdGenerator {\r\n\r\n    protected static String get(){\r\n        return UUID.randomUUID().toString().replace(\"-\",\"\");\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-api/src/main/java/io/xream/acku/interner/MessageTraceable.java",
    "content": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements.  See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License.  You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage io.xream.acku.interner;\n\n/**\n * @author Sim 8966188@qq.com\n * @apiNote to use @EnableReliabilityManagement, @ReliableProducer and @ReliableOnConsumed, <br>\n *     reliable center's DTO has to implements MessageTraceable <br>\n *     sql update in order, need getTime() <br>\n */\npublic interface MessageTraceable {\n\n    String getTracingId();\n\n    /**\n     *\n     * full tx: after finishing all write, then produce next message(if necessary) <br>\n     * at first persist the next message, after persist all biz data, then find the message <br>\n     * by parentId,and produce it <br>\n     */\n    String getParentId();\n\n    /**\n     * for server, scheduling retry, java code like:  <br>\n     *     if ( message.getTime() < now-interval) <br>\n     * for client, as condition of sql update for 2pc business, sql code like: <br>\n     *    update inventory set refreshAt = ${message.time} where id = 1 and refreshAt < ${message.time} <br>\n     */\n    long getTime();\n}\n"
  },
  {
    "path": "acku-core/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-core</artifactId>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-api</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-entity</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>org.springframework</groupId>\r\n            <artifactId>spring-web</artifactId>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n</project>"
  },
  {
    "path": "acku-core/src/main/java/io/xream/acku/api/acku/AckuMessageService.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.api.acku;\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.Qr;\r\n\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface AckuMessageService {\r\n\r\n    boolean create(AckuMessage message);\r\n    boolean refresh(Qr<AckuMessage> condition);\r\n    boolean remove(String id);\r\n\r\n    List<AckuMessage> listByCond(Q criteria);\r\n\r\n    List<Map<String,Object>> listByX(Q.X x);\r\n\r\n    AckuMessage get(String msgId);\r\n}\r\n"
  },
  {
    "path": "acku-core/src/main/java/io/xream/acku/api/acku/DtoConverter.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.api.acku;\r\n\r\nimport io.xream.acku.bean.dto.AckuDto;\r\n\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface DtoConverter {\r\n\r\n    AckuDto convertOnConsumed(Object message);\r\n}\r\n"
  },
  {
    "path": "acku-core/src/main/java/io/xream/acku/api/acku/FailedService.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.api.acku;\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.Qr;\r\n\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface FailedService {\r\n\r\n    boolean refresh(Qr<AckuMessage> condition);\r\n    boolean refreshUnSafe(Qr<AckuMessage> condition);\r\n\r\n    List<Map<String, Object>> listByX(Q.X x);\r\n}\r\n"
  },
  {
    "path": "acku-core/src/main/java/io/xream/acku/api/acku/MessageResultService.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.api.acku;\r\n\r\nimport io.xream.acku.bean.entity.MessageResult;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.Qr;\r\n\r\nimport java.util.List;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface MessageResultService {\r\n\r\n    boolean create(MessageResult result);\r\n    boolean refresh(Qr<MessageResult> qr);\r\n\r\n    boolean removeByMessageId(String id);\r\n\r\n    List<MessageResult> listByCond(Q q);\r\n}\r\n"
  },
  {
    "path": "acku-core/src/main/java/io/xream/acku/backend/AckuBackendImpl.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.backend;\r\n\r\nimport io.xream.acku.TCCTopic;\r\nimport io.xream.acku.api.acku.DtoConverter;\r\nimport io.xream.acku.bean.constant.MessageStatus;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.bean.dto.ConsumedAckuDto;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.bean.entity.MessageResult;\r\nimport io.xream.acku.bean.exception.AckuExceptioin;\r\nimport io.xream.acku.interner.AckuBackend;\r\nimport io.xream.acku.interner.MessageTraceable;\r\nimport io.xream.acku.remote.acku.AckuServiceRemote;\r\nimport io.xream.internal.util.ExceptionUtil;\r\nimport io.xream.x7.base.GenericObject;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.transaction.annotation.Transactional;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.Date;\r\nimport java.util.List;\r\nimport java.util.concurrent.Callable;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class AckuBackendImpl implements AckuBackend {\r\n\r\n    @Autowired\r\n    private AckuServiceRemote ackuServiceRemote;\r\n\r\n    @Autowired\r\n    private DtoConverter dtoConverter;\r\n\r\n    @Override\r\n    @Transactional\r\n    public Object produceReliably(Boolean useTcc, String id, int retryMax, boolean underConstruction, String topic, Object body, MessageTraceable MessageTraceable, String[] svcs, Callable callable) {\r\n\r\n        String tracingId = null;\r\n        if (MessageTraceable != null){\r\n            tracingId = MessageTraceable.getTracingId();\r\n        }\r\n        AckuMessage reliableMessage = new AckuMessage(id,retryMax,underConstruction,tracingId,topic, body, Arrays.asList(svcs));\r\n        reliableMessage.setTcc(useTcc ? TCCTopic._TCC_TRY.name() : TCCTopic._TCC_NONE.name());\r\n        if (useTcc) {\r\n            reliableMessage.resetTopic(TCCTopic._TCC_TRY);\r\n        }\r\n        AckuDto dto = new AckuDto(reliableMessage);\r\n        dto = this.ackuServiceRemote.create(dto); //STEP 1\r\n\r\n        Object result = null;\r\n        try {\r\n            result = callable.call(); //STEP 2\r\n        } catch (Exception e) {\r\n            throw new AckuExceptioin(ExceptionUtil.getMessage(e));\r\n        }\r\n\r\n        this.ackuServiceRemote.produce(dto); //STEP 3\r\n\r\n        return result;\r\n    }\r\n\r\n\r\n    @Override\r\n    @Transactional\r\n    public void onConsumed(String svc, Object message, Runnable runnable) {\r\n\r\n        AckuDto dto = this.dtoConverter.convertOnConsumed(message);\r\n\r\n        if (dto.isConsumed(svc))\r\n            return;\r\n\r\n        List<MessageResult> list = dto.getResultList();\r\n        MessageResult mr = null;\r\n        for (MessageResult messageResult : list) {\r\n            if (messageResult.getSvc().equals(svc)) { //可以是spring.application.name\r\n                mr = messageResult;\r\n                break;\r\n            }\r\n        }\r\n\r\n        try {\r\n            runnable.run(); //STEP 1\r\n        } catch (Exception e) {\r\n            throw new AckuExceptioin(ExceptionUtil.getMessage(e));\r\n        }\r\n\r\n        ConsumedAckuDto cdto = dto.consume(svc,dto.getMessage().getTcc(), mr);\r\n        ackuServiceRemote.consume(cdto); //STEP 2\r\n\r\n    }\r\n\r\n    @Override\r\n    public boolean createNext(String id, int retryMax, String nextTopic, Object nextBody,Object preMessage,String[] svcs) {\r\n\r\n        AckuDto dto = this.dtoConverter.convertOnConsumed(preMessage);\r\n\r\n        String parentId = dto.getParentId();//先get parentId\r\n\r\n        GenericObject go = new GenericObject(nextBody);\r\n        Date date = new Date();\r\n        AckuMessage reliableMessage = dto.getMessage();\r\n        reliableMessage.setId(id);\r\n        reliableMessage.setTracingId(dto.getTracingId());\r\n        reliableMessage.setParentId(parentId);\r\n        reliableMessage.setTopic(nextTopic);\r\n        reliableMessage.setBody(go);\r\n        reliableMessage.setTcc(TCCTopic._TCC_NONE.name());\r\n        reliableMessage.setRetryMax(retryMax);\r\n        reliableMessage.setUnderConstruction(false);\r\n        reliableMessage.setSvcDone(\"&\");\r\n        reliableMessage.setSvcList(Arrays.asList(svcs));\r\n        reliableMessage.setSendAt(0);\r\n        reliableMessage.setRetryCount(0L);\r\n        reliableMessage.setCreateAt(date);\r\n        reliableMessage.setRefreshAt(date);\r\n        reliableMessage.setStatus(MessageStatus.NEXT.name());\r\n\r\n        dto.setMessage(reliableMessage);\r\n        dto.setResultList(new ArrayList<>());\r\n\r\n        this.ackuServiceRemote.create(dto);\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean tryToConfirm(String msgId) {\r\n        return this.ackuServiceRemote.tryToConfirm(msgId);\r\n    }\r\n\r\n    @Override\r\n    public boolean cancel(String msgId) {\r\n        return this.ackuServiceRemote.cancel(msgId);\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "acku-core/src/main/java/io/xream/acku/remote/acku/AckuServiceRemote.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.remote.acku;\r\n\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.bean.dto.ConsumedAckuDto;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.service.annotation.HttpExchange;\r\nimport org.springframework.web.service.annotation.PostExchange;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@HttpExchange(\"http://acku-app/message\" )\r\npublic interface AckuServiceRemote {\r\n\r\n    @PostExchange(\"/create\")\r\n    AckuDto create(@RequestBody AckuDto dto);\r\n\r\n    @PostExchange(\"/produce\")\r\n    boolean produce(@RequestBody AckuDto dto);\r\n\r\n    @PostExchange(\"/consume\")\r\n    boolean consume(@RequestBody ConsumedAckuDto dto);\r\n\r\n    @PostExchange(\"/tryToConfirm\")\r\n    boolean tryToConfirm(@RequestBody String msgId);\r\n\r\n    @PostExchange(\"/cancel\")\r\n    boolean cancel(@RequestBody String msgId);\r\n\r\n}\r\n"
  },
  {
    "path": "acku-core/src/main/java/io/xream/acku/remote/acku/FailedServiceRemote.java",
    "content": "package io.xream.acku.remote.acku;\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport org.springframework.web.bind.annotation.PathVariable;\r\nimport org.springframework.web.service.annotation.GetExchange;\r\nimport org.springframework.web.service.annotation.HttpExchange;\r\n\r\nimport java.util.List;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@HttpExchange(\"http://acku-app/failed\" )\r\npublic interface FailedServiceRemote {\r\n\r\n\r\n    @GetExchange(value = \"/find\")\r\n    List<AckuMessage> findFailed();\r\n\r\n    @GetExchange(value = \"/find/{topic}\")\r\n    List<AckuMessage> findFailedByTopic(@PathVariable(\"topic\") String topic);\r\n\r\n    @GetExchange(value = \"/retryAll\")\r\n    boolean retryAll();\r\n\r\n    @GetExchange(value = \"/retry/{messageId}\")\r\n    boolean retry(@PathVariable(\"messageId\") String messageId);\r\n\r\n}\r\n"
  },
  {
    "path": "acku-entity/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-entity</artifactId>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-api</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n    </dependencies>\r\n</project>"
  },
  {
    "path": "acku-entity/src/main/java/io/xream/acku/TCCTopic.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic enum TCCTopic {\r\n\r\n    _TCC_NONE,\r\n    _TCC_TRY,\r\n    _TCC_CONFIRM,\r\n    _TCC_CANCEL;\r\n}\r\n"
  },
  {
    "path": "acku-entity/src/main/java/io/xream/acku/bean/constant/MessageStatus.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.bean.constant;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic enum MessageStatus {\r\n\r\n    NEXT,\r\n    BLANK,\r\n    SEND,\r\n    OK, //定时任务删除记录\r\n    FAIL; //可人工补偿数据\r\n\r\n}\r\n"
  },
  {
    "path": "acku-entity/src/main/java/io/xream/acku/bean/dto/AckuDto.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.bean.dto;\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.bean.entity.MessageResult;\r\nimport io.xream.acku.interner.MessageTraceable;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class AckuDto<T> implements MessageTraceable, Serializable {\r\n    private static final long serialVersionUID = 4467713246475538455L;\r\n\r\n    private AckuMessage<T> message;\r\n    private List<MessageResult> resultList = new ArrayList<>();\r\n\r\n    public AckuDto(){\r\n    }\r\n\r\n    public AckuDto(AckuMessage<T> message){\r\n        this.message = message;\r\n    }\r\n\r\n    public AckuDto(AckuMessage<T> message, List<MessageResult> resultList ){\r\n        this.message = message;\r\n        this.resultList = resultList;\r\n    }\r\n\r\n    public AckuMessage<T> getMessage() {\r\n        return message;\r\n    }\r\n\r\n    public void setMessage(AckuMessage<T> message) {\r\n        this.message = message;\r\n    }\r\n\r\n    public List<MessageResult> getResultList() {\r\n        return resultList;\r\n    }\r\n\r\n    public void setResultList(List<MessageResult> resultList) {\r\n        this.resultList = resultList;\r\n    }\r\n\r\n    public boolean isConsumed(String svc){\r\n        if (message == null)\r\n            return true;\r\n        return message.getSvcDone().contains(svc);\r\n    }\r\n\r\n    public boolean isUnRegistered(String svc){\r\n        if (message == null)\r\n            return true;\r\n        return ! message.getSvcList().contains(svc);\r\n    }\r\n\r\n    public ConsumedAckuDto consume(String consumedSvc, String tcc, MessageResult consumedMessageResult ) {\r\n        ConsumedAckuDto dto = new ConsumedAckuDto();\r\n        dto.setMsgId(this.message.getId());\r\n        dto.setSvc(consumedSvc);\r\n        dto.setTcc(tcc);\r\n        if (consumedMessageResult != null){\r\n            dto.setResultId(consumedMessageResult.getId());\r\n        }\r\n        return dto;\r\n    }\r\n\r\n    public ConsumedAckuDto consume(String consumedSvc) {\r\n        ConsumedAckuDto dto = new ConsumedAckuDto();\r\n        dto.setMsgId(this.message.getId());\r\n        dto.setSvc(consumedSvc);\r\n        return dto;\r\n    }\r\n\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"ReliableDto{\" +\r\n                \"message=\" + message +\r\n                \", resultList=\" + resultList +\r\n                '}';\r\n    }\r\n\r\n    @Override\r\n    public String getTracingId() {\r\n        return this.message.getTracingId();\r\n    }\r\n\r\n    @Override\r\n    public String getParentId() {\r\n        return this.message.getId();\r\n    }\r\n\r\n    @Override\r\n    public long getTime() {\r\n        return this.message.getSendAt();\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-entity/src/main/java/io/xream/acku/bean/dto/ConsumedAckuDto.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.bean.dto;\r\n\r\nimport io.xream.acku.TCCTopic;\r\n\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class ConsumedAckuDto implements Serializable {\r\n    private static final long serialVersionUID = 4467713246475543155L;\r\n\r\n    private String msgId;\r\n    private String svc;\r\n    private String resultId;\r\n    private String tcc;\r\n\r\n    public String getMsgId() {\r\n        return msgId;\r\n    }\r\n\r\n    public void setMsgId(String msgId) {\r\n        this.msgId = msgId;\r\n    }\r\n\r\n    public String getSvc() {\r\n        return svc;\r\n    }\r\n\r\n    public void setSvc(String svc) {\r\n        this.svc = svc;\r\n    }\r\n\r\n    public String getResultId() {\r\n        return resultId;\r\n    }\r\n\r\n    public void setResultId(String resultId) {\r\n        this.resultId = resultId;\r\n    }\r\n\r\n    public Boolean getUseTcc() {\r\n        return ! tcc.equals(TCCTopic._TCC_NONE);\r\n    }\r\n\r\n    public String getTcc() {\r\n        return tcc;\r\n    }\r\n\r\n    public void setTcc(String tcc) {\r\n        this.tcc = tcc;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"ConsumedReliableDto{\" +\r\n                \"msgId='\" + msgId + '\\'' +\r\n                \", svc='\" + svc + '\\'' +\r\n                \", resultId='\" + resultId + '\\'' +\r\n                \", tcc='\" + tcc + '\\'' +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-entity/src/main/java/io/xream/acku/bean/entity/AckuMessage.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.bean.entity;\r\n\r\nimport io.xream.acku.TCCTopic;\r\nimport io.xream.sqli.annotation.X;\r\nimport io.xream.x7.base.GenericObject;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.Date;\r\nimport java.util.List;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class AckuMessage<T> implements Serializable {\r\n    private static final long serialVersionUID = 2002563420656592953L;\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String tracingId;\r\n    private String parentId;\r\n    private int retryMax;\r\n    private Boolean underConstruction;\r\n    private String status;\r\n    private List<String> svcList;\r\n    private String tcc;\r\n    private String svcDone;\r\n    private String topic;\r\n    private GenericObject<T> body;\r\n    private Date refreshAt;\r\n    private Date createAt;\r\n    private Long retryCount;\r\n    private long sendAt;\r\n\r\n\r\n    public AckuMessage(){}\r\n\r\n    public AckuMessage(String topic, Object body, List<String> svcList){\r\n        this.topic = topic;\r\n        if (body instanceof GenericObject){\r\n            this.body = (GenericObject)body;\r\n        }else {\r\n            this.body = new GenericObject<>((T) body);\r\n        }\r\n        this.svcList = svcList;\r\n    }\r\n\r\n    public AckuMessage(String tracingId, String topic, Object body, List<String> svcList){\r\n        this.tracingId = tracingId;\r\n\r\n        this.topic = topic;\r\n        if (body instanceof GenericObject){\r\n            this.body = (GenericObject)body;\r\n        }else {\r\n            this.body = new GenericObject<>((T) body);\r\n        }\r\n        this.svcList = svcList;\r\n    }\r\n\r\n    public <T> AckuMessage(String id, int retryMax, boolean underConstruction, String tracingId, String topic, Object body, List<String> svcList) {\r\n        this.id = id;\r\n        this.retryMax = retryMax;\r\n        this.underConstruction = underConstruction;\r\n        this.tracingId = tracingId;\r\n\r\n        this.topic = topic;\r\n        if (body instanceof GenericObject){\r\n            this.body = (GenericObject)body;\r\n        }else {\r\n            this.body = new GenericObject((T) body);\r\n        }\r\n        this.svcList = svcList;\r\n    }\r\n\r\n    public void resetTopic(TCCTopic tccTopic) {\r\n        switch (tccTopic){\r\n            case _TCC_TRY:\r\n                if (!this.topic.endsWith(tccTopic.name())){\r\n                    this.topic += tccTopic.name();\r\n                }\r\n                break;\r\n            default:\r\n                if (!this.topic.endsWith(tccTopic.name())){\r\n                    this.topic = this.topic.replace(TCCTopic._TCC_TRY.name(),\"\");\r\n                    this.topic += tccTopic.name();\r\n                }\r\n        }\r\n    }\r\n\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getTracingId() {\r\n        return tracingId;\r\n    }\r\n\r\n    public void setTracingId(String tracingId) {\r\n        this.tracingId = tracingId;\r\n    }\r\n\r\n    public String getParentId() {\r\n        return parentId;\r\n    }\r\n\r\n    public void setParentId(String parentId) {\r\n        this.parentId = parentId;\r\n    }\r\n\r\n    public int getRetryMax() {\r\n        return retryMax;\r\n    }\r\n\r\n    public void setRetryMax(int retryMax) {\r\n        this.retryMax = retryMax;\r\n    }\r\n\r\n    public Boolean getUnderConstruction() {\r\n        return underConstruction;\r\n    }\r\n\r\n    public void setUnderConstruction(Boolean underConstruction) {\r\n        this.underConstruction = underConstruction;\r\n    }\r\n\r\n    public String getStatus() {\r\n        return status;\r\n    }\r\n\r\n    public void setStatus(String status) {\r\n        this.status = status;\r\n    }\r\n\r\n    public String getTcc() {\r\n        return tcc;\r\n    }\r\n\r\n    public void setTcc(String tcc) {\r\n        this.tcc = tcc;\r\n    }\r\n\r\n    public List<String> getSvcList() {\r\n        return svcList;\r\n    }\r\n\r\n    public void setSvcList(List<String> svcList) {\r\n        this.svcList = svcList;\r\n    }\r\n\r\n    public String getSvcDone() {\r\n        return svcDone;\r\n    }\r\n\r\n    public void setSvcDone(String svcDone) {\r\n        this.svcDone = svcDone;\r\n    }\r\n\r\n    public Boolean getUseTcc() {\r\n        if (this.tcc == null)\r\n            return false;\r\n        return ! this.tcc.equals(TCCTopic._TCC_NONE.name());\r\n    }\r\n\r\n    public String getTopic() {\r\n        return topic;\r\n    }\r\n\r\n    public void setTopic(String topic) {\r\n        this.topic = topic;\r\n    }\r\n\r\n    public GenericObject<T> getBody() {\r\n        return body;\r\n    }\r\n\r\n    public void setBody(GenericObject<T> body) {\r\n        this.body = body;\r\n    }\r\n\r\n    public Date getRefreshAt() {\r\n        return refreshAt;\r\n    }\r\n\r\n    public void setRefreshAt(Date refreshAt) {\r\n        this.refreshAt = refreshAt;\r\n    }\r\n\r\n    public Date getCreateAt() {\r\n        return createAt;\r\n    }\r\n\r\n    public void setCreateAt(Date createAt) {\r\n        this.createAt = createAt;\r\n    }\r\n\r\n    public Long getRetryCount() {\r\n        return retryCount;\r\n    }\r\n\r\n    public void setRetryCount(Long retryCount) {\r\n        this.retryCount = retryCount;\r\n    }\r\n\r\n    public long getSendAt() {\r\n        return sendAt;\r\n    }\r\n\r\n    public void setSendAt(long sendAt) {\r\n        this.sendAt = sendAt;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"ReliableMessage{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", tracingId='\" + tracingId + '\\'' +\r\n                \", parentId='\" + parentId + '\\'' +\r\n                \", retryMax='\" + retryMax + '\\'' +\r\n                \", underConstruction='\" + underConstruction + '\\'' +\r\n                \", status='\" + status + '\\'' +\r\n                \", svcList='\" + svcList + '\\'' +\r\n                \", svcDone='\" + svcDone + '\\'' +\r\n                \", tcc='\" + tcc + '\\'' +\r\n                \", topic='\" + topic + '\\'' +\r\n                \", body='\" + body + '\\'' +\r\n                \", refreshAt=\" + refreshAt +\r\n                \", createAt=\" + createAt +\r\n                \", retryCount=\" + retryCount +\r\n                \", sendAt=\" + sendAt +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-entity/src/main/java/io/xream/acku/bean/entity/MessageResult.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.bean.entity;\r\n\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.Date;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class MessageResult<T> implements Serializable {\r\n    private static final long serialVersionUID = 4901898223573975818L;\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String msgId;\r\n    private String status;\r\n    private String svc;\r\n    private Date createAt;\r\n    private Date refreshAt;\r\n\r\n    public MessageResult(){\r\n    }\r\n    public MessageResult(String svc){\r\n        this.svc = svc;\r\n    }\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getMsgId() {\r\n        return msgId;\r\n    }\r\n\r\n    public void setMsgId(String msgId) {\r\n        this.msgId = msgId;\r\n    }\r\n\r\n    public String getStatus() {\r\n        return status;\r\n    }\r\n\r\n    public void setStatus(String status) {\r\n        this.status = status;\r\n    }\r\n\r\n    public String getSvc() {\r\n        return svc;\r\n    }\r\n\r\n    public void setSvc(String svc) {\r\n        this.svc = svc;\r\n    }\r\n\r\n    public Date getCreateAt() {\r\n        return createAt;\r\n    }\r\n\r\n    public void setCreateAt(Date createAt) {\r\n        this.createAt = createAt;\r\n    }\r\n\r\n    public Date getRefreshAt() {\r\n        return refreshAt;\r\n    }\r\n\r\n    public void setRefreshAt(Date refreshAt) {\r\n        this.refreshAt = refreshAt;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"MessageResult{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", msgId='\" + msgId + '\\'' +\r\n                \", svc='\" + svc + '\\'' +\r\n                \", status='\" + status + '\\'' +\r\n                \", createAt=\" + createAt +\r\n                \", refreshAt=\" + refreshAt +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-entity/src/main/java/io/xream/acku/bean/exception/AckuExceptioin.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.bean.exception;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class AckuExceptioin extends RuntimeException {\r\n\r\n    private String message;\r\n\r\n    public AckuExceptioin(){}\r\n\r\n    public AckuExceptioin(String message){\r\n        this.message = message;\r\n    }\r\n\r\n    @Override\r\n    public String getMessage() {\r\n        return message;\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/.gitignore",
    "content": "*/target/\n*/classes/\n*.jar\n*.class\n*.iml\n*/application-test.properties\n*/application-prod.properties\n"
  },
  {
    "path": "acku-message-center/acku-app/Dockerfile",
    "content": "FROM java:openjdk-8-jre-alpine\n\nLABEL version=\"0.2.0\"\n\nMAINTAINER Sim <8966188@qq.com>\n\nENV ACTIVE test\nENV JAVA_OPTS -Xms1024m -Xmx1024m -Xmn320m\n\nADD target/acku-app-0.2.0.jar /data/deploy/acku-app.jar\n\n\nCMD [\"mkdir -p /data/logs\"]\nVOLUME /data/logs /data/logs\n\nEXPOSE 80\n\nENTRYPOINT [\"java\",\"-Dspring.profiles.active=${ACTIVE}\",\"-jar\", \"/data/deploy/acku-app.jar\"]"
  },
  {
    "path": "acku-message-center/acku-app/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku-message-center</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-app</artifactId>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-service</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n    <build>\r\n        <plugins>\r\n            <plugin>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-maven-plugin</artifactId>\r\n                <version>3.2.2</version>\r\n                <executions>\r\n                    <execution>\r\n\r\n                        <goals>\r\n                            <goal>repackage</goal>\r\n                        </goals>\r\n                    </execution>\r\n\r\n                </executions>\r\n                <configuration>\r\n                    <mainClass>io.xream.acku.App</mainClass>\r\n                </configuration>\r\n            </plugin>\r\n        </plugins>\r\n        <resources>\r\n            <resource>\r\n                <directory>src/main/resources</directory>\r\n            </resource>\r\n        </resources>\r\n    </build>\r\n\r\n</project>"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/App.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku;\r\n\r\nimport io.xream.x7.EnableDateToLongForJackson;\r\nimport io.xream.x7.EnableX7Repository;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.transaction.annotation.EnableTransactionManagement;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@SpringBootApplication\r\n@EnableTransactionManagement\r\n@EnableX7Repository(baseTypeSupported = true)\r\n@EnableDateToLongForJackson\r\npublic class App {\r\n\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tSpringApplication.run(App.class);\r\n\t\t\r\n    }\r\n\r\n\r\n//    @Bean\r\n//\tpublic ProducerCustomizer producerCustomizer(){\r\n//\r\n//\t\treturn new ProducerCustomizer() {\r\n//\t\t\t@Override\r\n//\t\t\tpublic Producer customize() {\r\n//\t\t\t\treturn null; //Default is io.xream.acku.config.KafkaProducer, you can use RocketMQ,RabbitMQ ....\r\n//\t\t\t}\r\n//\t\t};\r\n//\t}\r\n\r\n}\r\n\r\n\r\n\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/config/DefaultKafkaProducer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.config;\r\n\r\nimport io.xream.acku.bean.exception.AckuExceptioin;\r\nimport io.xream.acku.produce.Producer;\r\nimport io.xream.internal.util.ExceptionUtil;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.kafka.core.KafkaTemplate;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class DefaultKafkaProducer implements Producer {\r\n\r\n\r\n    private final static Logger logger = LoggerFactory.getLogger(DefaultKafkaProducer.class);\r\n\r\n    private KafkaTemplate<String, String> kafkaTemplate;\r\n\r\n    public DefaultKafkaProducer(KafkaTemplate kafkaTemplate) {\r\n        this.kafkaTemplate = kafkaTemplate;\r\n    }\r\n\r\n    @Override\r\n    public boolean send(String topic, String message) {\r\n\r\n        try {\r\n            kafkaTemplate.send(topic, message).get();\r\n            if (logger.isDebugEnabled()) {\r\n                logger.debug(\"Kafka produce, topic = {}, data = {}\", topic, message);\r\n            }\r\n        }catch (Throwable ex) {\r\n            String str = ExceptionUtil.getMessage(ex);\r\n            logger.error(\"Kafka produce error, ex = {}, topic = {}, data = {}\", str, topic, message);\r\n            throw new AckuExceptioin(str);\r\n        }\r\n        return true;\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/config/KafkaConfig.java",
    "content": "package io.xream.acku.config;\r\n\r\nimport io.xream.acku.produce.Producer;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Bean;\r\nimport org.springframework.context.annotation.Configuration;\r\nimport org.springframework.context.annotation.Primary;\r\nimport org.springframework.core.annotation.Order;\r\n\r\n@Configuration\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class KafkaConfig {\r\n\r\n    @Autowired\r\n    private NextKafkaProperties nextKafkaProperties;\r\n\r\n    @Bean(name = \"producer\")\r\n    @Primary\r\n    @Order(2)\r\n    public Producer producer(){\r\n        return new ProducerWrapper();\r\n    }\r\n\r\n    @Bean(name = \"nextProducer\")\r\n    @Order(3)\r\n    public Producer nextProducer() {\r\n\r\n        NextKafkaProducer nextKafkaProducer = new NextKafkaProducer();\r\n        nextKafkaProducer.init(this.nextKafkaProperties.getProducer().buildProperties(null));\r\n\r\n        return nextKafkaProducer;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/config/MQConfig.java",
    "content": "package io.xream.acku.config;\r\n\r\nimport io.xream.acku.produce.Producer;\r\nimport org.springframework.beans.FatalBeanException;\r\nimport org.springframework.boot.context.event.ApplicationStartedEvent;\r\nimport org.springframework.context.ApplicationListener;\r\nimport org.springframework.kafka.core.KafkaTemplate;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class MQConfig implements\r\n        ApplicationListener<ApplicationStartedEvent> {\r\n    @Override\r\n    public void onApplicationEvent(ApplicationStartedEvent event) {\r\n\r\n        ProducerWrapper wrapper = event.getApplicationContext().getBean(ProducerWrapper.class);\r\n        ProducerCustomizer customizer = null;\r\n\r\n        try {\r\n            customizer = event.getApplicationContext().getBean(ProducerCustomizer.class);\r\n        } catch (Exception e) {\r\n        }\r\n\r\n\r\n        Producer producer = null;\r\n        if (customizer != null){\r\n            producer = customizer.customize();\r\n        }\r\n\r\n        if (producer == null) {\r\n            KafkaTemplate<String, String> kafkaTemplate = null;\r\n            try {\r\n                kafkaTemplate = event.getApplicationContext().getBean(KafkaTemplate.class);\r\n            } catch (Exception e) {\r\n                throw new FatalBeanException(\"can't find any producer, no config like Kafka\");\r\n            }\r\n\r\n            producer = new DefaultKafkaProducer(kafkaTemplate);\r\n        }\r\n\r\n        wrapper.setProducer(producer);\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/config/NextKafkaProducer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.config;\r\n\r\n\r\nimport io.xream.acku.produce.Producer;\r\nimport io.xream.internal.util.ExceptionUtil;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.boot.autoconfigure.kafka.KafkaProperties;\r\nimport org.springframework.kafka.core.DefaultKafkaProducerFactory;\r\nimport org.springframework.kafka.core.KafkaTemplate;\r\nimport org.springframework.kafka.core.ProducerFactory;\r\n\r\nimport java.util.Map;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class NextKafkaProducer implements Producer {\r\n\r\n    private final static Logger logger = LoggerFactory.getLogger(NextKafkaProducer.class);\r\n\r\n    private KafkaTemplate<String,String> kafkaTemplate;\r\n\r\n    protected void init(Map<String,Object> map){\r\n\r\n        KafkaProperties kafkaProperties = new KafkaProperties();\r\n        Map<String,Object> configMap = kafkaProperties.buildProducerProperties();\r\n        configMap.putAll(map);\r\n        ProducerFactory<String, String> producerFactory = new DefaultKafkaProducerFactory<>(configMap);\r\n        kafkaTemplate = new KafkaTemplate<>(producerFactory);\r\n\r\n    }\r\n\r\n    @Override\r\n    public boolean send(String topic, String message) {\r\n\r\n        try {\r\n            this.kafkaTemplate.send(topic,message).get();\r\n            logger.info(\"Kafka produce, topic = {}, data = {}\", topic, message);\r\n        }catch (Throwable ex) {\r\n            String str = ExceptionUtil.getMessage(ex);\r\n            logger.error(\"Kafka produce error, ex = {}, topic = {}, data = {}\", str, topic, message);\r\n            return false;\r\n        }\r\n        return true;\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/config/NextKafkaProperties.java",
    "content": "package io.xream.acku.config;\r\n\r\nimport org.springframework.boot.autoconfigure.kafka.KafkaProperties;\r\nimport org.springframework.boot.context.properties.ConfigurationProperties;\r\nimport org.springframework.boot.context.properties.EnableConfigurationProperties;\r\nimport org.springframework.context.annotation.Configuration;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@EnableConfigurationProperties\r\n@Configuration\r\n@ConfigurationProperties(prefix = \"next.kafka\")\r\npublic class NextKafkaProperties {\r\n\r\n    private final KafkaProperties.Producer producer = new KafkaProperties.Producer();\r\n\r\n    public KafkaProperties.Producer getProducer() {\r\n        return producer;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/config/ProducerCustomizer.java",
    "content": "package io.xream.acku.config;\r\n\r\nimport io.xream.acku.produce.Producer;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface ProducerCustomizer {\r\n\r\n    Producer customize();\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/config/ProducerWrapper.java",
    "content": "package io.xream.acku.config;\r\n\r\nimport io.xream.acku.produce.Producer;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class ProducerWrapper implements Producer {\r\n\r\n    private Producer producer;\r\n    public void setProducer(Producer producer) {\r\n        this.producer = producer;\r\n    }\r\n    @Override\r\n    public boolean send(String topic, String message) {\r\n        return producer.send(topic, message);\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/controller/AckuController.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.controller;\r\n\r\nimport io.xream.acku.TCCTopic;\r\nimport io.xream.acku.api.acku.AckuMessageService;\r\nimport io.xream.acku.api.acku.MessageResultService;\r\nimport io.xream.acku.bean.constant.MessageStatus;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.bean.dto.ConsumedAckuDto;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.bean.entity.MessageResult;\r\nimport io.xream.acku.bean.exception.AckuExceptioin;\r\nimport io.xream.acku.produce.Producer;\r\nimport io.xream.internal.util.JsonX;\r\nimport io.xream.internal.util.StringUtil;\r\nimport io.xream.sqli.builder.QrB;\r\nimport jakarta.annotation.Resource;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.transaction.annotation.Transactional;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\nimport java.util.Date;\r\nimport java.util.List;\r\nimport java.util.UUID;\r\n\r\n@Transactional\r\n@RestController\r\n@RequestMapping(\"/message\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class AckuController {\r\n\r\n\r\n    @Autowired\r\n    private AckuMessageService AckuMessageService;\r\n    @Autowired\r\n    private MessageResultService messageResultService;\r\n\r\n    @Autowired\r\n    private Producer producer;\r\n\r\n    @Resource(name = \"nextProducer\")\r\n    private Producer nextProducer;\r\n\r\n    @Autowired\r\n    private io.xream.acku.controller.TccBusiness tccBusiness;\r\n\r\n    @Autowired\r\n    private io.xream.acku.controller.NextBusiness nextBusiness;\r\n\r\n\r\n    @RequestMapping(\"/create\")\r\n    public AckuDto create(@RequestBody AckuDto dto) {\r\n\r\n        AckuMessage AckuMessage = dto.getMessage();\r\n        if (AckuMessage == null)\r\n            throw new AckuExceptioin(\"AckuMessage == null\");\r\n\r\n        Date date = new Date();\r\n\r\n        String messageId = AckuMessage.getId();\r\n        if (messageId == null) {\r\n            messageId = UUID.randomUUID().toString();\r\n            messageId = messageId.replace(\"-\", \"\");\r\n        }\r\n\r\n        AckuMessage.setId(messageId);\r\n        AckuMessage.setCreateAt(date);\r\n        AckuMessage.setSendAt(date.getTime());\r\n        AckuMessage.setSvcDone(io.xream.acku.controller.TccBusiness.SVC_DONE_PREFIX);\r\n\r\n        if (StringUtil.isNullOrEmpty(AckuMessage.getTracingId())) {\r\n            AckuMessage.setTracingId(messageId);\r\n        }\r\n\r\n        if (StringUtil.isNullOrEmpty(AckuMessage.getStatus())){\r\n            AckuMessage.setStatus(MessageStatus.BLANK.toString());\r\n        }\r\n\r\n        List<MessageResult> resultList = dto.getResultList();\r\n\r\n        this.AckuMessageService.create(AckuMessage);\r\n\r\n        for (MessageResult result : resultList) {\r\n\r\n            result.setId(result.getSvc() + \"_\" + messageId);\r\n            result.setMsgId(messageId);\r\n            result.setStatus(MessageStatus.BLANK.toString());\r\n            result.setCreateAt(date);\r\n\r\n            this.messageResultService.create(result);\r\n        }\r\n\r\n        return dto;\r\n    }\r\n\r\n\r\n    @RequestMapping(\"/produce\")\r\n    public boolean produce(@RequestBody  AckuDto dto) {\r\n\r\n        AckuMessage AckuMessage = dto.getMessage();\r\n        if (AckuMessage == null)\r\n            throw new AckuExceptioin(\"AckuMessage == null\");\r\n\r\n        Date date = new Date();\r\n        AckuMessage.setRefreshAt(date);\r\n        AckuMessage.setStatus(MessageStatus.SEND.toString());\r\n\r\n        boolean flag = this.AckuMessageService.refresh(\r\n                QrB.of(AckuMessage.class)\r\n                        .refresh(\"status\",AckuMessage.getStatus())\r\n                        .refresh(\"sendAt\", AckuMessage.getSendAt())\r\n                        .refresh(\"refreshAt\", AckuMessage.getRefreshAt())\r\n                        .eq(\"id\", AckuMessage.getId()).build()\r\n        );\r\n\r\n        if (!flag)\r\n            throw new AckuExceptioin(\"AckuMessage refresh persist failed\");\r\n\r\n        /*\r\n         * MQ\r\n         */\r\n        String topic = AckuMessage.getTopic();\r\n        return producer.send(topic, JsonX.toJson(dto));\r\n    }\r\n\r\n\r\n    @RequestMapping(\"/consume\")\r\n    public boolean consume(@RequestBody  ConsumedAckuDto dto) {\r\n\r\n        String msgId = dto.getMsgId();\r\n        String svc = dto.getSvc();\r\n        if (StringUtil.isNullOrEmpty(msgId))\r\n            throw new AckuExceptioin(\"ConsumedAckuDto lack of msgId: \" + dto);\r\n\r\n        if (StringUtil.isNullOrEmpty(svc))\r\n            return true;\r\n\r\n        Date date = new Date();\r\n\r\n        String resultId = dto.getResultId();\r\n        if (StringUtil.isNotNull(resultId)) {\r\n\r\n            boolean flag = this.messageResultService.refresh(\r\n                    QrB.of(MessageResult.class)\r\n                            .refresh(\"status\", dto.getTcc())\r\n                            .refresh(\"refreshAt\", date)\r\n                            .eq(\"id\", resultId).eq(\"status\", MessageStatus.BLANK).build()\r\n            );\r\n            if (!flag)\r\n                throw new AckuExceptioin(\"Problem with refresh resultMessage, id = \" + resultId);\r\n        }else {\r\n            String id = svc + \"_\" + msgId;\r\n            if (id.length() > 55) {\r\n                id = id.substring(0,55);\r\n            }\r\n            MessageResult messageResult = new MessageResult();\r\n            messageResult.setId(id);\r\n            messageResult.setMsgId(msgId);\r\n            messageResult.setStatus(dto.getTcc());\r\n            messageResult.setSvc(svc);\r\n            messageResult.setCreateAt(date);\r\n            messageResult.setRefreshAt(date);\r\n            try {\r\n                boolean flag = this.messageResultService.create(messageResult);\r\n                if (!flag)\r\n                    throw new AckuExceptioin(\"Problem with create resultMessage, id = \" + id);\r\n            }catch (Exception e){\r\n                throw new AckuExceptioin(\"Problem with create resultMessage, id = \" + id);\r\n            }\r\n        }\r\n\r\n        return this.AckuMessageService.refresh(\r\n                QrB.of(AckuMessage.class)\r\n                        .refresh(\"svcDone = CONCAT(svcDone, ? , '\" + io.xream.acku.controller.TccBusiness.SVC_DONE_PREFIX +\"' )\", svc)\r\n                        .refresh(\"refreshAt\", date)\r\n                        .eq(\"id\", msgId)\r\n                        .eq(\"tcc\", dto.getUseTcc() ? dto.getTcc() : null).build()\r\n        );\r\n\r\n    }\r\n\r\n\r\n    @RequestMapping(\"/tryToConfirm\")\r\n    public boolean tryToConfirm(@RequestBody String msgId) {\r\n        AckuMessage message = this.AckuMessageService.get(msgId);\r\n        if (message == null)\r\n            return true;\r\n\r\n        for (Object svc : message.getSvcList()){\r\n            if (!message.getSvcDone().contains(svc.toString()))\r\n                return false;\r\n        }\r\n\r\n        if (message.getTcc().equals(TCCTopic._TCC_NONE.name()))\r\n            return true;\r\n\r\n        boolean flag = this.tccBusiness.confirm(message,AckuMessageService,producer);\r\n\r\n        if (!flag)\r\n            throw new RuntimeException(\"ERROR, at AckuProducer TCC confirm\");\r\n\r\n        try {\r\n            this.nextBusiness.produce(message.getId(), AckuMessageService, nextProducer);\r\n        }catch (Exception e) {\r\n            // 需要任务补偿\r\n        }\r\n\r\n        return flag;\r\n    }\r\n\r\n\r\n    @RequestMapping(\"/cancel\")\r\n    public boolean cancel(@RequestBody String msgId) {\r\n\r\n        AckuMessage message = this.AckuMessageService.get(msgId);\r\n        if (message == null)\r\n            return false;\r\n        if (message.getTcc().equals(TCCTopic._TCC_NONE.name()))\r\n            return false;\r\n\r\n        return this.tccBusiness.cancel(message,AckuMessageService,producer);\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/controller/FailedController.java",
    "content": "package io.xream.acku.controller;\r\n\r\nimport io.xream.acku.api.acku.FailedService;\r\nimport io.xream.acku.bean.constant.MessageStatus;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.sqli.builder.Direction;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.QB;\r\nimport io.xream.sqli.builder.QrB;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.web.bind.annotation.PathVariable;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\n@RestController\r\n@RequestMapping(\"/failed\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class FailedController {\r\n\r\n    @Autowired\r\n    private FailedService failedService;\r\n\r\n    @RequestMapping(value = \"/find\", method = RequestMethod.GET)\r\n    public List<Map<String,Object>> findFailed() {\r\n\r\n        QB.X builder = QB.x();\r\n        builder.select(\"id\",\"status\",\"retryMax\",\"topic\").from(AckuMessage.class);\r\n        builder.eq(\"status\", MessageStatus.FAIL).gt(\"retryMax\", 0);\r\n        builder.sort(\"topic\", Direction.DESC);\r\n\r\n        Q.X x = builder.build();\r\n\r\n        List<Map<String,Object>> mapList = this.failedService.listByX(x);\r\n\r\n        return mapList;\r\n    }\r\n\r\n    @RequestMapping(value = \"/find/{topic}\", method = RequestMethod.GET)\r\n    public List<Map<String,Object>> findFailedByTopic(@PathVariable(\"topic\") String topic) {\r\n\r\n        QB.X builder = QB.x();\r\n        builder.select(\"id\",\"status\",\"retryMax\",\"topic\").from(AckuMessage.class);\r\n        builder.eq(\"status\", MessageStatus.FAIL).eq(\"topic\",topic).gt(\"retryMax\", 0);\r\n\r\n        Q.X x = builder.build();\r\n\r\n        List<Map<String,Object>> mapList = this.failedService.listByX(x);\r\n\r\n        return mapList;\r\n    }\r\n\r\n    @RequestMapping(value = \"/retryAll\", method = RequestMethod.GET)\r\n    public boolean retryAll(){\r\n\r\n        return this.failedService.refreshUnSafe(\r\n                QrB.of(AckuMessage.class).refresh(\"status\",MessageStatus.SEND)\r\n                        .refresh(\"retryCount\",0)\r\n                        .eq(\"status\",MessageStatus.FAIL).gt(\"retryMax\",0).build()\r\n        );\r\n    }\r\n\r\n    @RequestMapping(value = \"/retry/{messageId}\", method = RequestMethod.GET)\r\n    public boolean retry(@PathVariable(\"messageId\") String messageId){\r\n\r\n        return this.failedService.refresh(\r\n                QrB.of(AckuMessage.class).refresh(\"status\",MessageStatus.SEND)\r\n                        .refresh(\"retryCount\",0)\r\n                        .eq(\"id\",messageId).build()\r\n        );\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/controller/NextBusiness.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.controller;\r\n\r\nimport io.xream.acku.api.acku.AckuMessageService;\r\nimport io.xream.acku.bean.constant.MessageStatus;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.bean.exception.AckuExceptioin;\r\nimport io.xream.acku.produce.Producer;\r\nimport io.xream.internal.util.JsonX;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.QB;\r\nimport io.xream.sqli.builder.QrB;\r\nimport org.springframework.stereotype.Component;\r\nimport org.springframework.transaction.annotation.Transactional;\r\n\r\nimport java.util.Date;\r\nimport java.util.List;\r\n\r\n@Component\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class NextBusiness {\r\n\r\n    @Transactional\r\n    public boolean produce(String parentId, AckuMessageService AckuMessageService, Producer producer){\r\n\r\n        QB builder = QB.of(AckuMessage.class);\r\n        builder.eq(\"parentId\",parentId);\r\n        builder.eq(\"status\",MessageStatus.NEXT);\r\n        Q q = builder.build();\r\n\r\n        List<AckuMessage> list = AckuMessageService.listByCond(q);\r\n\r\n        Date date = new Date();\r\n\r\n        for (AckuMessage AckuMessage : list) {\r\n            AckuMessageService.refresh(\r\n                    QrB.of(AckuMessage.class).refresh(\"status\",MessageStatus.SEND)\r\n                            .refresh(\"sendAt\",date.getTime())\r\n                            .refresh(\"refreshAt\", date)\r\n                            .eq(\"id\", AckuMessage.getId()).build()\r\n            );\r\n        }\r\n\r\n        for (AckuMessage AckuMessage : list) {\r\n            AckuDto dto = new AckuDto();\r\n            dto.setMessage(AckuMessage);\r\n            String message = JsonX.toJson(dto);\r\n            String topic = AckuMessage.getTopic();\r\n            boolean flag = producer.send(topic, message);\r\n            if (!flag) {\r\n                throw new AckuExceptioin(\"Next produce failed， topic: \" + topic + \", message: \" + message);\r\n            }\r\n        }\r\n\r\n        return true;\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/controller/ScheduleAckuController.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.controller;\r\n\r\nimport io.xream.acku.TCCTopic;\r\nimport io.xream.acku.api.acku.AckuMessageService;\r\nimport io.xream.acku.api.acku.MessageResultService;\r\nimport io.xream.acku.bean.constant.MessageStatus;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.bean.entity.MessageResult;\r\nimport io.xream.acku.produce.Producer;\r\nimport io.xream.internal.util.JsonX;\r\nimport io.xream.internal.util.StringUtil;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.QB;\r\nimport io.xream.sqli.builder.QrB;\r\nimport io.xream.x7.base.GenericObject;\r\nimport jakarta.annotation.Resource;\r\nimport org.apache.commons.collections.MapUtils;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.beans.factory.annotation.Value;\r\nimport org.springframework.transaction.annotation.Transactional;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\nimport java.util.*;\r\n\r\n@RestController\r\n@RequestMapping(\"/schedule\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class ScheduleAckuController {\r\n\r\n    @Autowired\r\n    private AckuMessageService AckuMessageService;\r\n    @Autowired\r\n    private MessageResultService messageResultService;\r\n\r\n    @Autowired\r\n    private Producer producer;\r\n\r\n    @Resource(name = \"nextProducer\")\r\n    private Producer nextProducer;\r\n\r\n    @Autowired\r\n    private TccBusiness tccBusiness;\r\n\r\n    @Autowired\r\n    private NextBusiness nextBusiness;\r\n\r\n\r\n    @Value(\"${acku.retry.duration:5000}\")\r\n    private long ackuRetryDuration;\r\n\r\n    private long checkStatusDuration = 1400;\r\n\r\n\r\n    @RequestMapping(value = \"/tryToProduceNext\",method = RequestMethod.GET)\r\n    public boolean tryToProduceNext(){\r\n\r\n        QB builder = QB.of(AckuMessage.class);\r\n        builder.eq(\"status\",MessageStatus.NEXT);\r\n\r\n        Q q = builder.build();\r\n\r\n        List<AckuMessage> list = this.AckuMessageService.listByCond(q);\r\n\r\n        Map<String,List<AckuMessage>> map = new HashMap<>();\r\n        for (AckuMessage AckuMessage : list) {\r\n            String parentId = AckuMessage.getParentId();\r\n            List<AckuMessage> valueList = map.get(parentId);\r\n            if (valueList == null) {\r\n                valueList = new ArrayList<>();\r\n                map.put(parentId,valueList);\r\n            }\r\n            valueList.add(AckuMessage);\r\n        }\r\n\r\n        for (String parentId : map.keySet()){\r\n            AckuMessage AckuMessage = this.AckuMessageService.get(parentId);\r\n            if (AckuMessage.getStatus().equals(MessageStatus.OK.name())){\r\n                this.nextBusiness.produce(parentId,AckuMessageService,nextProducer);\r\n            }\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n    @RequestMapping(value = \"/tryToFinish\", method = RequestMethod.GET)\r\n    public boolean tryToFinish() {\r\n\r\n        Date createAt = new Date(System.currentTimeMillis() - checkStatusDuration);\r\n\r\n        QB.X builder = QB.x();\r\n        builder.select(\"id\",\"svcDone\",\"svcList\",\"retryCount\",\"retryMax\",\"tcc\",\"body\");\r\n        builder.from(AckuMessage.class);\r\n        builder.eq(\"status\", MessageStatus.SEND);\r\n        builder.lt(\"createAt\", createAt);\r\n\r\n        Q.X x = builder.build();\r\n\r\n        List<Map<String, Object>> list = this.AckuMessageService.listByX(x);\r\n\r\n        if (list.isEmpty())\r\n            return true;\r\n\r\n        Date date = new Date();\r\n\r\n        for (Map<String, Object> map : list) {\r\n\r\n            List<String> svcList = (List<String>)MapUtils.getObject(map, \"svcList\");\r\n            String tcc = MapUtils.getString(map, \"tcc\");\r\n            Object bodyObj = MapUtils.getObject(map, \"body\");\r\n            GenericObject go = (GenericObject) bodyObj;\r\n\r\n            AckuMessage AckuMessage = new AckuMessage();\r\n            AckuMessage.setId(MapUtils.getString(map, \"id\"));\r\n            AckuMessage.setSvcDone(MapUtils.getString(map, \"svcDone\"));\r\n            AckuMessage.setSvcList(svcList);\r\n            AckuMessage.setBody(go);\r\n            AckuMessage.setTcc(tcc);\r\n            AckuMessage.setRetryCount(MapUtils.getLongValue(map, \"retryCount\"));\r\n            AckuMessage.setRetryMax(MapUtils.getIntValue(map, \"retryMax\"));\r\n\r\n            String svcDone = AckuMessage.getSvcDone();\r\n            if (StringUtil.isNullOrEmpty(svcDone))\r\n                continue;\r\n\r\n            boolean flag = true;\r\n\r\n            for (String svc : svcList) {\r\n                flag &= svcDone.contains(svc);\r\n            }\r\n\r\n\r\n            if (AckuMessage.getTcc().equals(TCCTopic._TCC_TRY.name())) {\r\n                if (!flag) {\r\n                    if (AckuMessage.getRetryCount() >= AckuMessage.getRetryMax()) {\r\n                        cancel(AckuMessage.getId());\r\n                    }\r\n                }\r\n            } else {\r\n                if (flag) {\r\n                    this.AckuMessageService.refresh(\r\n                            QrB.of(AckuMessage.class)\r\n                                    .refresh(\"status\", MessageStatus.OK)\r\n                                    .refresh(\"refreshAt\", date)\r\n                                    .eq(\"id\", AckuMessage.getId()).build()\r\n                    );\r\n\r\n                    try {\r\n                        this.nextBusiness.produce(AckuMessage.getId(),AckuMessageService,nextProducer);\r\n                    }catch (Exception e) {\r\n\r\n                    }\r\n                }\r\n            }\r\n\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n\r\n    @RequestMapping(value = \"/listForRetry\", method = RequestMethod.GET)\r\n    public List<AckuMessage> listForRetry() {\r\n\r\n        long rrd = ackuRetryDuration < 5000 ? 5000 : ackuRetryDuration;\r\n\r\n        long now = System.currentTimeMillis();\r\n        final long sendAt = now - rrd;\r\n\r\n        QB.X builder = QB.x();\r\n        builder.select(\"id\",\"svcList\",\"svcDone\",\"retryCount\",\"retryMax\",\"tcc\",\"topic\",\"body\");\r\n        builder.from(AckuMessage.class);\r\n        builder.eq(\"status\", MessageStatus.SEND);\r\n//        builder.x(\"retryCount < retryMax\"); //需要人工补单\r\n        builder.lt(\"sendAt\", sendAt);\r\n\r\n        List<Map<String, Object>> list = this.AckuMessageService.listByX(builder.build());\r\n\r\n        List<AckuMessage> rmList = new ArrayList<>();\r\n\r\n        if (list.isEmpty())\r\n            return rmList;\r\n\r\n        for (Map<String, Object> map : list) {\r\n\r\n            Object bodyObj = MapUtils.getObject(map, \"body\");\r\n            GenericObject go = (GenericObject) bodyObj;\r\n\r\n            List<String> svcList = (List<String>) MapUtils.getObject(map, \"svcList\");\r\n\r\n            AckuMessage AckuMessage = new AckuMessage();\r\n            AckuMessage.setId(MapUtils.getString(map, \"id\"));\r\n            AckuMessage.setTopic(MapUtils.getString(map, \"topic\"));\r\n            AckuMessage.setSvcList(svcList);\r\n            AckuMessage.setSvcDone(MapUtils.getString(map, \"svcDone\"));\r\n            AckuMessage.setRetryCount(MapUtils.getLongValue(map, \"retryCount\"));\r\n            AckuMessage.setRetryMax(MapUtils.getIntValue(map, \"retryMax\"));\r\n            AckuMessage.setBody(go);\r\n            AckuMessage.setTcc(MapUtils.getString(map, \"tcc\"));\r\n            AckuMessage.setSendAt(sendAt);\r\n\r\n            rmList.add(AckuMessage);\r\n        }\r\n\r\n        return rmList;\r\n    }\r\n\r\n    @Transactional\r\n    @RequestMapping(value = \"/retry\")\r\n    public boolean retry(@RequestBody AckuMessage AckuMessage) {\r\n\r\n        Date date = new Date();\r\n\r\n        if (AckuMessage.getRetryCount() < AckuMessage.getRetryMax()) {\r\n\r\n            QB builder = QB.of(MessageResult.class);\r\n            builder.eq(\"msgId\", AckuMessage.getId());\r\n\r\n            Q q = builder.build();\r\n\r\n            List<MessageResult> list = this.messageResultService.listByCond(q);\r\n\r\n            AckuDto dto = new AckuDto();\r\n            for (MessageResult messageResult : list) {\r\n                if (MessageStatus.BLANK.toString().equals(messageResult.getStatus())) {\r\n                    dto.getResultList().add(messageResult);\r\n                }\r\n            }\r\n\r\n            dto.setMessage(AckuMessage);\r\n\r\n            AckuMessage.setRetryCount(AckuMessage.getRetryCount() + 1);\r\n            AckuMessage.setSendAt(date.getTime());// IMPORTANT\r\n            AckuMessage.setRefreshAt(date);\r\n\r\n            this.AckuMessageService.refresh(\r\n                    QrB.of(AckuMessage.class)\r\n                            .refresh(\"retryCount\", AckuMessage.getRetryCount() + 1)\r\n                            .refresh(\"sendAt\", AckuMessage.getSendAt())\r\n                            .refresh(\"refreshAt\", AckuMessage.getRefreshAt())\r\n                            .eq(\"id\", AckuMessage.getId()).build()\r\n            );\r\n\r\n            /*\r\n             * MQ\r\n             */\r\n            String topic = AckuMessage.getTopic();\r\n            producer.send(topic, JsonX.toJson(dto));\r\n\r\n        } else {\r\n\r\n            if (AckuMessage.getTcc().equals(TCCTopic._TCC_TRY.name())) {\r\n                // TODO: confirm step, exception no rollback\r\n                cancel(AckuMessage.getId());\r\n            } else {\r\n                //进入人工补单审核流程\r\n\r\n                this.AckuMessageService.refresh(\r\n                        QrB.of(AckuMessage.class)\r\n                                .refresh(\"status\", MessageStatus.FAIL)\r\n                                .refresh(\"refreshAt\", date)\r\n                                .eq(\"id\", AckuMessage.getId()).build()\r\n                );\r\n            }\r\n\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n    @RequestMapping(value = \"/clean\", method = RequestMethod.GET)\r\n    public boolean clean() {\r\n\r\n        List<String> cleanStatusList = new ArrayList<>();\r\n        cleanStatusList.add(MessageStatus.OK.toString());\r\n        cleanStatusList.add(MessageStatus.BLANK.toString());\r\n\r\n        QB.X builder = QB.x();\r\n        builder.select(\"id\").from(AckuMessage.class);\r\n        builder.eq(\"underConstruction\", false);\r\n        builder.in(\"status\", cleanStatusList);\r\n\r\n\r\n        List<Map<String, Object>> list = this.AckuMessageService.listByX(builder.build());\r\n\r\n\r\n        for (Map<String, Object> map : list) {\r\n            String id = MapUtils.getString(map, \"id\");\r\n            if (StringUtil.isNullOrEmpty(id))\r\n                continue;\r\n\r\n            this.messageResultService.removeByMessageId(id);\r\n            this.AckuMessageService.remove(id);\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n    @Transactional\r\n    public boolean cancel(String id) {\r\n        AckuMessage AckuMessage = this.AckuMessageService.get(id);\r\n        return this.tccBusiness.cancel(AckuMessage, AckuMessageService, producer);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/controller/TccBusiness.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.controller;\r\n\r\nimport io.xream.acku.TCCTopic;\r\nimport io.xream.acku.api.acku.AckuMessageService;\r\nimport io.xream.acku.bean.constant.MessageStatus;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.produce.Producer;\r\nimport io.xream.internal.util.JsonX;\r\nimport io.xream.sqli.builder.QrB;\r\nimport io.xream.x7.base.GenericObject;\r\nimport org.springframework.stereotype.Component;\r\n\r\nimport java.util.Date;\r\nimport java.util.UUID;\r\n\r\n@Component\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class TccBusiness {\r\n\r\n    public final static String SVC_DONE_PREFIX = \"&\";\r\n\r\n\r\n    public boolean confirm(AckuMessage AckuMessage, AckuMessageService ackuMessageService, Producer producer) {\r\n\r\n        Date date = new Date();\r\n\r\n        boolean flag = ackuMessageService.refresh(\r\n                QrB.of(AckuMessage.class)\r\n                        .refresh(\"status\", MessageStatus.OK)\r\n                        .refresh(\"refreshAt\", date)\r\n                        .refresh(\"tcc\", TCCTopic._TCC_CONFIRM)\r\n                        .eq(\"id\", AckuMessage.getId())\r\n                        .eq(\"tcc\", TCCTopic._TCC_TRY).build()\r\n        ); //STEP 1\r\n\r\n        if (!flag)\r\n            return flag;\r\n\r\n        GenericObject body = AckuMessage.getBody();\r\n        String topic = AckuMessage.getTopic();\r\n        String tracingId = AckuMessage.getId();\r\n        AckuMessage AckuMessageConfirm = new AckuMessage(tracingId,topic,body,AckuMessage.getSvcList());\r\n        AckuMessageConfirm.setRetryMax(3 * 2);\r\n        AckuMessageConfirm.resetTopic(TCCTopic._TCC_CONFIRM);\r\n\r\n        String messageId = UUID.randomUUID().toString();\r\n        messageId = messageId.replace(\"-\",\"\");\r\n\r\n        AckuMessageConfirm.setId(messageId);\r\n        AckuMessageConfirm.setCreateAt(date);\r\n        AckuMessageConfirm.setRefreshAt(date);\r\n        AckuMessageConfirm.setSendAt(date.getTime());\r\n        AckuMessageConfirm.setSvcDone(SVC_DONE_PREFIX);\r\n        AckuMessageConfirm.setStatus(MessageStatus.SEND.toString());//初始化为已发送\r\n        AckuMessageConfirm.setTcc(TCCTopic._TCC_CONFIRM.name());\r\n\r\n        boolean b = ackuMessageService.create(AckuMessageConfirm); //STEP 2\r\n        if (b){\r\n            AckuDto dto = new AckuDto(AckuMessageConfirm);\r\n            b &= producer.send(AckuMessageConfirm.getTopic(), JsonX.toJson(dto)); //STEP 3\r\n        }\r\n\r\n        return b;\r\n    }\r\n\r\n    public boolean cancel(AckuMessage AckuMessage, AckuMessageService ackuMessageService, Producer producer) {\r\n\r\n        Date date = new Date();\r\n\r\n        boolean flag = ackuMessageService.refresh(\r\n                QrB.of(AckuMessage.class)\r\n                        .refresh(\"status\", MessageStatus.FAIL)\r\n                        .refresh(\"refreshAt\", date)\r\n                        .refresh(\"tcc\", TCCTopic._TCC_CANCEL)\r\n                        .eq(\"id\", AckuMessage.getId())\r\n                        .eq(\"svcDone\",AckuMessage.getSvcDone())\r\n                        .ne(\"tcc\", TCCTopic._TCC_CANCEL).build()\r\n        ); //STEP 1\r\n\r\n        if (!flag)\r\n            return flag;\r\n\r\n        GenericObject body = AckuMessage.getBody();\r\n        String topic = AckuMessage.getTopic();\r\n        String tracingId = AckuMessage.getId();\r\n        AckuMessage AckuMessageCancel = new AckuMessage(tracingId,topic,body,AckuMessage.getSvcList());\r\n        AckuMessageCancel.setRetryMax(3 * 2);\r\n        AckuMessageCancel.resetTopic(TCCTopic._TCC_CANCEL);\r\n\r\n        String messageId = UUID.randomUUID().toString();\r\n        messageId = messageId.replace(\"-\",\"\");\r\n\r\n        AckuMessageCancel.setId(messageId);\r\n        AckuMessageCancel.setCreateAt(date);\r\n        AckuMessageCancel.setRefreshAt(date);\r\n        AckuMessageCancel.setSendAt(date.getTime());\r\n        AckuMessageCancel.setSvcDone(SVC_DONE_PREFIX);\r\n        AckuMessageCancel.setStatus(MessageStatus.SEND.toString());//初始化为已发送\r\n        AckuMessageCancel.setTcc(TCCTopic._TCC_CANCEL.name());\r\n\r\n        boolean b = ackuMessageService.create(AckuMessageCancel); //STEP 2\r\n\r\n        if (b){\r\n            AckuDto dto = new AckuDto(AckuMessageCancel);\r\n            b &= producer.send(AckuMessageCancel.getTopic(), JsonX.toJson(dto)); //STEP 3\r\n        }\r\n\r\n        return b;\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/java/io/xream/acku/produce/Producer.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.produce;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface Producer {\r\n\r\n    boolean send(String topic, String message);\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-app/src/main/resources/META-INF/spring.factories",
    "content": "org.springframework.context.ApplicationListener=\\\n io.xream.acku.config.MQConfig"
  },
  {
    "path": "acku-message-center/acku-app/src/main/resources/application.properties",
    "content": "spring.application.name=acku-app\r\nspring.profiles.active=dev\r\nserver.port=7717\r\n\r\naccess.domain=*\r\n\r\nspring.jackson.serialization.write-dates-as-timestamps=true\r\nspring.jackson.time-zone=GMT+8\r\n\r\nspring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver\r\nspring.datasource.url=jdbc:mysql://127.0.0.1:3306/acku_test?&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai\r\nspring.datasource.username=root\r\nspring.datasource.password=123456\r\n\r\n\r\nspring.datasource.default-auto-commit=true\r\nspring.datasource.auto-commit=true\r\nspring.datasource.maximum-pool-size=100\r\nspring.datasource.max-idle=10\r\nspring.datasource.max-wait=10000\r\nspring.datasource.min-idle=5\r\nspring.datasource.initial-size=5\r\nspring.datasource.validation-query=SELECT 1\r\nspring.datasource.test-on-borrow=false\r\nspring.datasource.test-while-idle=true\r\nspring.datasource.time-between-eviction-runs-millis=18800\r\nspring.datasource.minEvictableIdleTimeMillis=300000\r\nspring.datasource.hikari.idleTimeout=30000\r\nspring.datasource.hikari.maximumPoolSize=10\r\n\r\nspring.redis.host=127.0.0.1\r\nspring.redis.port=6379\r\nspring.redis.pool.max-active=64\r\nspring.redis.pool.min-idle=8\r\n\r\nx7.repository.show-sql=true\r\n\r\nhttp.connectTimeout=15000\r\nhttp.socketTimeout=60000\r\nx7.reyc.fallback.remote-exception=RemoteServiceException\r\n\r\nresilience4j.circuitbreaker.configs.default.wait-duration-in-open-state=60000\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-closed-state=100\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-half-open-state=10\r\nresilience4j.circuitbreaker.configs.default.failure-rate-threshold=50\r\nresilience4j.circuitbreaker.configs.default.event-consumer-buffer-size=100\r\n\r\nendpoints.health.mapping.DOWN=OK\r\nendpoints.health.mapping.OUT_OF_SERVICE=OK\r\n\r\n#tracing.zipkin.url=http://127.0.0.1:9411\r\n\r\nlogging.level.io.xream=INFO\r\nloggin.pattern.console=\"%d - %msg%n\"\r\n\r\n\r\nacku.retry.duration=5000\r\n\r\n\r\nspring.kafka.producer.bootstrap-servers=127.0.0.1:9092\r\nspring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.batch-size=65535\r\nspring.kafka.producer.buffer-memory=524288\r\nspring.kafka.producer.acks=all\r\nspring.kafka.producer.retries=3\r\n\r\nnext.kafka.producer.bootstrap-servers=127.0.0.1:9092\r\nnext.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nnext.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nnext.kafka.producer.batch-size=65535\r\nnext.kafka.producer.buffer-memory=524288\r\nnext.kafka.producer.acks=all\r\nnext.kafka.producer.retries=3\r\n\r\n\r\nacku.app=localhost:7717\r\n\r\n\r\n"
  },
  {
    "path": "acku-message-center/acku-app/test/java/io/xream/reliable/AppTest.java",
    "content": "package io.xream.acku;\r\n\r\n\r\nimport io.xream.acku.produce.Producer;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.boot.test.context.SpringBootTest;\r\nimport org.springframework.test.context.junit4.SpringRunner;\r\n\r\nimport javax.annotation.Resource;\r\n\r\n@SpringBootTest\r\n@RunWith(SpringRunner.class)\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class AppTest {\r\n\r\n    @Autowired\r\n    private Producer producer;\r\n\r\n    @Resource(name = \"nextProducer\")\r\n    private Producer nextProducer;\r\n\r\n    @Test\r\n    public void testAll(){\r\n\r\n        System.out.println(this.producer);\r\n        System.out.println(this.nextProducer);\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-dashboard/Dockerfile",
    "content": "FROM java:openjdk-8-jre-alpine\n\nLABEL version=\"0.2.0\"\n\nMAINTAINER Sim <8966188@qq.com>\n\nENV ACTIVE test\nENV JAVA_OPTS -Xms1024m -Xmx1024m -Xmn320m\n\nADD target/acku-dashboard-1.1.0.jar /data/deploy/acku-dashboard.jar\n\n\nCMD [\"mkdir -p /data/logs\"]\nVOLUME /data/logs /data/logs\n\nEXPOSE 80\n\nENTRYPOINT [\"java\",\"-Dspring.profiles.active=${ACTIVE}\",\"-jar\", \"/data/deploy/acku-dashboard.jar\"]"
  },
  {
    "path": "acku-message-center/acku-dashboard/README.md",
    "content": "# acku-dashboard\n\nsupport consistence retry manually, if retryMax > 0\n\ncan import the page into your iframe tag\n\n\n\n"
  },
  {
    "path": "acku-message-center/acku-dashboard/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku-message-center</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-dashboard</artifactId>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>org.springframework</groupId>\r\n            <artifactId>spring-web</artifactId>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n    <build>\r\n        <plugins>\r\n            <plugin>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-maven-plugin</artifactId>\r\n                <version>3.2.2</version>\r\n                <executions>\r\n                    <execution>\r\n\r\n                        <goals>\r\n                            <goal>repackage</goal>\r\n                        </goals>\r\n                    </execution>\r\n\r\n                </executions>\r\n                <configuration>\r\n                    <mainClass>io.xream.acku.App</mainClass>\r\n                </configuration>\r\n            </plugin>\r\n        </plugins>\r\n        <resources>\r\n            <resource>\r\n                <directory>src/main/resources</directory>\r\n            </resource>\r\n        </resources>\r\n    </build>\r\n\r\n</project>"
  },
  {
    "path": "acku-message-center/acku-dashboard/src/main/java/io/xream/acku/App.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku;\r\n\r\nimport io.xream.x7.EnableDateToLongForJackson;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.transaction.annotation.EnableTransactionManagement;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@SpringBootApplication\r\n@EnableTransactionManagement\r\n@EnableDateToLongForJackson\r\npublic class App {\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\t\tSpringApplication.run(App.class);\r\n    }\r\n\r\n}\r\n\r\n\r\n\r\n"
  },
  {
    "path": "acku-message-center/acku-dashboard/src/main/java/io/xream/acku/controller/AuthorizationBusiness.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.controller;\r\n\r\nimport io.xream.acku.remote.AuthorizationServiceRemote;\r\nimport jakarta.annotation.Resource;\r\nimport org.springframework.beans.factory.annotation.Value;\r\nimport org.springframework.stereotype.Component;\r\n\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Component\r\npublic class AuthorizationBusiness {\r\n\r\n    @Value(\"acku.dashboard.authorization.required\")\r\n    private String authorizationRequired;\r\n\r\n    @Value(\"acku.dashboard.authorization.url.redirect-to-sign-in\")\r\n    private String urlRedirectToSignIn = \"NONE\";\r\n\r\n    @Value(\"acku.dashboard.authorization.url.server\")\r\n    private String urlAuthorization = \"NONE\";\r\n\r\n    @Resource\r\n    private AuthorizationServiceRemote authorizationServiceRemote;\r\n\r\n    public boolean requireAuthorization(){\r\n\r\n        return Boolean.parseBoolean(this.authorizationRequired);\r\n    }\r\n\r\n\r\n    public boolean isAccessble(String token, String userId) {\r\n\r\n        if (!requireAuthorization())\r\n            return true;\r\n\r\n        return this.authorizationServiceRemote.verify(token, userId);\r\n    }\r\n\r\n    public String getRedirect(){\r\n        return \"redirect:\"+this.urlRedirectToSignIn;\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-dashboard/src/main/java/io/xream/acku/controller/MessageFailedController.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.controller;\r\n\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.remote.acku.FailedServiceRemote;\r\nimport jakarta.annotation.Resource;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.http.ResponseEntity;\r\nimport org.springframework.web.bind.annotation.PathVariable;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\nimport java.util.List;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@RestController\r\n@RequestMapping(\"/message/failed\")\r\npublic class MessageFailedController {\r\n\r\n    private Logger logger = LoggerFactory.getLogger(MessageFailedController.class);\r\n\r\n    @Resource\r\n    private FailedServiceRemote failedServiceRemote;\r\n\r\n    @Autowired\r\n    private AuthorizationBusiness authorizationBusiness;\r\n\r\n    @RequestMapping(value = \"/find\",method = RequestMethod.GET)\r\n    public ResponseEntity find() {\r\n        return this.find(null,null);\r\n    }\r\n    @RequestMapping(value = \"/retry/all\",method = RequestMethod.GET)\r\n    public ResponseEntity retryAll() {\r\n        return this.retryAll(null,null);\r\n    }\r\n    @RequestMapping(value = \"/retry/{messageId}\",method = RequestMethod.GET)\r\n    public ResponseEntity retry(@PathVariable String messageId) {\r\n        return this.retry(messageId,null,null);\r\n    }\r\n\r\n\r\n    @RequestMapping(value = \"/find/{token}/{userId}\",method = RequestMethod.GET)\r\n    public ResponseEntity find(@PathVariable String token, @PathVariable String userId) {\r\n\r\n        if (! authorizationBusiness.isAccessble(token,userId)) {\r\n            String redirect = this.authorizationBusiness.getRedirect();\r\n            return ResponseEntity.ok(redirect);\r\n        }\r\n\r\n        List<AckuMessage> list = this.failedServiceRemote.findFailed();\r\n\r\n        return ResponseEntity.ok(list);\r\n    }\r\n\r\n\r\n    @RequestMapping(value = \"/retry/all/{token}/{userId}\",method = RequestMethod.GET)\r\n    public ResponseEntity retryAll(@PathVariable String token, @PathVariable String userId) {\r\n\r\n        logger.info(\"retry all failed message\");\r\n\r\n        if (! authorizationBusiness.isAccessble(token,userId)) {\r\n            String redirect = this.authorizationBusiness.getRedirect();\r\n            return ResponseEntity.ok(redirect);\r\n        }\r\n\r\n        this.failedServiceRemote.retryAll();\r\n\r\n        return ResponseEntity.ok(\"all\");\r\n    }\r\n\r\n\r\n    @RequestMapping(value = \"/retry/{messageId}/{token}/{userId}\",method = RequestMethod.GET)\r\n    public ResponseEntity retry(@PathVariable String messageId, @PathVariable String token, @PathVariable String userId) {\r\n\r\n        logger.info(\"retry failed message: \" + messageId);\r\n\r\n        if (! authorizationBusiness.isAccessble(token,userId)) {\r\n            String redirect = this.authorizationBusiness.getRedirect();\r\n            return ResponseEntity.ok(redirect);\r\n        }\r\n\r\n        this.failedServiceRemote.retry(messageId);\r\n\r\n        return ResponseEntity.ok(messageId);\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-dashboard/src/main/java/io/xream/acku/remote/AuthorizationServiceRemote.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.remote;\r\n\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.service.annotation.GetExchange;\r\nimport org.springframework.web.service.annotation.HttpExchange;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@HttpExchange(\"${acku.dashboard.authorization.url.server}\" )\r\npublic interface AuthorizationServiceRemote {\r\n\r\n    @GetExchange(value = \"/{token}/{userId}\")\r\n    boolean verify(String token, String userId);\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-dashboard/src/main/resources/application.properties",
    "content": "spring.application.name=acku-dashboard\r\nspring.profiles.active=dev\r\nserver.port=7737\r\n\r\n\r\naccess.domain=*\r\n\r\nspring.jackson.serialization.write-dates-as-timestamps=true\r\nspring.jackson.time-zone=GMT+8\r\n\r\nspring.datasource.driver-class-name=com.mysql.jdbc.Driver\r\nspring.datasource.url=jdbc:mysql://127.0.0.1:3306/acku_test?&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai\r\nspring.datasource.username=root\r\nspring.datasource.password=123456\r\n\r\n\r\nspring.datasource.default-auto-commit=true\r\nspring.datasource.auto-commit=true\r\nspring.datasource.maximum-pool-size=100\r\nspring.datasource.max-idle=10\r\nspring.datasource.max-wait=10000\r\nspring.datasource.min-idle=5\r\nspring.datasource.initial-size=5\r\nspring.datasource.validation-query=SELECT 1\r\nspring.datasource.test-on-borrow=false\r\nspring.datasource.test-while-idle=true\r\nspring.datasource.time-between-eviction-runs-millis=18800\r\nspring.datasource.minEvictableIdleTimeMillis=300000\r\nspring.datasource.hikari.idleTimeout=30000\r\nspring.datasource.hikari.maximumPoolSize=10\r\n\r\nspring.redis.host=127.0.0.1\r\nspring.redis.port=6379\r\nspring.redis.pool.max-active=64\r\nspring.redis.pool.min-idle=8\r\n\r\nx7.repository.show-sql=true\r\n\r\nhttp.connectTimeout=15000\r\nhttp.socketTimeout=60000\r\nx7.reyc.fallback.remote-exception=RemoteServiceException\r\n\r\nresilience4j.circuitbreaker.configs.default.wait-duration-in-open-state=60000\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-closed-state=100\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-half-open-state=10\r\nresilience4j.circuitbreaker.configs.default.failure-rate-threshold=50\r\nresilience4j.circuitbreaker.configs.default.event-consumer-buffer-size=100\r\n\r\nendpoints.health.mapping.DOWN=OK\r\nendpoints.health.mapping.OUT_OF_SERVICE=OK\r\n\r\n#tracing.zipkin.url=http://127.0.0.1:9411\r\n\r\n\r\nlogging.level.root=INFO\r\nloggin.pattern.console=\"%d - %msg%n\"\r\n\r\n\r\nspring.kafka.producer.bootstrap-servers=127.0.0.1:9092\r\nspring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.batch-size=65535\r\nspring.kafka.producer.buffer-memory=524288\r\nspring.kafka.producer.acks=all\r\nspring.kafka.producer.retries=3\r\n\r\n\r\n\r\nspring.autoconfigure.exclude=org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\\\r\n    org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\\\r\n    org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\\\r\n    org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration\r\n\r\nacku.retry.duration=5000\r\n\r\nacku.app=acku-app:7717\r\n\r\nacku.dashboard.authorization.required=false\r\nacku.dashboard.authorization.url.redirect-to-sign-in=http://127.0.0.1\r\nacku.dashboard.authorization.url.server=http://127.0.0.1"
  },
  {
    "path": "acku-message-center/acku-dashboard/src/main/resources/static/index.html",
    "content": "TEST"
  },
  {
    "path": "acku-message-center/acku-schedule/Dockerfile",
    "content": "FROM java:openjdk-8-jre-alpine\n\nLABEL version=\"0.2.0\"\n\nMAINTAINER Sim<8966188@qq.com>\n\nENV ACTIVE test\nENV JAVA_OPTS -Xms1024m -Xmx1024m -Xmn320m\n\nADD target/acku-schedule-0.2.0.jar /data/deploy/acku-schedule.jar\n\n\nCMD [\"mkdir -p /data/logs\"]\nVOLUME /data/logs /data/logs\n\nEXPOSE 80\n\nENTRYPOINT [\"java\",\"-Dspring.profiles.active=${ACTIVE}\",\"-jar\", \"/data/deploy/acku-schedule.jar\"]"
  },
  {
    "path": "acku-message-center/acku-schedule/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku-message-center</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-schedule</artifactId>\r\n\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>org.springframework</groupId>\r\n            <artifactId>spring-web</artifactId>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n\r\n    <build>\r\n        <plugins>\r\n            <plugin>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-maven-plugin</artifactId>\r\n                <version>3.2.2</version>\r\n                <executions>\r\n                    <execution>\r\n\r\n                        <goals>\r\n                            <goal>repackage</goal>\r\n                        </goals>\r\n                    </execution>\r\n\r\n                </executions>\r\n                <configuration>\r\n                    <mainClass>io.xream.acku.App</mainClass>\r\n                </configuration>\r\n            </plugin>\r\n        </plugins>\r\n        <resources>\r\n            <resource>\r\n                <directory>src/main/resources</directory>\r\n            </resource>\r\n        </resources>\r\n    </build>\r\n\r\n\r\n</project>"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/App.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku;\r\n\r\nimport io.xream.x7.EnableDateToLongForJackson;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.scheduling.annotation.EnableScheduling;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@SpringBootApplication\r\n@EnableDateToLongForJackson\r\n@EnableScheduling\r\npublic class App {\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tSpringApplication.run(App.class);\r\n\t\t\r\n    }\r\n\r\n\r\n}\r\n\r\n\r\n\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/codetemplate/ScheduleTemplate.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.codetemplate;\r\n\r\nimport java.util.concurrent.Callable;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface ScheduleTemplate {\r\n\r\n    boolean schedule(Class scheduleClazz, Callable<Boolean> callable);\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/codetemplate/inner/ScheduleTemplateImpl.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.codetemplate.inner;\r\n\r\n\r\nimport io.xream.acku.codetemplate.ScheduleTemplate;\r\nimport io.xream.internal.util.ExceptionUtil;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\n\r\nimport java.util.Date;\r\nimport java.util.concurrent.Callable;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class ScheduleTemplateImpl implements ScheduleTemplate {\r\n\r\n    public boolean schedule(Class scheduleClazz, Callable<Boolean> callable) {\r\n\r\n        Logger logger = LoggerFactory.getLogger(scheduleClazz);\r\n\r\n        String loggingName = scheduleClazz.getSimpleName();\r\n\r\n        boolean flag = false;\r\n        long startTime = System.currentTimeMillis();\r\n        String taskId = loggingName + \"_\" + startTime;\r\n\r\n        logger.info(\"Executing {}, At: {}, id: {}\", loggingName, new Date(), taskId);\r\n\r\n        try {\r\n            flag = callable.call();\r\n        }catch (Exception e) {\r\n            logger.info(\"Exception Occured: {}\" , ExceptionUtil.getMessage(e));\r\n        }\r\n\r\n        long endTime = System.currentTimeMillis();\r\n\r\n        String result = flag == true?\"OK,\" :  \"FAILED,\";\r\n        logger.info(\"Executing {}, {}, Cost: {}ms id: {}\",\r\n                loggingName, result,\r\n                (endTime - startTime),\r\n                taskId);\r\n\r\n        return flag;\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/config/CodeTemplateConfig.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.config;\r\n\r\nimport io.xream.acku.codetemplate.ScheduleTemplate;\r\nimport io.xream.acku.codetemplate.inner.ScheduleTemplateImpl;\r\nimport org.springframework.context.annotation.Bean;\r\nimport org.springframework.context.annotation.Configuration;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class CodeTemplateConfig {\r\n\r\n    @Bean\r\n    public ScheduleTemplate getScheduleTemplate(){\r\n\r\n        return new ScheduleTemplateImpl();\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/remote/ScheduledAckuServiceRemote.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.remote;\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.service.annotation.GetExchange;\r\nimport org.springframework.web.service.annotation.HttpExchange;\r\nimport org.springframework.web.service.annotation.PostExchange;\r\n\r\nimport java.util.List;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@HttpExchange(\"http://${acku.app}/schedule\" )\r\npublic interface ScheduledAckuServiceRemote {\r\n\r\n\r\n    @PostExchange(value = \"/retry\")\r\n    boolean retry(AckuMessage message);\r\n\r\n    @GetExchange(value = \"/listForRetry\")\r\n    List<AckuMessage> listForRetry();\r\n\r\n    @GetExchange(value = \"/tryToFinish\")\r\n    boolean tryToFinish();\r\n\r\n    @GetExchange(value = \"/tryToProduceNext\")\r\n    boolean tryToProduceNext();\r\n\r\n    @GetExchange(value = \"/clean\")\r\n    boolean clean();\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/schedule/CleanSchedule.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.schedule;\r\n\r\nimport io.xream.acku.codetemplate.ScheduleTemplate;\r\nimport io.xream.acku.remote.ScheduledAckuServiceRemote;\r\nimport jakarta.annotation.Resource;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Configuration;\r\nimport org.springframework.scheduling.annotation.Scheduled;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class CleanSchedule {\r\n\r\n    private final static Logger logger = LoggerFactory.getLogger(CleanSchedule.class);\r\n\r\n    public CleanSchedule(){\r\n        logger.info(\"Clean Schedule Started\");\r\n    }\r\n\r\n    @Resource\r\n    private ScheduledAckuServiceRemote remote;\r\n\r\n    @Autowired\r\n    private ScheduleTemplate scheduleTemplate;\r\n\r\n\r\n    @Scheduled(cron = \"0 0 0/1 * * ?\")\r\n    public void clean(){\r\n\r\n        scheduleTemplate.schedule(CleanSchedule.class, () -> remote.clean());\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/schedule/ReTrySchedule.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.schedule;\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.codetemplate.ScheduleTemplate;\r\nimport io.xream.acku.remote.ScheduledAckuServiceRemote;\r\nimport jakarta.annotation.Resource;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Configuration;\r\nimport org.springframework.scheduling.annotation.Scheduled;\r\n\r\nimport java.util.List;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class ReTrySchedule {\r\n\r\n    private final static Logger logger = LoggerFactory.getLogger(ReTrySchedule.class);\r\n\r\n    public ReTrySchedule(){\r\n        logger.info(\"ReProduce Schedule Started\");\r\n    }\r\n\r\n    @Resource\r\n    private ScheduledAckuServiceRemote remote;\r\n\r\n    @Autowired\r\n    private ScheduleTemplate scheduleTemplate;\r\n\r\n    @Scheduled(cron = \"0/7 * * * * ?\")\r\n    public void reProduce(){\r\n\r\n        scheduleTemplate.schedule(ReTrySchedule.class, () -> {\r\n\r\n            boolean flag = false;\r\n            List<AckuMessage> list = remote.listForRetry();\r\n\r\n            flag = true;\r\n\r\n            for (AckuMessage message : list) {\r\n                flag &= remote.retry(message);\r\n            }\r\n\r\n            return flag;\r\n        });\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/java/io/xream/acku/schedule/TrySchedule.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.schedule;\r\n\r\nimport io.xream.acku.codetemplate.ScheduleTemplate;\r\nimport io.xream.acku.remote.ScheduledAckuServiceRemote;\r\nimport jakarta.annotation.Resource;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Configuration;\r\nimport org.springframework.scheduling.annotation.Scheduled;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class TrySchedule {\r\n\r\n    private final static Logger logger = LoggerFactory.getLogger(TrySchedule.class);\r\n\r\n    public TrySchedule(){\r\n        logger.info(\"CheckStatus Schedule Started\");\r\n    }\r\n\r\n    @Resource\r\n    private ScheduledAckuServiceRemote remote;\r\n\r\n    @Autowired\r\n    private ScheduleTemplate scheduleTemplate;\r\n\r\n    @Scheduled(cron = \"0/2 * * * * ?\")\r\n    public void tryToFinish(){\r\n\r\n        scheduleTemplate.schedule(TrySchedule.class, () -> remote.tryToFinish());\r\n\r\n    }\r\n\r\n\r\n    @Scheduled(cron = \"0/57 * * * * ?\")\r\n    public void tryToProduceNext(){\r\n\r\n        scheduleTemplate.schedule(TrySchedule.class, () -> remote.tryToProduceNext());\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-schedule/src/main/resources/application.properties",
    "content": "spring.application.name=acku-schedule\r\nspring.profiles.active=dev\r\nserver.port=7727\r\n\r\naccess.domain=*\r\n\r\nspring.jackson.serialization.write-dates-as-timestamps=true\r\nspring.jackson.time-zone=GMT+8\r\n\r\nspring.datasource.driver-class-name=com.mysql.jdbc.Driver\r\nspring.datasource.url=jdbc:mysql://127.0.0.1:3306/acku_test?&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai\r\nspring.datasource.username=root\r\nspring.datasource.password=123456\r\n\r\n\r\nspring.datasource.default-auto-commit=true\r\nspring.datasource.auto-commit=true\r\nspring.datasource.maximum-pool-size=100\r\nspring.datasource.max-idle=10\r\nspring.datasource.max-wait=10000\r\nspring.datasource.min-idle=5\r\nspring.datasource.initial-size=5\r\nspring.datasource.validation-query=SELECT 1\r\nspring.datasource.test-on-borrow=false\r\nspring.datasource.test-while-idle=true\r\nspring.datasource.time-between-eviction-runs-millis=18800\r\nspring.datasource.minEvictableIdleTimeMillis=300000\r\nspring.datasource.hikari.idleTimeout=30000\r\nspring.datasource.hikari.maximumPoolSize=10\r\n\r\nspring.redis.host=127.0.0.1\r\nspring.redis.port=6379\r\nspring.redis.pool.max-active=64\r\nspring.redis.pool.min-idle=8\r\n\r\nx7.repository.show-sql=true\r\n\r\nhttp.connectTimeout=15000\r\nhttp.socketTimeout=60000\r\nx7.reyc.fallback.remote-exception=RemoteServiceException\r\n\r\nresilience4j.circuitbreaker.configs.default.wait-duration-in-open-state=60000\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-closed-state=100\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-half-open-state=10\r\nresilience4j.circuitbreaker.configs.default.failure-rate-threshold=50\r\nresilience4j.circuitbreaker.configs.default.event-consumer-buffer-size=100\r\n\r\nendpoints.health.mapping.DOWN=OK\r\nendpoints.health.mapping.OUT_OF_SERVICE=OK\r\n\r\n#tracing.zipkin.url=http://127.0.0.1:9411\r\n\r\nacku.retry.duration=5000\r\n\r\n\r\nspring.kafka.producer.bootstrap-servers=127.0.0.1:9092\r\nspring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.batch-size=65535\r\nspring.kafka.producer.buffer-memory=524288\r\nspring.kafka.producer.acks=all\r\nspring.kafka.producer.retries=3\r\n\r\n\r\nacku.app=acku-app:7717\r\n\r\n\r\nlogging.level.root=INFO\r\nloggin.pattern.console=\"%d - %msg%n\"\r\n\r\n\r\nspring.autoconfigure.exclude=org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\\\r\n    org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\\\r\n    org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\\\r\n    org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration\r\n\r\n\r\n"
  },
  {
    "path": "acku-message-center/acku-service/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku-message-center</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-service</artifactId>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-entity</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-core</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n</project>"
  },
  {
    "path": "acku-message-center/acku-service/src/main/java/io/xream/acku/repository/acku/AckuMessageRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.repository.acku;\r\n\r\n\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport io.xream.sqli.api.RepositoryX;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Repository\r\npublic interface AckuMessageRepository extends BaseRepository<AckuMessage>, RepositoryX {\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-service/src/main/java/io/xream/acku/repository/acku/MessageResultRepository.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.repository.acku;\r\n\r\nimport io.xream.acku.bean.entity.MessageResult;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Repository\r\npublic interface MessageResultRepository extends BaseRepository<MessageResult> {\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-service/src/main/java/io/xream/acku/service/acku/AckuMessageServiceImpl.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.service.acku;\r\n\r\nimport io.xream.acku.api.acku.AckuMessageService;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.repository.acku.AckuMessageRepository;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.Qr;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Service;\r\n\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Service\r\npublic class AckuMessageServiceImpl implements AckuMessageService {\r\n\r\n    @Autowired\r\n    private AckuMessageRepository repository;\r\n    @Override\r\n    public boolean create(AckuMessage message) {\r\n        this.repository.create(message);\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean refresh(Qr<AckuMessage> refreshCondition) {\r\n        return this.repository.refresh(refreshCondition);\r\n    }\r\n\r\n    @Override\r\n    public boolean remove(String id) {\r\n        return this.repository.remove(id);\r\n    }\r\n\r\n    @Override\r\n    public List<AckuMessage> listByCond(Q q) {\r\n        return this.repository.list(q);\r\n    }\r\n\r\n    @Override\r\n    public List<Map<String, Object>> listByX(Q.X x) {\r\n        return this.repository.listX(x);\r\n    }\r\n\r\n    @Override\r\n    public AckuMessage get(String msgId) {\r\n        return this.repository.get(msgId);\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-service/src/main/java/io/xream/acku/service/acku/FailedServiceImpl.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.service.acku;\r\n\r\nimport io.xream.acku.api.acku.FailedService;\r\nimport io.xream.acku.bean.entity.AckuMessage;\r\nimport io.xream.acku.repository.acku.AckuMessageRepository;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.Qr;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Service;\r\n\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Service\r\npublic class FailedServiceImpl implements FailedService {\r\n\r\n    @Autowired\r\n    private AckuMessageRepository ackuMessageRepository;\r\n\r\n    @Override\r\n    public boolean refresh(Qr<AckuMessage> condition) {\r\n        return this.ackuMessageRepository.refresh(condition);\r\n    }\r\n\r\n    @Override\r\n    public boolean refreshUnSafe(Qr<AckuMessage> condition) {\r\n        return this.ackuMessageRepository.refreshUnSafe(condition);\r\n    }\r\n\r\n    @Override\r\n    public List<Map<String, Object>> listByX(Q.X x) {\r\n        return this.ackuMessageRepository.listX(x);\r\n    }\r\n}\r\n"
  },
  {
    "path": "acku-message-center/acku-service/src/main/java/io/xream/acku/service/acku/MessageResultServiceImpl.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.service.acku;\r\n\r\nimport io.xream.acku.api.acku.MessageResultService;\r\nimport io.xream.acku.bean.entity.MessageResult;\r\nimport io.xream.acku.repository.acku.MessageResultRepository;\r\nimport io.xream.sqli.api.NativeRepository;\r\nimport io.xream.sqli.builder.Q;\r\nimport io.xream.sqli.builder.Qr;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Service;\r\n\r\nimport java.util.List;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Service\r\npublic class MessageResultServiceImpl implements MessageResultService {\r\n\r\n    @Autowired\r\n    private MessageResultRepository repository;\r\n    @Autowired\r\n    private NativeRepository nativeRepository;\r\n\r\n    public boolean create(MessageResult result) {\r\n        this.repository.create(result);\r\n        return true;\r\n    }\r\n\r\n    public boolean refresh(Qr<MessageResult> condition) {\r\n        return this.repository.refresh(condition);\r\n    }\r\n\r\n    public boolean remove(String id) {\r\n        return this.repository.remove(id);\r\n    }\r\n\r\n    @Override\r\n    public boolean removeByMessageId(String id) {\r\n        String sql = \"delete from messageResult where msgId = ?\";\r\n        return nativeRepository.execute(sql ,id);\r\n    }\r\n\r\n    @Override\r\n    public List<MessageResult> listByCond(Q q) {\r\n        return this.repository.list(q);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "acku-message-center/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n\r\n    <groupId>io.xream.acku</groupId>\r\n    <version>0.2.0</version>\r\n    <modelVersion>4.0.0</modelVersion>\r\n    <artifactId>acku-message-center</artifactId>\r\n    <packaging>pom</packaging>\r\n\r\n    <properties>\r\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r\n        <maven.compiler.source>17</maven.compiler.source>\r\n        <maven.compiler.target>17</maven.compiler.target>\r\n        <maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>\r\n        <maven.test.skip>true</maven.test.skip>\r\n        <fastjson.version>1.2.79</fastjson.version>\r\n        <mysql.version>8.0.17</mysql.version>\r\n        <acku.version>0.2.0</acku.version>\r\n    </properties>\r\n\r\n    <modules>\r\n        <module>acku-service</module>\r\n        <module>acku-app</module>\r\n        <module>acku-schedule</module>\r\n        <module>acku-dashboard</module>\r\n    </modules>\r\n\r\n    <dependencyManagement>\r\n        <dependencies>\r\n            <dependency>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-dependencies</artifactId>\r\n                <version>3.2.2</version>\r\n                <type>pom</type>\r\n                <scope>import</scope>\r\n            </dependency>\r\n        </dependencies>\r\n    </dependencyManagement>\r\n\r\n    <dependencies>\r\n\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-entity</artifactId>\r\n            <version>${acku.version}</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-core</artifactId>\r\n            <version>${acku.version}</version>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-web</artifactId>\r\n            <exclusions>\r\n                <exclusion>\r\n                    <groupId>org.springframework.boot</groupId>\r\n                    <artifactId>spring-boot-starter-tomcat</artifactId>\r\n                </exclusion>\r\n            </exclusions>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-undertow</artifactId>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-logging</artifactId>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-jdbc</artifactId>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>mysql</groupId>\r\n            <artifactId>mysql-connector-java</artifactId>\r\n            <version>${mysql.version}</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>com.alibaba</groupId>\r\n            <artifactId>fastjson</artifactId>\r\n            <version>${fastjson.version}</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>org.springframework.kafka</groupId>\r\n            <artifactId>spring-kafka</artifactId>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n</project>"
  },
  {
    "path": "acku-spring-boot-starter/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>acku-spring-boot-starter</artifactId>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-api</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-entity</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-core</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n\r\n</project>"
  },
  {
    "path": "acku-spring-boot-starter/src/main/java/io/xream/acku/AckuStarter.java",
    "content": "package io.xream.acku;\r\n\r\n\r\nimport org.springframework.context.annotation.Configuration;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class AckuStarter {\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "acku-spring-boot-starter/src/main/java/io/xream/acku/api/EnableAckuManagement.java",
    "content": "/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements.  See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the \"License\"); you may not use this file except in compliance with\r\n * the License.  You may obtain a copy of the License at\r\n *\r\n *     http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage io.xream.acku.api;\r\n\r\n\r\nimport io.xream.acku.interner.AckuOnConsumedAspect;\r\nimport io.xream.acku.interner.AckuProducerAspect;\r\nimport org.springframework.context.annotation.Import;\r\n\r\nimport java.lang.annotation.*;\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Retention(RetentionPolicy.RUNTIME)\r\n@Target(ElementType.TYPE)\r\n@Documented\r\n@Import({AckuProducerAspect.class, AckuOnConsumedAspect.class})\r\npublic @interface EnableAckuManagement {\r\n\r\n}\r\n"
  },
  {
    "path": "acku-spring-boot-starter/src/main/resources/META-INF/spring.factories",
    "content": "org.springframework.boot.autoconfigure.EnableAutoConfiguration=\\\n io.xream.acku.AckuStarter,\\\n io.xream.acku.backend.AckuBackendImpl\n\n"
  },
  {
    "path": "debug",
    "content": "[master 776ee82] info-\n 13 files changed, 115 insertions(+), 113 deletions(-)\n"
  },
  {
    "path": "demo/demo-listener/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>demo-listener</artifactId>\r\n    <properties>\r\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r\n        <maven.compiler.source>1.8</maven.compiler.source>\r\n        <maven.compiler.target>1.8</maven.compiler.target>\r\n        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>\r\n        <maven.test.skip>true</maven.test.skip>\r\n        <fastjson.version>1.2.79</fastjson.version>\r\n        <mysql.version>8.0.17</mysql.version>\r\n    </properties>\r\n\r\n    <dependencyManagement>\r\n        <dependencies>\r\n            <dependency>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-dependencies</artifactId>\r\n                <version>2.6.13</version>\r\n                <type>pom</type>\r\n                <scope>import</scope>\r\n            </dependency>\r\n        </dependencies>\r\n    </dependencyManagement>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-web</artifactId>\r\n            <exclusions>\r\n                <exclusion>\r\n                    <groupId>org.springframework.boot</groupId>\r\n                    <artifactId>spring-boot-starter-tomcat</artifactId>\r\n                </exclusion>\r\n            </exclusions>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-undertow</artifactId>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-logging</artifactId>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-jdbc</artifactId>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-spring-boot-starter</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>mysql</groupId>\r\n            <artifactId>mysql-connector-java</artifactId>\r\n            <version>${mysql.version}</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>com.alibaba</groupId>\r\n            <artifactId>fastjson</artifactId>\r\n            <version>${fastjson.version}</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>org.springframework.kafka</groupId>\r\n            <artifactId>spring-kafka</artifactId>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n    <build>\r\n        <plugins>\r\n            <plugin>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-maven-plugin</artifactId>\r\n                <executions>\r\n                    <execution>\r\n                        <goals>\r\n                            <goal>repackage</goal>\r\n                        </goals>\r\n                    </execution>\r\n                </executions>\r\n                <configuration>\r\n                    <mainClass>io.xream.acku.App</mainClass>\r\n                </configuration>\r\n            </plugin>\r\n        </plugins>\r\n        <resources>\r\n            <resource>\r\n                <directory>src/main/resources</directory>\r\n            </resource>\r\n        </resources>\r\n    </build>\r\n\r\n</project>"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/App.java",
    "content": "package io.xream.acku;\r\n\r\nimport io.xream.acku.api.EnableAckuManagement;\r\nimport io.xream.x7.EnableCorsConfig;\r\nimport io.xream.x7.EnableDateToLongForJackson;\r\nimport io.xream.rey.EnableReyClient;\r\nimport io.xream.x7.EnableX7Repository;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.transaction.annotation.EnableTransactionManagement;\r\n\r\n\r\n@SpringBootApplication\r\n@EnableTransactionManagement\r\n@EnableAckuManagement\r\n@EnableX7Repository(baseTypeSupported = true)\r\n@EnableDateToLongForJackson\r\n@EnableReyClient\r\n@EnableCorsConfig\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class App {\r\n\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tSpringApplication.run(App.class);\r\n\t\t\r\n    }\r\n\r\n\r\n}\r\n\r\n\r\n\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/bean/Cat.java",
    "content": "package io.xream.acku.bean;\r\n\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class Cat {\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String name;\r\n    private String desc;\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    public String getDesc() {\r\n        return desc;\r\n    }\r\n\r\n    public void setDesc(String desc) {\r\n        this.desc = desc;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"Cat{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", name='\" + name + '\\'' +\r\n                \", desc='\" + desc + '\\'' +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/bean/CatOrder.java",
    "content": "package io.xream.acku.bean;\r\n\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class CatOrder {\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String status;\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getStatus() {\r\n        return status;\r\n    }\r\n\r\n    public void setStatus(String status) {\r\n        this.status = status;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"CatOrder{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", status='\" + status + '\\'' +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/bean/CatSettle.java",
    "content": "package io.xream.acku.bean;\r\n\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class CatSettle {\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String name;\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"CatSettle{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", name='\" + name + '\\'' +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/bean/CatStatement.java",
    "content": "package io.xream.acku.bean;\r\n\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class CatStatement {\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String test;\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getTest() {\r\n        return test;\r\n    }\r\n\r\n    public void setTest(String test) {\r\n        this.test = test;\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/config/AckuConfig.java",
    "content": "package io.xream.acku.config;\r\n\r\nimport io.xream.internal.util.JsonX;\r\nimport io.xream.acku.api.acku.DtoConverter;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport org.apache.kafka.clients.consumer.ConsumerRecord;\r\nimport org.springframework.context.annotation.Bean;\r\nimport org.springframework.context.annotation.Configuration;\r\n\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class AckuConfig {\r\n\r\n\r\n    @Bean\r\n    public DtoConverter dtoConverter() {\r\n\r\n        return message -> {\r\n\r\n            String body = ((ConsumerRecord<String, String>) message).value(); //KAFKA\r\n            AckuDto dto = JsonX.toObject(body, AckuDto.class);\r\n\r\n            return dto;\r\n        };\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/controller/SettleController.java",
    "content": "package io.xream.acku.controller;\r\n\r\nimport io.xream.acku.bean.CatSettle;\r\nimport io.xream.acku.repository.CatSettleRepository;\r\nimport io.xream.sqli.builder.RefreshBuilder;\r\nimport io.xream.x7.base.web.ViewEntity;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\n@RestController\r\n@RequestMapping(\"/settle\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class SettleController {\r\n\r\n    @Autowired\r\n    private CatSettleRepository repository;\r\n\r\n    @RequestMapping(\"/create\")\r\n    public ViewEntity create(@RequestBody CatSettle catSettle) {\r\n        this.repository.create(catSettle);\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n\r\n    @RequestMapping(\"/confirm\")\r\n    public ViewEntity confirm(CatSettle catSettle) {\r\n\r\n        repository.refresh(\r\n                RefreshBuilder.builder()\r\n                        .refresh(\"name\",catSettle.getName())\r\n                        .eq(\"id\",catSettle.getId()).build()\r\n        );\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n\r\n    @RequestMapping(\"/cancel\")\r\n    public ViewEntity cancel(CatSettle catSettle) {\r\n\r\n        repository.refresh(\r\n                RefreshBuilder.builder()\r\n                        .refresh(\"name\",catSettle.getName())\r\n                        .eq(\"id\",catSettle.getId()).build()\r\n        );\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/controller/StatementController.java",
    "content": "package io.xream.acku.controller;\r\n\r\n\r\nimport io.xream.acku.bean.CatStatement;\r\nimport io.xream.acku.repository.CatStatementRepository;\r\nimport io.xream.x7.base.web.ViewEntity;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\n@RestController\r\n@RequestMapping(\"/statement\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class StatementController {\r\n\r\n    @Autowired\r\n    private CatStatementRepository catStatementRepository;\r\n\r\n    @RequestMapping(\"/create\")\r\n    public ViewEntity create(@RequestBody CatStatement catStatement) {\r\n\r\n        this.catStatementRepository.create(catStatement);\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/listener/SettleListenerOfPayment.java",
    "content": "package io.xream.acku.listener;\r\n\r\nimport io.xream.acku.api.AckuOnConsumed;\r\nimport io.xream.acku.api.acku.DtoConverter;\r\nimport io.xream.acku.bean.CatSettle;\r\nimport io.xream.acku.bean.CatStatement;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.controller.SettleController;\r\nimport org.apache.kafka.clients.consumer.ConsumerRecord;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Configuration;\r\nimport org.springframework.kafka.annotation.KafkaListener;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class SettleListenerOfPayment {\r\n\r\n    @Autowired\r\n    private SettleController settleController;\r\n    @Autowired\r\n    private DtoConverter dtoConverter;\r\n\r\n    @AckuOnConsumed(svc = \"cat-settle\", nextTopic = \"CAT_SETTLE_CREATED\", nextRetryMax = 2, nextSvcs = {\"cat-statement\"})\r\n    @KafkaListener(topics = \"CAT_PAID\")\r\n    public CatStatement onCatPaid(ConsumerRecord<String, String> record) {\r\n\r\n        AckuDto dto = dtoConverter.convertOnConsumed(record);\r\n        //--------------\r\n\r\n        CatSettle catSettle = new CatSettle();\r\n        catSettle.setId(\"CAT_SETTLE_TEST\");\r\n        this.settleController.create(catSettle);\r\n\r\n        CatStatement catStatement = new CatStatement();\r\n        catStatement.setId(\"TEST_STATEMENT\");\r\n        catStatement.setTest(\"CAT_SETTLE_CREATED\");\r\n\r\n        return catStatement;\r\n    }\r\n\r\n    @AckuOnConsumed(svc = \"cat-settle\",nextTopic = \"CAT_SETTLE_CREATED\", nextRetryMax = 2, nextSvcs = {\"cat-statement\"})\r\n    @KafkaListener(topics = \"CAT_PAID_TCC_TRY\")\r\n    public CatStatement onCatPaid_TCC_TRY(ConsumerRecord<String, String> record) {\r\n\r\n        AckuDto dto = dtoConverter.convertOnConsumed(record);\r\n        //--------------\r\n\r\n        CatSettle catSettle = new CatSettle();\r\n        catSettle.setId(\"CAT_SETTLE_TEST\");\r\n        catSettle.setName(\"TRY\");\r\n\r\n        settleController.create(catSettle);\r\n\r\n        CatStatement catStatement = new CatStatement();\r\n        catStatement.setId(\"TEST_STATEMENT\");\r\n        catStatement.setTest(\"CAT_SETTLE_CREATED\");\r\n\r\n        return catStatement;\r\n\r\n    }\r\n\r\n    @AckuOnConsumed(svc = \"cat-settle\")\r\n    @KafkaListener(topics = \"CAT_PAID_TCC_CONFIRM\")\r\n    public void onCatPaid_TCC_CONFIRM(ConsumerRecord<String, String> record) {\r\n\r\n        AckuDto dto = dtoConverter.convertOnConsumed(record);\r\n        //--------------\r\n\r\n        CatSettle catsettle = new CatSettle();\r\n        catsettle.setId(\"CAT_SETTLE_TEST\");\r\n        catsettle.setName(\"CONFIRM\");\r\n\r\n        settleController.confirm(catsettle);\r\n\r\n    }\r\n\r\n    @AckuOnConsumed(svc = \"cat-settle\")\r\n    @KafkaListener(topics = \"CAT_PAID_TCC_CANCEL\")\r\n    public void onCatPaid_TCC_CANCEL(ConsumerRecord<String, String> record) {\r\n\r\n        AckuDto dto = dtoConverter.convertOnConsumed(record);\r\n        //--------------\r\n\r\n        CatSettle catsettle = new CatSettle();\r\n        catsettle.setId(\"CAT_SETTLE_TEST\");\r\n        catsettle.setName(\"CANCEL\");\r\n\r\n        settleController.cancel(catsettle);\r\n\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/listener/StatementListenerOfSettle.java",
    "content": "package io.xream.acku.listener;\r\n\r\n\r\nimport io.xream.acku.api.AckuOnConsumed;\r\nimport io.xream.acku.api.acku.DtoConverter;\r\nimport io.xream.acku.bean.CatStatement;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.controller.StatementController;\r\nimport io.xream.x7.base.GenericObject;\r\nimport org.apache.kafka.clients.consumer.ConsumerRecord;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Configuration;\r\nimport org.springframework.kafka.annotation.KafkaListener;\r\n\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class StatementListenerOfSettle {\r\n\r\n    private static final Logger logger = LoggerFactory.getLogger(StatementListenerOfSettle.class);\r\n\r\n    @Autowired\r\n    private StatementController statementController;\r\n    @Autowired\r\n    private DtoConverter dtoConverter;\r\n\r\n    @AckuOnConsumed(svc = \"cat-statement\")\r\n    @KafkaListener(topics = \"CAT_SETTLE_CREATED\")\r\n    public void onSettleCreated(ConsumerRecord<String, String> record) {\r\n\r\n        AckuDto dto = dtoConverter.convertOnConsumed(record);\r\n\r\n        GenericObject<CatStatement> go =  dto.getMessage().getBody();\r\n        CatStatement catStatement = go.get();\r\n\r\n        this.statementController.create(catStatement);\r\n\r\n        logger.info(\"------------------------------------>>>>>>>>>>>>>>>>>>>>>>\");\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/repository/CatOrderRepository.java",
    "content": "package io.xream.acku.repository;\r\n\r\nimport io.xream.acku.bean.CatOrder;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n@Repository\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface CatOrderRepository extends BaseRepository<CatOrder> {\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/repository/CatRepository.java",
    "content": "package io.xream.acku.repository;\r\n\r\nimport io.xream.acku.bean.Cat;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n@Repository\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface CatRepository extends BaseRepository<Cat> {\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/repository/CatSettleRepository.java",
    "content": "package io.xream.acku.repository;\r\n\r\nimport io.xream.acku.bean.CatSettle;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n@Repository\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface CatSettleRepository extends BaseRepository<CatSettle> {\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/java/io/xream/acku/repository/CatStatementRepository.java",
    "content": "package io.xream.acku.repository;\r\n\r\nimport io.xream.acku.bean.CatStatement;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n@Repository\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface CatStatementRepository extends BaseRepository<CatStatement> {\r\n}\r\n"
  },
  {
    "path": "demo/demo-listener/src/main/resources/application.properties",
    "content": "spring.application.name=acku-demo\r\nspring.profiles.active=dev\r\nserver.port=7757\r\n\r\n\r\naccess.domain=*\r\n\r\nspring.jackson.serialization.write-dates-as-timestamps=true\r\nspring.jackson.time-zone=GMT+8\r\n\r\nspring.datasource.driver-class-name=com.mysql.jdbc.Driver\r\nspring.datasource.url=jdbc:mysql://127.0.0.1:3306/acku_test?&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai\r\nspring.datasource.username=root\r\nspring.datasource.password=123456\r\n\r\n\r\nspring.datasource.default-auto-commit=true\r\nspring.datasource.auto-commit=true\r\nspring.datasource.maximum-pool-size=100\r\nspring.datasource.max-idle=10\r\nspring.datasource.max-wait=10000\r\nspring.datasource.min-idle=5\r\nspring.datasource.initial-size=5\r\nspring.datasource.validation-query=SELECT 1\r\nspring.datasource.test-on-borrow=false\r\nspring.datasource.test-while-idle=true\r\nspring.datasource.time-between-eviction-runs-millis=18800\r\nspring.datasource.minEvictableIdleTimeMillis=300000\r\nspring.datasource.hikari.idleTimeout=30000\r\nspring.datasource.hikari.maximumPoolSize=10\r\n\r\nspring.redis.host=127.0.0.1\r\nspring.redis.port=6379\r\nspring.redis.pool.max-active=64\r\nspring.redis.pool.min-idle=8\r\n\r\n\r\nhttp.connectTimeout=15000\r\nhttp.socketTimeout=60000\r\n\r\nresilience4j.circuitbreaker.configs.default.wait-duration-in-open-state=60000\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-closed-state=100\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-half-open-state=10\r\nresilience4j.circuitbreaker.configs.default.failure-rate-threshold=50\r\nresilience4j.circuitbreaker.configs.default.event-consumer-buffer-size=100\r\n\r\n\r\nendpoints.health.mapping.DOWN=OK\r\nendpoints.health.mapping.OUT_OF_SERVICE=OK\r\n\r\n#tracing.zipkin.url=http://127.0.0.1:9411\r\n\r\n\r\nlogging.level.root=INFO\r\nloggin.pattern.console=\"%d - %msg%n\"\r\n\r\n\r\nacku.retry.duration=5000\r\n\r\n\r\nspring.kafka.producer.bootstrap-servers=127.0.0.1:9092\r\nspring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.batch-size=65535\r\nspring.kafka.producer.buffer-memory=524288\r\nspring.kafka.producer.acks=1\r\nspring.kafka.producer.retries=3\r\n\r\n\r\n\r\nspring.kafka.listener.missing-topics-fatal=false\r\nspring.kafka.consumer.bootstrap-servers=127.0.0.1:9092\r\nspring.kafka.consumer.group-id=acku-test-settle\r\nspring.kafka.consumer.auto-offset-reset=earliest\r\nspring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer\r\nspring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer\r\nspring.kafka.consumer.max-poll-records=30\r\nspring.kafka.properties.max.poll.interval.ms=400000\r\nspring.kafka.consumer.enable-auto-commit=true\r\nspring.kafka.listener.ack-mode=record\r\n\r\n#spring.kafka.consumer.enable-auto-commit=false\r\n#spring.kafka.listener.ack-mode=manual_immediate\r\n\r\nacku.app=acku-app:7717\r\nacku.demo=acku-demo:7747\r\n"
  },
  {
    "path": "demo/demo-producer-listener/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <parent>\r\n        <artifactId>acku</artifactId>\r\n        <groupId>io.xream.acku</groupId>\r\n        <version>0.2.0</version>\r\n    </parent>\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n    <artifactId>demo-producer-listener</artifactId>\r\n\r\n    <properties>\r\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r\n        <maven.compiler.source>1.8</maven.compiler.source>\r\n        <maven.compiler.target>1.8</maven.compiler.target>\r\n        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>\r\n        <maven.test.skip>true</maven.test.skip>\r\n        <fastjson.version>1.2.79</fastjson.version>\r\n        <mysql.version>8.0.17</mysql.version>\r\n    </properties>\r\n\r\n    <dependencyManagement>\r\n        <dependencies>\r\n            <dependency>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-dependencies</artifactId>\r\n                <version>2.6.13</version>\r\n                <type>pom</type>\r\n                <scope>import</scope>\r\n            </dependency>\r\n        </dependencies>\r\n    </dependencyManagement>\r\n\r\n    <dependencies>\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-web</artifactId>\r\n            <exclusions>\r\n                <exclusion>\r\n                    <groupId>org.springframework.boot</groupId>\r\n                    <artifactId>spring-boot-starter-tomcat</artifactId>\r\n                </exclusion>\r\n            </exclusions>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-undertow</artifactId>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-logging</artifactId>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>org.springframework.boot</groupId>\r\n            <artifactId>spring-boot-starter-jdbc</artifactId>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>io.xream.acku</groupId>\r\n            <artifactId>acku-spring-boot-starter</artifactId>\r\n            <version>0.2.0</version>\r\n        </dependency>\r\n\r\n        <dependency>\r\n            <groupId>mysql</groupId>\r\n            <artifactId>mysql-connector-java</artifactId>\r\n            <version>${mysql.version}</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>com.alibaba</groupId>\r\n            <artifactId>fastjson</artifactId>\r\n            <version>${fastjson.version}</version>\r\n        </dependency>\r\n        <dependency>\r\n            <groupId>org.springframework.kafka</groupId>\r\n            <artifactId>spring-kafka</artifactId>\r\n        </dependency>\r\n    </dependencies>\r\n\r\n    <build>\r\n        <plugins>\r\n            <plugin>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-maven-plugin</artifactId>\r\n                <executions>\r\n                    <execution>\r\n                        <goals>\r\n                            <goal>repackage</goal>\r\n                        </goals>\r\n                    </execution>\r\n                </executions>\r\n                <configuration>\r\n                    <mainClass>io.xream.acku.App</mainClass>\r\n                </configuration>\r\n            </plugin>\r\n        </plugins>\r\n        <resources>\r\n            <resource>\r\n                <directory>src/main/resources</directory>\r\n            </resource>\r\n        </resources>\r\n    </build>\r\n\r\n</project>"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/App.java",
    "content": "package io.xream.acku;\r\n\r\nimport io.xream.acku.api.EnableAckuManagement;\r\nimport io.xream.x7.EnableCorsConfig;\r\nimport io.xream.x7.EnableDateToLongForJackson;\r\nimport io.xream.rey.EnableReyClient;\r\nimport io.xream.x7.EnableX7Repository;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.transaction.annotation.EnableTransactionManagement;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@SpringBootApplication\r\n@EnableTransactionManagement\r\n@EnableAckuManagement\r\n@EnableX7Repository(baseTypeSupported = true)\r\n@EnableDateToLongForJackson\r\n@EnableReyClient\r\n@EnableCorsConfig\r\npublic class  App {\r\n\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tSpringApplication.run(App.class);\r\n\t\t\r\n    }\r\n\r\n\r\n}\r\n\r\n\r\n\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/AppTest.java",
    "content": "package io.xream.acku;\r\n\r\nimport io.xream.acku.bean.Cat;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.boot.test.context.SpringBootTest;\r\nimport org.springframework.test.context.junit4.SpringRunner;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@SpringBootTest\r\n@RunWith(SpringRunner.class)\r\npublic class AppTest {\r\n\r\n\r\n    private static Logger logger = LoggerFactory.getLogger(AppTest.class);\r\n\r\n    @Autowired\r\n    private PaymentServiceRemote paymentServiceRemote;\r\n\r\n    @Test\r\n    public void test(){\r\n\r\n        Cat cat = new Cat();\r\n        cat.setId(\"CAT_TEST_SSSSS\");\r\n        cat.setName(\"ddse\");\r\n        cat.setDesc(\"RWER\");\r\n\r\n        this.paymentServiceRemote.pay(cat);\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/PaymentServiceRemote.java",
    "content": "package io.xream.acku;\r\n\r\nimport io.xream.acku.bean.Cat;\r\nimport io.xream.rey.annotation.ReyClient;\r\nimport io.xream.x7.base.web.ViewEntity;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\n\r\n@ReyClient(value = \"${acku.demo}/payment\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface PaymentServiceRemote {\r\n\r\n    @RequestMapping(\"/pay\")\r\n    ViewEntity pay(Cat cat);\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/bean/Cat.java",
    "content": "package io.xream.acku.bean;\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class Cat {\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String name;\r\n    private String desc;\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    public String getDesc() {\r\n        return desc;\r\n    }\r\n\r\n    public void setDesc(String desc) {\r\n        this.desc = desc;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"Cat{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", name='\" + name + '\\'' +\r\n                \", desc='\" + desc + '\\'' +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/bean/CatOrder.java",
    "content": "package io.xream.acku.bean;\r\n\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class CatOrder {\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String status;\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getStatus() {\r\n        return status;\r\n    }\r\n\r\n    public void setStatus(String status) {\r\n        this.status = status;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"CatOrder{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", status='\" + status + '\\'' +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/bean/CatSettle.java",
    "content": "package io.xream.acku.bean;\r\n\r\n\r\nimport io.xream.sqli.annotation.X;\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class CatSettle {\r\n\r\n    @X.Key\r\n    private String id;\r\n    private String name;\r\n\r\n    public String getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(String id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public String getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return \"CatSettle{\" +\r\n                \"id='\" + id + '\\'' +\r\n                \", name='\" + name + '\\'' +\r\n                '}';\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/config/AckuConfig.java",
    "content": "package io.xream.acku.config;\r\n\r\nimport io.xream.internal.util.JsonX;\r\nimport io.xream.acku.api.acku.DtoConverter;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport org.apache.kafka.clients.consumer.ConsumerRecord;\r\nimport org.springframework.context.annotation.Bean;\r\nimport org.springframework.context.annotation.Configuration;\r\n\r\n@Configuration\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class AckuConfig {\r\n\r\n\r\n    @Bean\r\n    public DtoConverter dtoConverter() {\r\n\r\n        return message -> {\r\n\r\n            String body = ((ConsumerRecord<String, String>) message).value(); //KAFKA\r\n            AckuDto dto = JsonX.toObject(body, AckuDto.class);\r\n\r\n            return dto;\r\n        };\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/controller/OrderController.java",
    "content": "package io.xream.acku.controller;\r\n\r\n\r\nimport io.xream.acku.bean.CatOrder;\r\nimport io.xream.acku.repository.CatOrderRepository;\r\nimport io.xream.sqli.builder.RefreshBuilder;\r\nimport io.xream.x7.base.web.ViewEntity;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.transaction.annotation.Transactional;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\n@Transactional\r\n@RestController\r\n@RequestMapping(\"/order\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class OrderController {\r\n\r\n    @Autowired\r\n    private CatOrderRepository repository;\r\n\r\n    @RequestMapping(\"/create\")\r\n    public ViewEntity create(@RequestBody CatOrder order) {\r\n\r\n        repository.create(order);\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n\r\n    @RequestMapping(\"/confirm\")\r\n    public ViewEntity confirm(CatOrder catOrder) {\r\n\r\n        repository.refresh(\r\n                RefreshBuilder.builder()\r\n                        .refresh(\"status\",catOrder.getStatus())\r\n                        .eq(\"id\",catOrder.getId()).build()\r\n\r\n        );\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n\r\n    @RequestMapping(\"/cancel\")\r\n    public ViewEntity cancel(CatOrder catOrder) {\r\n\r\n        repository.refresh(RefreshBuilder.builder()\r\n                .refresh(\"status\",catOrder.getStatus())\r\n                .eq(\"id\",catOrder.getId()).build()\r\n        );\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/controller/PaymentController.java",
    "content": "package io.xream.acku.controller;\r\n\r\n\r\nimport io.xream.acku.api.AckuProducer;\r\nimport io.xream.acku.bean.Cat;\r\nimport io.xream.acku.repository.CatRepository;\r\nimport io.xream.x7.base.web.ViewEntity;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.transaction.annotation.Transactional;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\n@Transactional\r\n@RestController\r\n@RequestMapping(\"/payment\")\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic class PaymentController  {\r\n\r\n    @Autowired\r\n    private CatRepository repository;\r\n\r\n    @AckuProducer(useTcc=true,topic = \"CAT_PAID\",  svcs = {\"cat-order\",\"cat-settle\"})\r\n    @RequestMapping(\"/pay\")\r\n    public ViewEntity pay(@RequestBody Cat cat) {\r\n\r\n        repository.create(cat);\r\n\r\n        return ViewEntity.ok();\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/listener/OrderListenerOfPayment.java",
    "content": "package io.xream.acku.listener;\r\n\r\nimport io.xream.internal.util.JsonX;\r\nimport io.xream.acku.api.AckuOnConsumed;\r\nimport io.xream.acku.api.acku.DtoConverter;\r\nimport io.xream.acku.bean.CatOrder;\r\nimport io.xream.acku.bean.dto.AckuDto;\r\nimport io.xream.acku.controller.OrderController;\r\nimport org.apache.kafka.clients.consumer.ConsumerRecord;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.context.annotation.Configuration;\r\nimport org.springframework.kafka.annotation.KafkaListener;\r\n\r\n\r\n/**\r\n * @author Sim\r\n */\r\n@Configuration\r\npublic class OrderListenerOfPayment {\r\n\r\n    @Autowired\r\n    private OrderController orderController;\r\n\r\n    @Autowired\r\n    private DtoConverter dtoConverter;\r\n\r\n    @AckuOnConsumed(svc = \"cat-order\")\r\n    @KafkaListener(topics = \"CAT_PAID\")\r\n    public void onCatPaid(ConsumerRecord<String, String> record) {\r\n\r\n        String json = record.value();\r\n        AckuDto dto = JsonX.toObject(json,AckuDto.class);\r\n        //--------------\r\n\r\n        CatOrder catOrder = new CatOrder();\r\n        catOrder.setId(\"CAT_ORDER_TEST\");\r\n\r\n        orderController.create(catOrder);\r\n\r\n    }\r\n\r\n    @AckuOnConsumed(svc = \"cat-order\")\r\n    @KafkaListener(topics = \"CAT_PAID_TCC_TRY\")\r\n    public void onCatPaid_TCC_TRY(ConsumerRecord<String, String> record) {\r\n\r\n        String json = record.value();\r\n        AckuDto dto = JsonX.toObject(json,AckuDto.class);\r\n        //--------------\r\n\r\n        CatOrder catOrder = new CatOrder();\r\n        catOrder.setId(\"CAT_ORDER_TEST\");\r\n        catOrder.setStatus(\"TRY\");\r\n\r\n        orderController.create(catOrder);\r\n\r\n    }\r\n\r\n    @AckuOnConsumed(svc = \"cat-order\")\r\n    @KafkaListener(topics = \"CAT_PAID_TCC_CONFIRM\")\r\n    public void onCatPaid_TCC_CONFIRM(ConsumerRecord<String, String> record) {\r\n\r\n        String json = record.value();\r\n        AckuDto dto = JsonX.toObject(json,AckuDto.class);\r\n        //--------------\r\n\r\n        CatOrder catOrder = new CatOrder();\r\n        catOrder.setId(\"CAT_ORDER_TEST\");\r\n        catOrder.setStatus(\"CONFIRM\");\r\n\r\n        orderController.confirm(catOrder);\r\n\r\n    }\r\n\r\n    @AckuOnConsumed(svc = \"cat-order\")\r\n    @KafkaListener(topics = \"CAT_PAID_TCC_CANCEL\")\r\n    public void onCatPaid_TCC_CANCEL(ConsumerRecord<String, String> record) {\r\n\r\n        String json = record.value();\r\n        AckuDto dto = JsonX.toObject(json,AckuDto.class);\r\n        //--------------\r\n\r\n        CatOrder catOrder = new CatOrder();\r\n        catOrder.setId(\"CAT_ORDER_TEST\");\r\n        catOrder.setStatus(\"CANCEL\");\r\n\r\n        orderController.cancel(catOrder);\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/repository/CatOrderRepository.java",
    "content": "package io.xream.acku.repository;\r\n\r\nimport io.xream.acku.bean.CatOrder;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n@Repository\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface CatOrderRepository extends BaseRepository<CatOrder> {\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/repository/CatRepository.java",
    "content": "package io.xream.acku.repository;\r\n\r\nimport io.xream.acku.bean.Cat;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n@Repository\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface CatRepository extends BaseRepository<Cat> {\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/java/io/xream/acku/repository/CatSettleRepository.java",
    "content": "package io.xream.acku.repository;\r\n\r\nimport io.xream.acku.bean.CatSettle;\r\nimport io.xream.sqli.api.BaseRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\n@Repository\r\n\r\n/**\r\n * @author Sim\r\n */\r\npublic interface CatSettleRepository extends BaseRepository<CatSettle> {\r\n}\r\n"
  },
  {
    "path": "demo/demo-producer-listener/src/main/resources/application.properties",
    "content": "spring.application.name=acku-demo\r\nspring.profiles.active=dev\r\nserver.port=7747\r\n\r\n\r\naccess.domain=*\r\n\r\nspring.jackson.serialization.write-dates-as-timestamps=true\r\nspring.jackson.time-zone=GMT+8\r\n\r\nspring.datasource.driver-class-name=com.mysql.jdbc.Driver\r\nspring.datasource.url=jdbc:mysql://127.0.0.1:3306/acku_test?&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai\r\nspring.datasource.username=root\r\nspring.datasource.password=123456\r\n\r\n\r\nspring.datasource.default-auto-commit=true\r\nspring.datasource.auto-commit=true\r\nspring.datasource.maximum-pool-size=100\r\nspring.datasource.max-idle=10\r\nspring.datasource.max-wait=10000\r\nspring.datasource.min-idle=5\r\nspring.datasource.initial-size=5\r\nspring.datasource.validation-query=SELECT 1\r\nspring.datasource.test-on-borrow=false\r\nspring.datasource.test-while-idle=true\r\nspring.datasource.time-between-eviction-runs-millis=18800\r\nspring.datasource.minEvictableIdleTimeMillis=300000\r\nspring.datasource.hikari.idleTimeout=30000\r\nspring.datasource.hikari.maximumPoolSize=10\r\n\r\nspring.redis.host=127.0.0.1\r\nspring.redis.port=6379\r\nspring.redis.pool.max-active=64\r\nspring.redis.pool.min-idle=8\r\n\r\n\r\nhttp.connectTimeout=15000\r\nhttp.socketTimeout=60000\r\n\r\nresilience4j.circuitbreaker.configs.default.wait-duration-in-open-state=60000\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-closed-state=100\r\nresilience4j.circuitbreaker.configs.default.ring-buffer-size-in-half-open-state=10\r\nresilience4j.circuitbreaker.configs.default.failure-rate-threshold=50\r\nresilience4j.circuitbreaker.configs.default.event-consumer-buffer-size=100\r\n\r\nendpoints.health.mapping.DOWN=OK\r\nendpoints.health.mapping.OUT_OF_SERVICE=OK\r\n\r\n#tracing.zipkin.url=http://127.0.0.1:9411\r\n\r\n\r\nlogging.level.root=INFO\r\nloggin.pattern.console=\"%d - %msg%n\"\r\n\r\n\r\nacku.retry.duration=5000\r\n\r\n\r\nspring.kafka.producer.bootstrap-servers=127.0.0.1:9092\r\nspring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer\r\nspring.kafka.producer.batch-size=65535\r\nspring.kafka.producer.buffer-memory=524288\r\nspring.kafka.producer.acks=1\r\nspring.kafka.producer.retries=3\r\n\r\nspring.kafka.listener.missing-topics-fatal=false\r\nspring.kafka.consumer.bootstrap-servers=127.0.0.1:9092\r\nspring.kafka.consumer.group-id=acku-test-order\r\nspring.kafka.consumer.auto-offset-reset=earliest\r\nspring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer\r\nspring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer\r\nspring.kafka.consumer.max-poll-records=30\r\nspring.kafka.properties.max.poll.interval.ms=400000\r\nspring.kafka.consumer.enable-auto-commit=true\r\nspring.kafka.listener.ack-mode=record\r\n\r\n#spring.kafka.consumer.enable-auto-commit=false\r\n#spring.kafka.listener.ack-mode=manual_immediate\r\n\r\nacku.app=acku-app:7717\r\nacku.demo=localhost:7747"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\r\n    <modelVersion>4.0.0</modelVersion>\r\n\r\n\r\n    <groupId>io.xream.acku</groupId>\r\n    <artifactId>acku</artifactId>\r\n    <name>acku</name>\r\n    <packaging>pom</packaging>\r\n    <version>0.2.0</version>\r\n    <description>http://acku.xream.io</description>\r\n    <url>http://acku.xream.io</url>\r\n\r\n    <properties>\r\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r\n        <maven.compiler.source>17</maven.compiler.source>\r\n        <maven.compiler.target>17</maven.compiler.target>\r\n        <maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>\r\n        <maven.test.skip>true</maven.test.skip>\r\n        <x7.boot.version>3.1.7</x7.boot.version>\r\n    </properties>\r\n\r\n    <modules>\r\n        <module>acku-entity</module>\r\n        <module>acku-core</module>\r\n        <module>acku-spring-boot-starter</module>\r\n        <module>acku-api</module>\r\n    </modules>\r\n\r\n    <scm>\r\n        <connection>scm:git:https://github.com/x-ream/acku</connection>\r\n        <developerConnection>scm:git:https://github.com/x-ream/acku</developerConnection>\r\n        <url>scm:git:https://github.com/x-ream/acku</url>\r\n        <tag>0.2.0</tag>\r\n    </scm>\r\n\r\n    <licenses>\r\n        <license>\r\n            <name>Apache 2</name>\r\n            <url>http://www.apache.org/licenses/LICENSE-2.0</url>\r\n            <distribution>repo</distribution>\r\n            <comments>A business-friendly OSS license</comments>\r\n        </license>\r\n    </licenses>\r\n\r\n    <developers>\r\n        <developer>\r\n            <name>Sim Wang</name>\r\n            <email>8966188@qq.com</email>\r\n        </developer>\r\n    </developers>\r\n\r\n    <distributionManagement>\r\n        <snapshotRepository>\r\n            <id>oss-s</id>\r\n            <name>xream.io snopshots repo</name>\r\n            <url>https://oss.sonatype.org/content/repositories/snapshots</url>\r\n        </snapshotRepository>\r\n        <repository>\r\n            <id>oss-r</id>\r\n            <name>xream.io release repo</name>\r\n            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>\r\n        </repository>\r\n    </distributionManagement>\r\n\r\n    <dependencyManagement>\r\n        <dependencies>\r\n            <dependency>\r\n                <groupId>org.springframework.boot</groupId>\r\n                <artifactId>spring-boot-dependencies</artifactId>\r\n                <version>3.2.2</version>\r\n                <type>pom</type>\r\n                <scope>import</scope>\r\n            </dependency>\r\n        </dependencies>\r\n    </dependencyManagement>\r\n\r\n\r\n    <dependencies>\r\n\r\n        <dependency>\r\n            <groupId>io.xream.x7</groupId>\r\n            <artifactId>x7-spring-boot-starter</artifactId>\r\n            <version>${x7.boot.version}</version>\r\n        </dependency>\r\n\r\n    </dependencies>\r\n\r\n\r\n    <build>\r\n        <plugins>\r\n            <plugin>\r\n                <groupId>org.codehaus.mojo</groupId>\r\n                <artifactId>versions-maven-plugin</artifactId>\r\n                <version>2.7</version>\r\n                <configuration>\r\n                    <generateBackupPoms>false</generateBackupPoms>\r\n                </configuration>\r\n            </plugin>\r\n            <!-- follows for deploy -->\r\n\r\n            <plugin>\r\n                <groupId>org.apache.maven.plugins</groupId>\r\n                <artifactId>maven-javadoc-plugin</artifactId>\r\n                <version>3.1.1</version>\r\n                <configuration>\r\n                    <encoding>UTF-8</encoding>\r\n                    <charset>UTF-8</charset>\r\n                    <docencoding>UTF-8</docencoding>\r\n                    <additionalJOption>-Xdoclint:none</additionalJOption>\r\n                </configuration>\r\n                <executions>\r\n                    <execution>\r\n                        <id>attach-javadocs</id>\r\n                        <goals>\r\n                            <goal>jar</goal>\r\n                        </goals>\r\n                    </execution>\r\n                </executions>\r\n            </plugin>\r\n            <plugin>\r\n                <groupId>org.apache.maven.plugins</groupId>\r\n                <artifactId>maven-source-plugin</artifactId>\r\n                <version>3.2.0</version>\r\n                <configuration>\r\n                    <attach>true</attach>\r\n                </configuration>\r\n                <executions>\r\n                    <execution>\r\n                        <id>source-jar</id>\r\n                        <phase>compile</phase>\r\n                        <goals>\r\n                            <goal>jar</goal>\r\n                        </goals>\r\n                    </execution>\r\n                </executions>\r\n            </plugin>\r\n<!--\r\n            <plugin>\r\n                <groupId>org.apache.maven.plugins</groupId>\r\n                <artifactId>maven-gpg-plugin</artifactId>\r\n                <version>3.1.0</version>\r\n                <executions>\r\n                    <execution>\r\n                        <id>sign-artifacts</id>\r\n                        <phase>verify</phase>\r\n                        <goals>\r\n                            <goal>sign</goal>\r\n                        </goals>\r\n                    </execution>\r\n                </executions>\r\n            </plugin>\r\n-->\r\n        </plugins>\r\n        <resources>\r\n            <resource>\r\n                <directory>src/main/resources</directory>\r\n            </resource>\r\n        </resources>\r\n    </build>\r\n\r\n\r\n</project>"
  }
]