blob: 9b8412055bea5ab3f59410351dcfc4b883efa177 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include <yt/yt/core/rpc/bus/server.h>
#include <yt/yt/core/rpc/server.h>
#include <yt/yt/core/bus/tcp/server.h>
#include <yt/yt/core/bus/tcp/config.h>
#include <yt/yt/core/concurrency/thread_pool.h>
#include <yt/yt/core/rpc/unittests/lib/my_service.h>
using namespace NYT;
using namespace NYT::NBus;
using namespace NYT::NRpc;
using namespace NYT::NRpc::NBus;
using namespace NYT::NConcurrency;
int main(int argc, char* argv[])
{
try {
if (argc != 2) {
THROW_ERROR_EXCEPTION("Port argument is missing");
}
auto port = FromString<int>(argv[1]);
auto busConfig = TBusServerConfig::CreateTcp(port);
auto busServer = CreateBusServer(busConfig);
auto server = CreateBusServer(busServer);
auto workerPool = CreateThreadPool(4, "Worker");
auto service = CreateMyService(workerPool->GetInvoker(), false);
server->RegisterService(service);
server->Start();
Sleep(TDuration::Max());
} catch (const std::exception& ex) {
Cerr << ex.what() << Endl;
return 1;
}
return 0;
}
|