parent
1f54934806
commit
d111618c96
@ -1,5 +1,8 @@
|
||||
package com.java3y.austin.dto;
|
||||
|
||||
/**
|
||||
* @author 3y
|
||||
*/
|
||||
public class MiniProgramContentModel extends ContentModel {
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.java3y.austin.dto;
|
||||
|
||||
/**
|
||||
* @author 3y
|
||||
*/
|
||||
public class OfficialAccountsContentModel extends ContentModel {
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package com.java3y.austin.dto;
|
||||
|
||||
|
||||
/**
|
||||
* @author 3y
|
||||
*/
|
||||
public class PushContentModel extends ContentModel {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package com.java3y.austin.config;
|
||||
|
||||
import cn.hutool.core.thread.ExecutorBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* 线程池配置信息
|
||||
* @author 3y
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
public class ThreadPoolConfig {
|
||||
|
||||
@Bean("smsThreadPool")
|
||||
public static ExecutorService getSmsThreadPool() {
|
||||
ThreadPoolExecutor threadPoolExecutor = ExecutorBuilder.create()
|
||||
.setCorePoolSize(4)
|
||||
.setMaxPoolSize(4)
|
||||
.setKeepAliveTime(60)
|
||||
.setWorkQueue(new LinkedBlockingQueue<>(1000))
|
||||
.setHandler((r, executor) -> {
|
||||
try {
|
||||
executor.getQueue().put(r);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
})
|
||||
.build();
|
||||
|
||||
return threadPoolExecutor;
|
||||
}
|
||||
|
||||
@Bean("emailThreadPoll")
|
||||
public static ExecutorService getEmailThreadPool() {
|
||||
ThreadPoolExecutor threadPoolExecutor = ExecutorBuilder.create()
|
||||
.setCorePoolSize(2)
|
||||
.setMaxPoolSize(2)
|
||||
.setKeepAliveTime(60)
|
||||
.setWorkQueue(new LinkedBlockingQueue<>(1000))
|
||||
.setHandler((r, executor) -> {
|
||||
try {
|
||||
executor.getQueue().put(r);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
})
|
||||
.build();
|
||||
return threadPoolExecutor;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.java3y.austin.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author 3y
|
||||
* @date 2021/11/22
|
||||
* 请求类型
|
||||
*/
|
||||
@Getter
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
public enum RequestType {
|
||||
|
||||
|
||||
SINGLE(10, "请求接口为 single 类型"),
|
||||
|
||||
BATCH(20, "请求接口为 batch 类型");
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 类型说明
|
||||
*/
|
||||
private String description;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.java3y.austin.pipeline;
|
||||
|
||||
import lombok.Builder;
|
||||
|
||||
/**
|
||||
* @author 3y
|
||||
* @date 2021/11/22
|
||||
* @cription 流程处理的结果
|
||||
*/
|
||||
@Builder
|
||||
public class ProcessResponse {
|
||||
|
||||
/** 返回值编码 */
|
||||
private final String code;
|
||||
|
||||
/** 返回值描述 */
|
||||
private final String description;
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
//package com.java3y.austin.controller;
|
||||
//
|
||||
//import com.java3y.austin.kafkatest.UserLogProducer;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.GetMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//@RestController
|
||||
//public class KafkaTestController {
|
||||
//
|
||||
// @Autowired
|
||||
// private UserLogProducer userLogProducer;
|
||||
//
|
||||
// /**
|
||||
// * test insert
|
||||
// */
|
||||
// @GetMapping("/kafka/insert")
|
||||
// public String insert(String userId) {
|
||||
// userLogProducer.sendLog(userId);
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,32 +0,0 @@
|
||||
package com.java3y.austin.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.java3y.austin.dao.SmsRecordDao;
|
||||
import com.java3y.austin.domain.MessageTemplate;
|
||||
import com.java3y.austin.domain.SmsRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
public class SmsRecordController {
|
||||
|
||||
@Autowired
|
||||
private SmsRecordDao smsRecordDao;
|
||||
|
||||
/**
|
||||
* test insert
|
||||
*/
|
||||
@GetMapping("/insert")
|
||||
public String insert(Integer phone) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* test query
|
||||
*/
|
||||
@GetMapping("/query")
|
||||
public String query() {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package com.java3y.austin.kafkatest;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author 18011618
|
||||
* @Description 定义用户发送的日志数据
|
||||
* @Date 14:42 2018/7/20
|
||||
* @Modify By
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserLog {
|
||||
private String username;
|
||||
private String userid;
|
||||
private String state;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.java3y.austin.kafkatest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Author 18011618
|
||||
* @Description
|
||||
* @Date 14:50 2018/7/20
|
||||
* @Modify By
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class UserLogConsumer {
|
||||
@KafkaListener(topics = {"austin"},groupId = "austinGroup1")
|
||||
public void consumer(ConsumerRecord<?,?> consumerRecord){
|
||||
//判断是否为null
|
||||
Optional<?> kafkaMessage = Optional.ofNullable(consumerRecord.value());
|
||||
log.info(">>>>>>>>>> record =" + kafkaMessage);
|
||||
if(kafkaMessage.isPresent()){
|
||||
//得到Optional实例中的值
|
||||
Object message = kafkaMessage.get();
|
||||
System.err.println("消费消息:"+message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.java3y.austin.kafkatest;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author 18011618
|
||||
* @Description
|
||||
* @Date 14:43 2018/7/20
|
||||
* @Modify By
|
||||
*/
|
||||
@Component
|
||||
public class UserLogProducer {
|
||||
@Autowired
|
||||
private KafkaTemplate kafkaTemplate;
|
||||
|
||||
/**
|
||||
* 发送数据
|
||||
* @param userid
|
||||
*/
|
||||
public void sendLog(String userid){
|
||||
UserLog userLog = new UserLog();
|
||||
userLog.setUsername("jhp").setUserid(userid).setState("0");
|
||||
System.err.println("发送用户日志数据:"+userLog);
|
||||
kafkaTemplate.send("austin", JSON.toJSONString(userLog));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue