Adding command line params for service names for HelloWorld

This commit is contained in:
Jonathan Goldstein 2018-12-12 13:07:34 -08:00
Родитель 588f27dbc7
Коммит 82e87f8c53
4 изменённых файлов: 32 добавлений и 5 удалений

Просмотреть файл

@ -16,6 +16,7 @@ namespace UnsafeDeregisterService
Console.WriteLine("UnsafeDeregisterInstance InstanceName"); Console.WriteLine("UnsafeDeregisterInstance InstanceName");
Console.WriteLine("WARNING: This is a metadata hacking tool that should NEVER be used on a real deployment"); Console.WriteLine("WARNING: This is a metadata hacking tool that should NEVER be used on a real deployment");
Console.WriteLine("This tool is a convenience for developers who want to more easily test certain application modfications"); Console.WriteLine("This tool is a convenience for developers who want to more easily test certain application modfications");
Console.WriteLine("Usage: UnsafeDeregisterInstance InstanceName");
return; return;
} }
var client = new CRAClientLibrary(Environment.GetEnvironmentVariable("AZURE_STORAGE_CONN_STRING")); var client = new CRAClientLibrary(Environment.GetEnvironmentVariable("AZURE_STORAGE_CONN_STRING"));

Просмотреть файл

@ -46,8 +46,18 @@ namespace Client1
int receivePort = 1001; int receivePort = 1001;
int sendPort = 1000; int sendPort = 1000;
string clientInstanceName = "jgclient1"; string clientInstanceName = "client1";
string serverInstanceName = "jgserver1"; string serverInstanceName = "server1";
if (args.Length >= 1)
{
clientInstanceName = args[0];
}
if (args.Length == 2)
{
serverInstanceName = args[1];
}
using (var c = AmbrosiaFactory.Deploy<IClient1>(clientInstanceName, new Client1(serverInstanceName), receivePort, sendPort)) using (var c = AmbrosiaFactory.Deploy<IClient1>(clientInstanceName, new Client1(serverInstanceName), receivePort, sendPort))
{ {

Просмотреть файл

@ -71,8 +71,18 @@ namespace Client2
int receivePort = 1001; int receivePort = 1001;
int sendPort = 1000; int sendPort = 1000;
string clientInstanceName = "jgclient1"; string clientInstanceName = "client1";
string serverInstanceName = "jgserver1"; string serverInstanceName = "server1";
if (args.Length >= 1)
{
clientInstanceName = args[0];
}
if (args.Length == 2)
{
serverInstanceName = args[1];
}
Client2 client = new Client2(serverInstanceName); Client2 client = new Client2(serverInstanceName);
using (var c = AmbrosiaFactory.Deploy<IClient2>(clientInstanceName, client, receivePort, sendPort)) using (var c = AmbrosiaFactory.Deploy<IClient2>(clientInstanceName, client, receivePort, sendPort))

Просмотреть файл

@ -36,7 +36,13 @@ namespace Server
{ {
int receivePort = 2001; int receivePort = 2001;
int sendPort = 2000; int sendPort = 2000;
string serviceName = "jgserver1"; string serviceName = "server1";
if (args.Length == 1)
{
serviceName = args[0];
}
using (var c = AmbrosiaFactory.Deploy<IServer>(serviceName, new Server(), receivePort, sendPort)) using (var c = AmbrosiaFactory.Deploy<IServer>(serviceName, new Server(), receivePort, sendPort))
{ {
Thread.Sleep(14 * 24 * 3600 * 1000); Thread.Sleep(14 * 24 * 3600 * 1000);