Skip to content

Commit

Permalink
data-service层去掉archive-hbase的依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
majun87 committed Dec 15, 2020
1 parent e08d567 commit 778a84d
Show file tree
Hide file tree
Showing 5 changed files with 392 additions and 6 deletions.
4 changes: 2 additions & 2 deletions joyqueue-console/joyqueue-data/joyqueue-data-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@
<artifactId>joyqueue-archive-api</artifactId>
</dependency>
<!-- FIXME: 应该依赖joyqueue-archive-api 而不是这个joyqueue-archive-hbase实现-->
<dependency>
<!--<dependency>
<groupId>org.joyqueue</groupId>
<artifactId>joyqueue-archive-hbase</artifactId>
</dependency>
</dependency>-->
<dependency>
<groupId>org.joyqueue</groupId>
<artifactId>joyqueue-client-all</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import org.joyqueue.model.domain.User;
import org.joyqueue.model.query.QApplication;
import org.joyqueue.model.query.QArchive;
import org.joyqueue.server.archive.store.QueryCondition;
import org.joyqueue.server.archive.store.api.ArchiveStore;
import org.joyqueue.server.archive.store.model.ConsumeLog;
import org.joyqueue.server.archive.store.model.SendLog;
import org.joyqueue.server.archive.store.query.QueryCondition;
import org.joyqueue.service.ApplicationService;
import org.joyqueue.service.ArchiveService;
import org.joyqueue.service.TopicService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.joyqueue.exception.ServiceException;
import org.joyqueue.handler.error.ErrorCode;
import org.joyqueue.message.SourceType;
import org.joyqueue.server.archive.store.HBaseSerializer;
import org.joyqueue.server.archive.store.utils.ArchiveSerializer;
import org.joyqueue.server.retry.model.RetryMessageModel;
import org.joyqueue.handler.Constants;
import org.joyqueue.service.MessagePreviewService;
Expand Down Expand Up @@ -200,10 +200,10 @@ public BrokerMessage filterBrokerMessage(BrokerMessage brokerMessage, SendLog se
}
for(BrokerMessage m:msgs){
String msgId=ArchiveUtils.messageId(brokerMessage.getTopic(),m.getPartition(),m.getMsgIndexNo());
byte[] msgIdMd5Bytes=HBaseSerializer.md5(msgId,null);
byte[] msgIdMd5Bytes= ArchiveSerializer.md5(msgId,null);
if(logger.isDebugEnabled()) {
logger.debug("current message business id {},message id {},md5 length {},base 64 bytes {},hex {}", m.getBusinessId(), msgId, msgIdMd5Bytes.length,
Base64.getEncoder().encodeToString(msgIdMd5Bytes), HBaseSerializer.byteArrayToHexStr(msgIdMd5Bytes));
Base64.getEncoder().encodeToString(msgIdMd5Bytes), ArchiveSerializer.byteArrayToHexStr(msgIdMd5Bytes));
}
if(Arrays.equals(msgIdMd5Bytes,sendLog.getBytesMessageId())){
return m;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/**
* Copyright 2019 The JoyQueue Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.joyqueue.server.archive.store.query;

import org.joyqueue.server.archive.store.model.Query;
import org.joyqueue.server.archive.store.utils.ArchiveSerializer;

/**
* Created by chengzhiliang on 2018/12/4.
*/
public class QueryCondition implements Query {

@Override
public <T> T getQueryCondition() {
return (T)this;
}

private RowKey startRowKey; // 查询开始键
private RowKey stopRowKey; // 查询结束键
private int count;

private RowKey rowKey; // 指定RowKey查询

private byte[] startRowKeyByteArr;

public int getCount() {
return count;
}

public void setCount(int count) {
this.count = count;
}

public RowKey getStartRowKey() {
return startRowKey;
}

public void setStartRowKey(RowKey startRowKey) {
this.startRowKey = startRowKey;
}

public RowKey getStopRowKey() {
return stopRowKey;
}

public void setStopRowKey(RowKey stopRowKey) {
this.stopRowKey = stopRowKey;
}

public RowKey getRowKey() {
return rowKey;
}

public void setRowKey(RowKey rowKey) {
this.rowKey = rowKey;
}

public byte[] getStartRowKeyByteArr() {
return startRowKeyByteArr;
}

public void setStartRowKeyByteArr(String startRowKeyByteArr) {
byte[] bytes = ArchiveSerializer.hexStrToByteArray(startRowKeyByteArr);
this.startRowKeyByteArr = bytes;
}

/**
* 查询RowKey
*/
public static class RowKey {
private String topic;
private long time;
private String businessId;
private String messageId;

public String getTopic() {
return topic;
}

public void setTopic(String topic) {
this.topic = topic;
}

public long getTime() {
return time;
}

public void setTime(long time) {
this.time = time;
}

public String getBusinessId() {
return businessId;
}

public void setBusinessId(String businessId) {
this.businessId = businessId;
}

public String getMessageId() {
return messageId;
}

public void setMessageId(String messageId) {
this.messageId = messageId;
}

}
}
Loading

0 comments on commit 778a84d

Please sign in to comment.