public void BindList() { BP.WF.Node nd = new BP.WF.Node(this.FK_Node); Listens ens = new Listens(); ens.Retrieve(ListenAttr.FK_Node, this.FK_Node); if (ens.Count == 0) { this.Response.Redirect("Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New", true); return; } this.Pub1.AddTable("width=80%"); this.Pub1.AddCaptionLeft("设置收听:" + nd.Name + "- <a href='Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New' >新建</a>"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("当前节点"); this.Pub1.AddTDTitle("收听节点"); this.Pub1.AddTDTitle("操作"); this.Pub1.AddTREnd(); foreach (Listen en in ens) { this.Pub1.AddTR(); this.Pub1.AddTD(nd.Name); this.Pub1.AddTD(en.Nodes); // this.Pub1.AddTD(en.Title); //this.Pub1.AddTD(en.Doc); this.Pub1.AddTD("<a href='Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New&RefOID=" + en.OID + "'>删除-编辑</a>"); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
public ServerOptions AddListen(string host, int port) { ListenHandler listenOptions = new ListenHandler { Host = host, Port = port }; Listens.Add(listenOptions); return(this); }
protected override void OnReceive(object message) { message.Match() .With <Listen>(listen => Listens.ContinueWith <NoSerializationVerificationNeeded>(listens => { if (listens.IsFaulted) { return(new ListensFailure(listen.AddressesPromise, listens.Exception)); } else { return(new ListensResult(listen.AddressesPromise, listens.Result)); } }, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.AttachedToParent) .PipeTo(Self)) .With <ListensResult>(listens => { _transportMapping = (from mapping in listens.Results group mapping by mapping.Item1.Address into g select new { address = g.Key, transports = g.ToList() }).Select(x => { if (x.transports.Count > 1) { throw new RemoteTransportException( string.Format("There are more than one transports listening on local address {0}", x.address)); } return(new KeyValuePair <Address, AkkaProtocolTransport>(x.address, x.transports.Head().Item1.ProtocolTransport)); }).ToDictionary(x => x.Key, v => v.Value); //Register a listener to each transport and collect mapping to addresses var transportsAndAddresses = listens.Results.Select(x => { x.Item2.SetResult(new ActorAssociationEventListener(Self)); return(x.Item1); }).ToList(); listens.AddressesPromise.SetResult(transportsAndAddresses); }) .With <ListensFailure>(failure => failure.AddressesPromise.SetException(failure.Cause)) .With <InboundAssociation>(ia => Context.System.Scheduler.ScheduleOnce(TimeSpan.FromMilliseconds(10), Self, ia)) .With <ManagementCommand>(mc => Sender.Tell(new ManagementCommandAck(status: false))) .With <StartupFinished>(sf => Context.Become(Accepting)) .With <ShutdownAndFlush>(sf => { Sender.Tell(true); Context.Stop(Self); }); }
public ServerOptions AddListenSSL(string certificateFile, string password, string host, int port = 443) { ListenHandler listenOptions = new ListenHandler { Host = host, Port = port, SSL = true, CertificateFile = certificateFile, CertificatePassword = password }; Listens.Add(listenOptions); return(this); }
public void BindList() { BP.WF.Node nd = new BP.WF.Node(this.FK_Node); Listens ens = new Listens(); ens.Retrieve(ListenAttr.FK_Node, this.FK_Node); if (ens.Count == 0) { this.Response.Redirect("Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New", true); return; } this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'"); this.Pub1.AddTR(); this.Pub1.AddTD("class='GroupTitle' colspan='3'", "设置收听:" + nd.Name + " - <a href='Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New' >新建</a>"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("class='GroupTitle'", "当前节点"); this.Pub1.AddTD("class='GroupTitle'", "收听节点"); this.Pub1.AddTD("class='GroupTitle'", "操作"); this.Pub1.AddTREnd(); foreach (Listen en in ens) { this.Pub1.AddTR(); this.Pub1.AddTD(nd.Name); this.Pub1.AddTD(en.Nodes); this.Pub1.AddTD("<a href='Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New&RefOID=" + en.OID + "' class='easyui-linkbutton' data-options=\"iconCls:'icon-edit'\">编辑</a>"); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
protected override void OnReceive(object message) { message.Match() /* * the first command the EndpointManager receives. * instructs the EndpointManager to fire off its "Listens" command, which starts * up all inbound transports and binds them to specific addresses via configuration. * those results will then be piped back to Remoting, who waits for the results of * listen.AddressPromise. * */ .With <Listen>(listen => Listens.ContinueWith <INoSerializationVerificationNeeded>(listens => { if (listens.IsFaulted) { return(new ListensFailure(listen.AddressesPromise, listens.Exception)); } else { return(new ListensResult(listen.AddressesPromise, listens.Result)); } }, TaskContinuationOptions.ExecuteSynchronously) .PipeTo(Self)) .With <ListensResult>(listens => { _transportMapping = (from mapping in listens.Results group mapping by mapping.Item1.Address into g select new { address = g.Key, transports = g.ToList() }).Select(x => { if (x.transports.Count > 1) { throw new RemoteTransportException( string.Format("There are more than one transports listening on local address {0}", x.address)); } return(new KeyValuePair <Address, AkkaProtocolTransport>(x.address, x.transports.Head().Item1.ProtocolTransport)); }).ToDictionary(x => x.Key, v => v.Value); //Register a listener to each transport and collect mapping to addresses var transportsAndAddresses = listens.Results.Select(x => { x.Item2.SetResult(new ActorAssociationEventListener(Self)); return(x.Item1); }).ToList(); listens.AddressesPromise.SetResult(transportsAndAddresses); }) .With <ListensFailure>(failure => failure.AddressesPromise.SetException(failure.Cause)) // defer the inbound association until we can enter "Accepting" behavior .With <InboundAssociation>(ia => Context.System.Scheduler.ScheduleTellOnce(TimeSpan.FromMilliseconds(10), Self, ia, Self)) .With <ManagementCommand>(mc => Sender.Tell(new ManagementCommandAck(status: false))) // transports are all started. Ready to start accepting inbound associations. .With <StartupFinished>(sf => Context.Become(Accepting)) .With <ShutdownAndFlush>(sf => { Sender.Tell(true); Context.Stop(Self); }); }