blob: 52400e6e2dc54f85358830a23c0c5ed24ebfb9c1 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
#pragma once
#include <cassert>
#include <cstdlib>
#include <functional>
#include <memory>
#include <string>
#include <vector>
#include "HostInfo.h"
#include "HttpClient.h"
ROCKETMQ_NAMESPACE_BEGIN
class TopAddressing {
public:
TopAddressing();
TopAddressing(std::string host, int port, std::string path);
virtual ~TopAddressing();
void fetchNameServerAddresses(const std::function<void(bool, const std::vector<std::string>&)>& cb);
void injectHttpClient(std::unique_ptr<HttpClient> http_client);
private:
std::string host_;
int port_{8080};
std::string path_;
HostInfo host_info_;
std::unique_ptr<HttpClient> http_client_;
};
ROCKETMQ_NAMESPACE_END