mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-06 19:09:57 +08:00
云快充1.5.0 初始化
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 抖音关注:程序员三丙
|
||||
* 知识星球:https://t.zsxq.com/j9b21
|
||||
*/
|
||||
package sanbing.jcpp.infrastructure.queue.common;
|
||||
|
||||
public interface QueueConfig {
|
||||
|
||||
boolean isConsumerPerPartition();
|
||||
|
||||
int getPollInterval();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 抖音关注:程序员三丙
|
||||
* 知识星球:https://t.zsxq.com/j9b21
|
||||
*/
|
||||
package sanbing.jcpp.infrastructure.queue.common;
|
||||
|
||||
/**
|
||||
* @author baigod
|
||||
*/
|
||||
public final class QueueConstants {
|
||||
|
||||
public static final String MSG_MD_PREFIX = "jcpp_";
|
||||
|
||||
public static final String MSG_MD_TS = "ts";
|
||||
|
||||
public static final String MSG_MD_PROTOCOL_SESSION_ID = "protocol_session_id";
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* 抖音关注:程序员三丙
|
||||
* 知识星球:https://t.zsxq.com/j9b21
|
||||
*/
|
||||
package sanbing.jcpp.infrastructure.queue.common;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@ToString
|
||||
public class TopicPartitionInfo {
|
||||
|
||||
@Getter
|
||||
private final String topic;
|
||||
private final Integer partition;
|
||||
@Getter
|
||||
private final String fullTopicName;
|
||||
@Getter
|
||||
private final boolean myPartition;
|
||||
|
||||
@Builder
|
||||
public TopicPartitionInfo(String topic, Integer partition, boolean myPartition) {
|
||||
this.topic = topic;
|
||||
this.partition = partition;
|
||||
this.myPartition = myPartition;
|
||||
String tmp = topic;
|
||||
if (partition != null) {
|
||||
tmp += "." + partition;
|
||||
}
|
||||
this.fullTopicName = tmp;
|
||||
}
|
||||
|
||||
public TopicPartitionInfo newByTopic(String topic) {
|
||||
return new TopicPartitionInfo(topic, this.partition, this.myPartition);
|
||||
}
|
||||
|
||||
public Optional<Integer> getPartition() {
|
||||
return Optional.ofNullable(partition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
TopicPartitionInfo that = (TopicPartitionInfo) o;
|
||||
return topic.equals(that.topic) &&
|
||||
Objects.equals(partition, that.partition) &&
|
||||
fullTopicName.equals(that.fullTopicName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(fullTopicName);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user