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.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.joyqueue.async.BrokerClusterQuery;
import org.joyqueue.async.BrokerMonitorClusterQuery;
import org.joyqueue.async.RetrieveProvider;
import org.joyqueue.convert.CodeConverter;
import org.joyqueue.domain.PartitionGroup;
import org.joyqueue.model.domain.Broker;
import org.joyqueue.model.domain.SimplifiedBrokeMessage;
import org.joyqueue.model.domain.Subscribe;
import org.joyqueue.model.domain.SubscribeType;
import org.joyqueue.monitor.BrokerMessageInfo;
import org.joyqueue.monitor.RestResponse;
import org.joyqueue.monitor.RestResponseCode;
import org.joyqueue.other.HttpRestService;
import org.joyqueue.service.BrokerMessageService;
import org.joyqueue.service.LeaderService;
import org.joyqueue.util.NullUtil;
import org.joyqueue.util.UrlEncoderUtil;
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.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@Service("brokerMessageService")
public class BrokerMessageServiceImpl implements BrokerMessageService {
private static final Logger logger= LoggerFactory.getLogger(BrokerMessageServiceImpl.class);
private static final long TIMEOUT=10000;
public static final ObjectMapper mapper = new ObjectMapper();
@Resource(type = BrokerMonitorClusterQuery.class)
private BrokerClusterQuery brokerClusterQuery;
@Autowired
private LeaderService leaderService;
@Autowired(required = false)
private HttpRestService httpRestService;
@Override
public List previewMessage(Subscribe subscribe, int count) {
List simplifiedBrokeMessages=new ArrayList<>();
List brokers=new ArrayList<>();
Future