com.stalary.lightmqclient

lightmq client

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.stalary
ArtifactId

ArtifactId

lightmqclient
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

com.stalary.lightmqclient
lightmq client
Project URL

Project URL

https://github.com/stalary/lightMQ-client
Source Code Management

Source Code Management

https://github.com/stalary/lightMQ-client.git

Download lightmqclient

How to add to project

<!-- https://jarcasting.com/artifacts/com.stalary/lightmqclient/ -->
<dependency>
    <groupId>com.stalary</groupId>
    <artifactId>lightmqclient</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.stalary/lightmqclient/
implementation 'com.stalary:lightmqclient:0.0.1'
// https://jarcasting.com/artifacts/com.stalary/lightmqclient/
implementation ("com.stalary:lightmqclient:0.0.1")
'com.stalary:lightmqclient:jar:0.0.1'
<dependency org="com.stalary" name="lightmqclient" rev="0.0.1">
  <artifact name="lightmqclient" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.stalary', module='lightmqclient', version='0.0.1')
)
libraryDependencies += "com.stalary" % "lightmqclient" % "0.0.1"
[com.stalary/lightmqclient "0.0.1"]

Dependencies

compile (7)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-webflux jar 2.0.3.RELEASE
org.springframework.boot : spring-boot-autoconfigure jar 2.0.3.RELEASE
org.springframework.boot : spring-boot-configuration-processor jar 2.0.3.RELEASE
ch.qos.logback : logback-classic jar 1.2.3
org.apache.commons : commons-lang3 jar 3.7
com.alibaba : fastjson jar 1.2.47
org.projectlombok : lombok Optional jar 1.18.0

Project Modules

There are no modules declared in this project.

lightMQ-client

lightMQ的客户端 使用步骤:

  1. 注册topic或者group(默认生成master分组)
http://120.24.5.178:8001/registerTopic?topic=test
http://120.24.5.178:8001/registerGroup?topic=test&group=slave
  1. 在需要使用的项目中使用maven引入
<dependency>
    <groupId>com.stalary</groupId>
    <artifactId>lightmqclient</artifactId>
    <version>0.0.1</version>
</dependency>
  1. 实现MQConsumer接口,自定义消息处理,@MQListener设置需要监听的topic
@Component
public class MyConsumer implements MQConsumer {
    @Override
    @MQListener(topics = {"test"})
    public void process(MessageDto messageDto) {
        System.out.println("receive message: " + messageDto);
    }
}
  1. 注入Producer生产者,进行消息的发送
@Resource
private Producer producer;
producer.send("test", "123");
  1. 在application.properties中进行配置
com.stalary.lightmq.group=webflux // 消费分组,不配置则为消费默认分组
com.stalary.lightmq.url=http://120.24.5.178:8001 // 使用服务端的地址,建议自行构建lightmq
com.stalary.lightmq.consumer=false // 是否开启消费者,默认开启,适用于集群中的单点消费
com.stalary.lightmq.block=false // 是否阻塞模式消费,默认非阻塞
com.stalary.lightmq.order=false // 是否顺序生产消息,默认无序,采用异步消费

Versions

Version
0.0.1