/// <summary> /// Constructor. /// </summary> public DirectCallSpeedTest() : base(true) { pool = new Matrix.Framework.SuperPool.Core.SuperPool(); client1 = new SuperPoolClient("c1", this); client2 = new SuperPoolClient("c2", this); bool result = pool.AddClient(client1); result = pool.AddClient(client2); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.Text += " - " + this.ClientName; // The steps here are exactly the same, as in server side, only difference is the ClientMessageBus // instead of ServerMessageBus. Since this is the only difference, all the remaining source code // is completely independent of whether its a server or a client side. //// Assign the default tracer, to provide system wide tracing functionality. //SystemMonitor.AssignTracer(new Tracer()); //this.tracerControl1.Tracer = SystemMonitor.Tracer; IPEndPoint endPoint = new IPEndPoint(IPAddress.Loopback, ServerMessageBus.DefaultPort); // Create the underlying (client) message bus, that takes care of transporting the // actual communication messages; the message bus TCP communication is created // at default port, at localhost. ClientMessageBus messageBus = new ClientMessageBus(endPoint, this.ClientName, null); // Initialize the super pool with this message bus. _pool = new Matrix.Framework.SuperPool.Core.SuperPool(messageBus); // Create the client that will server as a connection between this // class and the super pool and add the client to the pool. _poolClient = new SuperPoolClient("Client." + this.ClientName, this); _pool.AddClient(_poolClient); // Use this to assign a specific execution strategy to a given client. // _poolClient.SetupExecutionStrategy(new FrameworkThreadPoolExecutionStrategy()); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); //// [Optional] Assign the default tracer, to provide system wide tracing functionality. //SystemMonitor.AssignTracer(new Tracer()); //this.tracerControl1.Tracer = SystemMonitor.Tracer; // Create the underlying (server) message bus and put the pool on it. ServerMessageBus messageBus = new ServerMessageBus("Server", null, null); _pool = new Matrix.Framework.SuperPool.Core.SuperPool(messageBus); // Create the client that will server as a connection between this // class and the super pool and add the client to the pool. _poolClient = new SuperPoolClient("Server", this); _pool.AddClient(_poolClient); // Finally subscribe to the event of having a client added to the bus/pool. _pool.MessageBus.ClientAddedEvent += new MessageBus.Core.MessageBusClientUpdateDelegate(MessageBus_ClientAddedEvent); messageBus.ClientRemovedEvent += (bus, id, remove) => { this.Invoke(new GeneralHelper.GenericDelegate <string>(Report), "Client removed " + id.ToString()); }; }
/// <summary> /// Creates a new client, assigns it with a custom execution strategy and adds it to the super pool. /// </summary> /// <param name="superPool"></param> public void Demonstrate(Matrix.Framework.SuperPool.Core.SuperPool superPool) { SuperPoolClient client = new SuperPoolClient("Client", this); client.SetupExecutionStrategy(new CustomExecutionStrategy()); superPool.AddClient(client); }
public void ShowMe() { // Create the pool. Matrix.Framework.SuperPool.Core.SuperPool pool = new Matrix.Framework.SuperPool.Core.SuperPool("MyPool"); // Create component 1 and 2. MyComponent component1 = new MyComponent(); MyComponent component2 = new MyComponent(); // Add them both to the pool. pool.AddClient(component1.Client); pool.AddClient(component2.Client); // Request some work: component1.RequestSomeWork(component2.Client.Id); // Or we can also do it directly like this (although the previous is often a more suitable aproach) component1.Client.Call<ISomeInterface>(component2.Client.Id).DoSomeWork(); }
public void ShowMe() { // Create the pool. Matrix.Framework.SuperPool.Core.SuperPool pool = new Matrix.Framework.SuperPool.Core.SuperPool("MyPool"); // Create component 1 and 2. MyComponent component1 = new MyComponent(); MyComponent component2 = new MyComponent(); // Add them both to the pool. pool.AddClient(component1.Client); pool.AddClient(component2.Client); // Request some work: component1.RequestSomeWork(component2.Client.Id); // Or we can also do it directly like this (although the previous is often a more suitable aproach) component1.Client.Call <ISomeInterface>(component2.Client.Id).DoSomeWork(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); //// [Optional] Assign the default tracer, to provide system wide tracing functionality. //SystemMonitor.AssignTracer(new Tracer()); //this.tracerControl1.Tracer = SystemMonitor.Tracer; // Create the underlying (server) message bus and put the pool on it. ServerMessageBus messageBus = new ServerMessageBus("Server", null, null); _pool = new Matrix.Framework.SuperPool.Core.SuperPool(messageBus); // Create the client that will server as a connection between this // class and the super pool and add the client to the pool. _poolClient = new SuperPoolClient("Server", this); _pool.AddClient(_poolClient); // Finally subscribe to the event of having a client added to the bus/pool. _pool.MessageBus.ClientAddedEvent += new MessageBus.Core.MessageBusClientUpdateDelegate(MessageBus_ClientAddedEvent); messageBus.ClientRemovedEvent += (bus, id, remove) => { this.Invoke(new GeneralHelper.GenericDelegate<string>(Report), "Client removed " + id.ToString()); }; }