mark
This commit is contained in:
parent
28591e74dc
commit
0bab2292aa
@ -3,13 +3,17 @@ package com.qgs.dc.influx.controller;
|
||||
import com.influxdb.client.domain.WritePrecision;
|
||||
import com.influxdb.client.write.Point;
|
||||
import com.qgs.dc.influx.config.InfluxClient;
|
||||
import com.qgs.dc.influx.param.InsertParam;
|
||||
import com.qgs.dc.influx.template.Event;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/influx")
|
||||
@ -36,19 +40,8 @@ public class InfluxDemoController {
|
||||
|
||||
|
||||
@PostMapping("/insertBatch")
|
||||
public void insertBatch() throws InterruptedException {
|
||||
// List<Event> list = new ArrayList<>();
|
||||
//
|
||||
// for(int i=0;i<99;i++){
|
||||
// //Thread.sleep(1000);
|
||||
// Event event = new Event();
|
||||
// event.time = Instant.now();
|
||||
// event.transationId = "asas"+i;
|
||||
// event.argName = "arg5";
|
||||
// event.argValue = new Double(i);
|
||||
// list.add(event);
|
||||
// }
|
||||
// influxService.batchInsert(list);
|
||||
public void insertBatch(@RequestBody InsertParam insertParam) throws InterruptedException {
|
||||
InfluxClient.Client.batchInsert(insertParam.getList(),insertParam.getMeasurement());
|
||||
}
|
||||
|
||||
|
||||
@ -73,4 +66,8 @@ public class InfluxDemoController {
|
||||
Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEvent");
|
||||
InfluxClient.Client.insert(event,"ASProcessCompleteEvent");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
17
src/main/java/com/qgs/dc/influx/param/InsertParam.java
Normal file
17
src/main/java/com/qgs/dc/influx/param/InsertParam.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.qgs.dc.influx.param;
|
||||
|
||||
import com.qgs.dc.influx.template.Event;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Desc: ""
|
||||
* @Author: caixiang
|
||||
* @DATE: 2022/10/13 16:10
|
||||
*/
|
||||
@Data
|
||||
public class InsertParam {
|
||||
List<Event> list;
|
||||
String measurement;
|
||||
}
|
@ -13,6 +13,7 @@ import java.time.Instant;
|
||||
*/
|
||||
@Data
|
||||
public class Event {
|
||||
|
||||
private Instant time;
|
||||
|
||||
private String transationId;
|
||||
|
@ -71,7 +71,6 @@ public class PID13SReceived {
|
||||
}
|
||||
//2.模拟异常 ,然后 拒签消息 ,然后丢到死信队列
|
||||
|
||||
//throw new Exception("11111");
|
||||
}catch (Exception e){
|
||||
// 第一个false 是 不批量签收;第二个false 是 不重回队列
|
||||
logger.error(e.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user