|
@@ -13,17 +13,36 @@ using namespace NYT::NBus;
|
|
|
using namespace NYT::NRpc;
|
|
|
using namespace NYT::NRpc::NBus;
|
|
|
using namespace NYT::NConcurrency;
|
|
|
+using namespace NYT::NYson;
|
|
|
+using namespace NYT::NYTree;
|
|
|
+
|
|
|
+static const auto Logger = NLogging::TLogger("RpcTestServer");
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
{
|
|
|
try {
|
|
|
if (argc != 2) {
|
|
|
- THROW_ERROR_EXCEPTION("Port argument is missing");
|
|
|
+ THROW_ERROR_EXCEPTION("Config argument is missing. Pass empty string to get config schema.");
|
|
|
+ }
|
|
|
+
|
|
|
+ TYsonStringBuf configText(argv[1]);
|
|
|
+ auto busConfig = New<TBusServerConfig>();
|
|
|
+
|
|
|
+ if (configText.AsStringBuf().Empty()) {
|
|
|
+ TYsonWriter writer(&Cout, EYsonFormat::Pretty);
|
|
|
+ busConfig->WriteSchema(&writer);
|
|
|
+ Cout << Endl;
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
- auto port = FromString<int>(argv[1]);
|
|
|
+ // FIXME(khlebnikov): ConvertTo does not allow to set UnrecognizedStrategy.
|
|
|
+ // busConfig = ConvertTo<TBusServerConfigPtr>(config);
|
|
|
+
|
|
|
+ busConfig->SetUnrecognizedStrategy(EUnrecognizedStrategy::ThrowRecursive);
|
|
|
+ Deserialize(*busConfig, ConvertToNode(configText));
|
|
|
+
|
|
|
+ YT_LOG_INFO("Config: %v", ConvertToYsonString(busConfig, EYsonFormat::Text));
|
|
|
|
|
|
- auto busConfig = TBusServerConfig::CreateTcp(port);
|
|
|
auto busServer = CreateBusServer(busConfig);
|
|
|
auto server = CreateBusServer(busServer);
|
|
|
|