记得上下班打卡 | git大法好,push需谨慎

Commit 92912625 authored by zhanggb's avatar zhanggb

~opt;

parent e1bf558b
......@@ -3,7 +3,6 @@ package com.liquidnet.service.consumer.kylin.config;
import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinCodeReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -12,28 +11,46 @@ import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinCodeStreamConfig extends RedisStreamConfig {
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
ConsumerGoblinCodeReceiver consumerGoblinCodeReceiver;
public Subscription receiveCodeExamine(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_CODE_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_CODE_OPERA.name() + t)),
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_CODE_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinCodeReceiver);
}
@Bean
public Subscription codeExamine0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveCodeExamine(listenerContainer, 0);
// public Subscription receiveCodeExamine(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
// return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_CODE_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_CODE_OPERA.name() + t)),
// StreamOffset.create(MQConst.GoblinQueue.GOBLIN_CODE_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinCodeReceiver);
// }
//
// @Bean
// public Subscription codeExamine0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveCodeExamine(listenerContainer, 0);
// listenerContainer.start();
// return subscription;
// }
@Bean//
public List<Subscription> subscriptionCodeExamine(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_CODE_OPERA;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 1; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinCodeReceiver
));
listenerContainer.start();
return subscription;
}
return subscriptionList;
}
}
......@@ -11,44 +11,49 @@ import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinPhoneCodeReceiver;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class ConsumerGoblinPhoneCodeStreamConfig extends RedisStreamConfig {
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
ConsumerGoblinPhoneCodeReceiver consumerGoblinPhoneCodeReceiver;
public Subscription receivePhoneCodeExamine(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_PHONE_CODE_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_PHONE_CODE_OPERA.name() + t)),
StreamOffset.create(MQConst.GoblinQueue.GOBLIN_PHONE_CODE_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinPhoneCodeReceiver);
}
@Bean
public Subscription phoneCodeExamine0(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receivePhoneCodeExamine(listenerContainer, 0);
// public Subscription receivePhoneCodeExamine(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
// return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.GOBLIN_PHONE_CODE_OPERA.getGroup(), getConsumerName(MQConst.GoblinQueue.GOBLIN_PHONE_CODE_OPERA.name() + t)),
// StreamOffset.create(MQConst.GoblinQueue.GOBLIN_PHONE_CODE_OPERA.getKey(), ReadOffset.lastConsumed()), consumerGoblinPhoneCodeReceiver);
// }
//
// @Bean
// public Subscription phoneCodeExamine0(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receivePhoneCodeExamine(listenerContainer, 0);
// listenerContainer.start();
// return subscription;
// }
@Bean//
public List<Subscription> subscriptionPhoneCodeExamine(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_PHONE_CODE_OPERA;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 1; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinPhoneCodeReceiver
));
listenerContainer.start();
return subscription;
}
/* @Bean
public Subscription phoneCodeExamine1(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receivePhoneCodeExamine(listenerContainer, 1);
listenerContainer.start();
return subscription;
}*/
return subscriptionList;
}
}
package com.liquidnet.service.consumer.kylin.receiver;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.HttpUtil;
......@@ -9,7 +7,6 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.mapper.GoblinNftExCodeMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......
......@@ -6,7 +6,8 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
public class ConsumerGoblinCodeReceiver extends AbstractSqlRedisReceiver{
public class ConsumerGoblinCodeReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.GOBLIN_CODE_OPERA.getKey();
......
package com.liquidnet.service.consumer.kylin.receiver;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.mapper.GoblinNftExCodeMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
public class ConsumerGoblinPhoneCodeReceiver extends AbstractHttpRedisReceiver{
public class ConsumerGoblinPhoneCodeReceiver extends AbstractHttpRedisReceiver {
@Override
protected String getRedisStreamKey() {
......
......@@ -12,7 +12,6 @@
<properties>
<bitwalker.version>1.19</bitwalker.version>
<easyexcel.version>3.0.5</easyexcel.version>
</properties>
<dependencies>
......@@ -114,16 +113,17 @@
<artifactId>aliyun-java-sdk-facebody</artifactId>
<version>1.2.27</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.6.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>redis.clients</groupId>-->
<!-- <artifactId>jedis</artifactId>-->
<!-- <version>3.6.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-api-feign-stone</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment