Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* 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.service.impl;
import com.alibaba.fastjson.JSON;
import org.joyqueue.async.BrokerClusterQuery;
import org.joyqueue.async.BrokerMonitorClusterQuery;
import org.joyqueue.async.DefaultBrokerInfoFuture;
import org.joyqueue.async.RetrieveProvider;
import org.joyqueue.async.UpdateProvider;
import org.joyqueue.convert.CodeConverter;
import org.joyqueue.domain.PartitionGroup;
import org.joyqueue.monitor.PartitionAckMonitorInfo;
import org.joyqueue.monitor.PartitionLeaderAckMonitorInfo;
import org.joyqueue.monitor.RestResponse;
import org.joyqueue.model.domain.Broker;
import org.joyqueue.model.domain.PartitionOffset;
import org.joyqueue.model.domain.Subscribe;
import org.joyqueue.other.HttpRestService;
import org.joyqueue.service.BrokerRestUrlMappingService;
import org.joyqueue.service.ConsumeOffsetService;
import org.joyqueue.service.LeaderService;
import org.joyqueue.service.TopicPartitionGroupService;
import com.google.common.base.Preconditions;
import org.joyqueue.toolkit.time.SystemClock;
import org.joyqueue.util.AsyncHttpClient;
import org.joyqueue.util.JSONParser;
import org.joyqueue.util.NullUtil;
import org.joyqueue.util.UrlEncoderUtil;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* offset management
* @author wangjin18
*
**/
@Service("consumeOffsetService")
//todo 待移走
public class ConsumeOffsetServiceImpl implements ConsumeOffsetService {
private static final Logger logger= LoggerFactory.getLogger(ConsumeOffsetServiceImpl.class);
private static final long TIMEOUT=60000;
@Resource(type = BrokerMonitorClusterQuery.class)
private BrokerClusterQuery brokerCluster;
@Autowired
private TopicPartitionGroupService partitionGroupService;
@Autowired
private BrokerRestUrlMappingService urlMappingService;
@Autowired
private LeaderService leaderService;
@Autowired
private HttpRestService httpRestService;
@Override
public List offsets(Subscribe subscribe) {
this.checkArgument(subscribe);
List brokers=new ArrayList<>();
List partitionAckMonitorInfos=new ArrayList<>();
Future