Skip to content

Commit

Permalink
0.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
guoshiqiufeng committed Jan 31, 2024
1 parent f4de7a6 commit 356cd69
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 10 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
> loki框架测试
- [loki-simple-test](loki-simple-test)
基于spring 3.2 简单测试
基于spring 3.2 简单测试
- [loki-kafka-test](loki-kafka-test)
kafka测试,支持kafka3.x
- [loki-redis-test](loki-redis-test)
redis测试,支持redis5以上版本
- [loki-rocketmq-remoting-test](loki-rocketmq-remoting-test)
rocketmq-remoting协议测试,支持rocketmq 4.x 、5.x
- [loki-rocketmq-test](loki-rocketmq-test)
rocketmq-grpc协议测试,支持rocketmq 5.x
2 changes: 1 addition & 1 deletion loki-kafka-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>io.github.guoshiqiufeng</groupId>
<artifactId>loki-kafka-test</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>loki-kafka-test</name>
<description>loki-kafka-test</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.github.guoshiqiufeng.lokitest.controller;

import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONUtil;
import io.github.guoshiqiufeng.loki.support.core.ProducerRecord;
import io.github.guoshiqiufeng.loki.support.core.ProducerResult;
import io.github.guoshiqiufeng.loki.support.kafka.KafkaClient;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
* @author yanghq
* @version 1.0
* @since 2024/1/24 16:54
*/
@Slf4j
@RequestMapping("/client")
@RestController
public class ClientController {

@Resource
private KafkaClient kafkaClient;

@GetMapping("send")
public String send() throws ExecutionException, InterruptedException {
ProducerRecord record = new ProducerRecord();
record.setTopic("loki");
record.setMessage(IdUtil.getSnowflakeNextIdStr());
ProducerResult result = kafkaClient.sendAsync(record).get();
log.debug("send result:{}", JSONUtil.toJsonStr(result));
return "success";
}
}
2 changes: 1 addition & 1 deletion loki-redis-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>io.github.guoshiqiufeng</groupId>
<artifactId>loki-redis-test</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>loki-redis-test</name>
<description>loki-redis-test</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.github.guoshiqiufeng.lokitest.controller;

import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONUtil;
import io.github.guoshiqiufeng.loki.support.core.LokiClient;
import io.github.guoshiqiufeng.loki.support.core.ProducerRecord;
import io.github.guoshiqiufeng.loki.support.core.ProducerResult;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
* @author yanghq
* @version 1.0
* @since 2024/1/24 16:54
*/
@Slf4j
@RequestMapping("/client")
@RestController
public class ClientController {

@Resource
private LokiClient lokiClient;

@GetMapping("send")
public String send() throws ExecutionException, InterruptedException {
ProducerRecord record = new ProducerRecord();
record.setTopic("loki");
record.setMessage(IdUtil.getSnowflakeNextIdStr());
ProducerResult result = lokiClient.sendAsync(record).get();
log.debug("send result:{}", JSONUtil.toJsonStr(result));
return "success";
}
}
2 changes: 1 addition & 1 deletion loki-rocketmq-remoting-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>io.github.guoshiqiufeng</groupId>
<artifactId>loki-rocketmq-remoting-test</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>loki-rocketmq-remoting-test</name>
<description>loki-rocketmq-remoting-test</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.github.guoshiqiufeng.lokitest.controller;

import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONUtil;
import io.github.guoshiqiufeng.loki.support.core.ProducerRecord;
import io.github.guoshiqiufeng.loki.support.core.ProducerResult;
import io.github.guoshiqiufeng.loki.support.rocketmq.remoting.RocketRemotingClient;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
* @author yanghq
* @version 1.0
* @since 2024/1/24 16:54
*/
@Slf4j
@RequestMapping("/client")
@RestController
public class ClientController {

@Resource
private RocketRemotingClient rocketRemotingClient;

@GetMapping("send")
public String send() throws ExecutionException, InterruptedException {
ProducerRecord record = new ProducerRecord();
record.setTopic("loki");
record.setMessage(IdUtil.getSnowflakeNextIdStr());
ProducerResult result = rocketRemotingClient.sendAsync(record).get();
log.debug("send result:{}", JSONUtil.toJsonStr(result));
return "success";
}
}
2 changes: 1 addition & 1 deletion loki-rocketmq-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>io.github.guoshiqiufeng</groupId>
<artifactId>loki-rocketmq-test</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>loki-rocketmq-test</name>
<description>loki-rocketmq-test</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.github.guoshiqiufeng.lokitest.controller;

import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONUtil;
import io.github.guoshiqiufeng.loki.support.core.ProducerRecord;
import io.github.guoshiqiufeng.loki.support.core.ProducerResult;
import io.github.guoshiqiufeng.loki.support.rocketmq.RocketClient;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
* @author yanghq
* @version 1.0
* @since 2024/1/24 16:54
*/
@Slf4j
@RequestMapping("/client")
@RestController
public class ClientController {

@Resource
private RocketClient rocketClient;

@GetMapping("send")
public String send() throws ExecutionException, InterruptedException {
ProducerRecord record = new ProducerRecord();
record.setTopic("loki");
record.setMessage(IdUtil.getSnowflakeNextIdStr());
ProducerResult result = rocketClient.sendAsync(record).get();
log.debug("send result:{}", JSONUtil.toJsonStr(result));
return "success";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.github.guoshiqiufeng.loki.support.rocketmq.RocketClient;
import io.github.guoshiqiufeng.lokitest.entity.TestEntity;
import io.github.guoshiqiufeng.lokitest.mapper.TestMapper;
import jakarta.annotation.Resource;
Expand Down
2 changes: 1 addition & 1 deletion loki-simple-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>io.github.guoshiqiufeng</groupId>
<artifactId>loki-simple-test</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>loki-test</name>
<description>loki-test</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.github.guoshiqiufeng.lokitest.controller;

import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import io.github.guoshiqiufeng.loki.support.core.LokiClient;
import io.github.guoshiqiufeng.loki.support.core.ProducerRecord;
import io.github.guoshiqiufeng.loki.support.core.ProducerResult;
import io.github.guoshiqiufeng.loki.support.kafka.KafkaClient;
import io.github.guoshiqiufeng.loki.support.redis.RedisClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.concurrent.ExecutionException;

/**
* @author yanghq
* @version 1.0
* @since 2024/1/24 16:54
*/
@Slf4j
@RequestMapping("/client")
@RestController
public class ClientController {

@Resource
private RedisClient redisClient;

@GetMapping("send")
public String send() throws ExecutionException, InterruptedException {
ProducerRecord record = new ProducerRecord();
record.setTopic("loki");
record.setMessage(IdUtil.getSnowflakeNextIdStr());
ProducerResult result = redisClient.sendAsync(record).get();
log.debug("send result:{}", JSON.toJSONString(result));
return "success";
}
}
5 changes: 3 additions & 2 deletions loki-simple-test/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ loki:
mq-config:
mq-type: redis
address: 127.0.0.1:6379

auth: true
password: 123456
# mq-type: ROCKET_MQ
# address: 127.0.0.1:8081
# auth: false
# username: username
# password: password
# connect-timeout: 300
# max-attempts: 5
# max-attempts: 5
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
<version>3.2.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -19,7 +19,7 @@

<properties>
<java.version>17</java.version>
<loki.version>0.7.0</loki.version>
<loki.version>0.8.1</loki.version>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 356cd69

Please sign in to comment.