加强注释

This commit is contained in:
redkale
2024-06-12 15:19:25 +08:00
parent a676dca6b4
commit 145dcdf1d3
7 changed files with 89 additions and 13 deletions

View File

@@ -15,6 +15,7 @@ import org.redkale.util.AnyValue;
* *
* @see org.redkale.mq.MessageConext * @see org.redkale.mq.MessageConext
* @see org.redkale.mq.ResourceConsumer * @see org.redkale.mq.ResourceConsumer
* @see org.redkale.mq.Messaged
* @author zhangjx * @author zhangjx
* @param <T> T * @param <T> T
* @since 2.8.0 * @since 2.8.0

View File

@@ -16,12 +16,26 @@ import org.redkale.inject.Resourcable;
*/ */
public interface MessageManager extends Resourcable { public interface MessageManager extends Resourcable {
// /**
* 创建topic
*
* @param topics topic集合
* @return 是否成功
*/
public boolean createTopic(String... topics); public boolean createTopic(String... topics);
// 删除topic如果不存在则跳过 /**
* 删除topic如果不存在则跳过
*
* @param topics topic集合
* @return 是否成功
*/
public boolean deleteTopic(String... topics); public boolean deleteTopic(String... topics);
// 查询所有topic /**
* 查询所有topic
*
* @return topic集合
*/
public abstract List<String> queryTopic(); public abstract List<String> queryTopic();
} }

View File

@@ -12,6 +12,7 @@ import org.redkale.convert.Convert;
* *
* <p>详情见: https://redkale.org * <p>详情见: https://redkale.org
* *
* @see org.redkale.mq.ResourceProducer
* @author zhangjx * @author zhangjx
* @since 2.8.0 * @since 2.8.0
*/ */

View File

@@ -3,21 +3,47 @@
*/ */
package org.redkale.mq; package org.redkale.mq;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.redkale.convert.ConvertType; import org.redkale.convert.ConvertType;
import org.redkale.service.LoadMode; import org.redkale.service.LoadMode;
/** /**
* MQ资源注解, 只能标记在Service类方法上 1、方法必须是protected/public 2、方法不能是final/static * MQ资源注解, 只能标记在Service类方法上, 方法会被框架动态生成{@link org.redkale.mq.MessageConsumer}对象供内部调用 <br>
* 1、方法必须是protected/public <br>
* 2、方法不能是final/static <br>
* 3、方法的参数只能是1个或者2个 1个参数视为Message数据类型2个参数则另一个必须是{@link org.redkale.mq.MessageConext} <br>
* <blockquote>
*
* <pre>
* public class MyMessageService extends AbstractService {
*
* &#64;Messaged(mq="defaultmq", topics={"test-topic"})
* protected void onMessage(Record msg) {
* //打印msg
* }
*
* &#64;Messaged(topics={"test-topic2"})
* protected void onMessage2(MessageConext context, Record msg) {
* //打印msg
* }
*
* &#64;Messaged(topics={"test-topic3"})
* public void onMessage3(Record msg, MessageConext context) {
* //打印msg
* }
* }
* </pre>
*
* </blockquote>
* *
* <p>详情见: https://redkale.org * <p>详情见: https://redkale.org
* *
* @see org.redkale.mq.ResourceConsumer * @see org.redkale.mq.ResourceConsumer
* @see org.redkale.mq.MessageConext
* @author zhangjx * @author zhangjx
* @since 2.8.0 * @since 2.8.0
*/ */

View File

@@ -3,10 +3,9 @@
*/ */
package org.redkale.mq; package org.redkale.mq;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
import org.redkale.annotation.ClassDepends; import org.redkale.annotation.ClassDepends;
import org.redkale.convert.ConvertType; import org.redkale.convert.ConvertType;
@@ -15,6 +14,7 @@ import org.redkale.convert.ConvertType;
* *
* <p>详情见: https://redkale.org * <p>详情见: https://redkale.org
* *
* @see org.redkale.mq.MessageConsumer
* @author zhangjx * @author zhangjx
* @since 2.8.0 * @since 2.8.0
*/ */
@@ -24,11 +24,31 @@ import org.redkale.convert.ConvertType;
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface ResourceConsumer { public @interface ResourceConsumer {
/**
* {@link org.redkale.mq.MessageAgent}对象对应名称
*
* @return MQ名称
*/
String mq() default ""; String mq() default "";
/**
* MQ客户端分组名称
*
* @return 组名称
*/
String group() default ""; String group() default "";
/**
* 监听的topic
*
* @return topic
*/
String[] topics(); String[] topics();
/**
* 消息序列化类型
*
* @return 序列化类型
*/
ConvertType convertType() default ConvertType.JSON; ConvertType convertType() default ConvertType.JSON;
} }

View File

@@ -3,10 +3,9 @@
*/ */
package org.redkale.mq; package org.redkale.mq;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.*;
import org.redkale.convert.ConvertType; import org.redkale.convert.ConvertType;
/** /**
@@ -23,9 +22,24 @@ import org.redkale.convert.ConvertType;
@Retention(RUNTIME) @Retention(RUNTIME)
public @interface ResourceProducer { public @interface ResourceProducer {
/**
* {@link org.redkale.mq.MessageAgent}对象对应名称
*
* @return MQ名称
*/
String mq() default ""; String mq() default "";
/**
* 是否必须要加载为ture时若mq()值对应{@link org.redkale.mq.MessageAgent}对象不存在的情况下会抛异常
*
* @return 是否必须要加载
*/
boolean required() default true; boolean required() default true;
/**
* 消息序列化类型
*
* @return 序列化类型
*/
ConvertType convertType() default ConvertType.JSON; ConvertType convertType() default ConvertType.JSON;
} }

View File

@@ -24,7 +24,7 @@ import org.redkale.util.Sheet;
* <blockquote> * <blockquote>
* *
* <pre> * <pre>
* public interface ForumInfoMapper extends BaseMapper&lt;ForumInfo&gt; { * public interface ForumInfoMapper extends DataSqlMapper&lt;ForumInfo&gt; {
* *
* &#64;Sql("SELECT f.forum_groupid, s.forum_section_color " * &#64;Sql("SELECT f.forum_groupid, s.forum_section_color "
* + "FROM forum_info f, forum_section s " * + "FROM forum_info f, forum_section s "