private void StartTranspile() { this.AccountHolder = new SMQAccountHolder(); var currentSSoTmeKey = SSOTMEKey.GetSSoTmeKey(this.runAs); result = null; this.AccountHolder.ReplyTo += AccountHolder_ReplyTo; this.AccountHolder.Init(currentSSoTmeKey.EmailAddress, currentSSoTmeKey.Secret); var waitForCook = Task.Factory.StartNew(() => { while (ReferenceEquals(result, null)) { Thread.Sleep(100); } }); waitForCook.Wait(this.waitTimeout); if (ReferenceEquals(result, null)) { result = AccountHolder.CreatePayload(); result.Exception = new TimeoutException("Timed out waiting for cook"); } result.SSoTmeProject = this.SSoTmeProject; }
private void AccountHolder_ReplyTo(object sender, SassyMQ.Lib.RabbitMQ.PayloadEventArgs <SSOTMEPayload> e) { if (e.Payload.IsLexiconTerm(LexiconTermEnum.accountholder_ping_ssotmecoordinator)) { CoordinatorProxy = new DMProxy(e.Payload.DirectMessageQueue); Console.WriteLine("Got ping response"); var payload = AccountHolder.CreatePayload(); payload.SaveCLIOptions(this); payload.TranspileRequest = new TranspileRequest(); payload.TranspileRequest.ZippedInputFileSet = this.inputFileSetXml.Zip(); payload.CLIInputFileContents = String.Empty; AccountHolder.AccountHolderCommandLineTranspile(payload, CoordinatorProxy); } else if (e.Payload.IsLexiconTerm(LexiconTermEnum.accountholder_commandlinetranspile_ssotmecoordinator) || (e.Payload.IsLexiconTerm(LexiconTermEnum.accountholder_requesttranspile_ssotmecoordinator))) { result = e.Payload; } }