-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4de7a6
commit 356cd69
Showing
14 changed files
with
213 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...afka-test/src/main/java/io/github/guoshiqiufeng/lokitest/controller/ClientController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...edis-test/src/main/java/io/github/guoshiqiufeng/lokitest/controller/ClientController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ting-test/src/main/java/io/github/guoshiqiufeng/lokitest/controller/ClientController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...etmq-test/src/main/java/io/github/guoshiqiufeng/lokitest/controller/ClientController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...mple-test/src/main/java/io/github/guoshiqiufeng/lokitest/controller/ClientController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters