/// <summary> /// This method shows a few ways to perform calls. /// </summary> public void PerformCalls(ISuperPoolClient otherClient) { ISample otherSource = otherClient.Source as ISample; string result; ComponentId recipientId = otherClient.Id; ComponentId[] recipientsIds = new ComponentId[] { otherClient.Id }; AsyncCallResultDelegate asyncDelegate = delegate(ISuperPoolClient clientInstance, AsyncResultParams param) { }; // Strongly Coupled Synchronous Invocation. // This is the typical, strong coupled way of communication, or invocation. result = otherSource.MyMethod(12); // Decoupled “DirectCall” Invocation (Very fast, Local only) // The closest invocation to the classical strongly coupled approach, this // method is very fast, synchronous, and loosely coupled. client.CallDirectLocal<ISample>(recipientId).MyMethod(12); // Decoupled Synchronous Invocation (Local and remote, Timeout configurable) client.CallSync<ISample>(recipientId).MyMethod(12); // Decoupled Asynchronous Invocation. client.Call<ISample>(recipientId).MyMethod(12); // Decoupled Asynchronous Invocation with Result. client.Call<ISample>(recipientId, asyncDelegate).MyMethod(12); // Decoupled Asynchronous Invocation to Multiple Receivers (Addressed or Non-addressed). client.Call<ISample>(recipientsIds).MyMethod(12); // Addressed client.CallAll<ISample>().MyMethod(12); // Non-addressed }
/// <summary> /// This method shows a few ways to perform calls. /// </summary> public void PerformCalls(ISuperPoolClient otherClient) { ISample otherSource = otherClient.Source as ISample; string result; ComponentId recipientId = otherClient.Id; ComponentId[] recipientsIds = new ComponentId[] { otherClient.Id }; AsyncCallResultDelegate asyncDelegate = delegate(ISuperPoolClient clientInstance, AsyncResultParams param) { }; // Strongly Coupled Synchronous Invocation. // This is the typical, strong coupled way of communication, or invocation. result = otherSource.MyMethod(12); // Decoupled “DirectCall” Invocation (Very fast, Local only) // The closest invocation to the classical strongly coupled approach, this // method is very fast, synchronous, and loosely coupled. client.CallDirectLocal <ISample>(recipientId).MyMethod(12); // Decoupled Synchronous Invocation (Local and remote, Timeout configurable) client.CallSync <ISample>(recipientId).MyMethod(12); // Decoupled Asynchronous Invocation. client.Call <ISample>(recipientId).MyMethod(12); // Decoupled Asynchronous Invocation with Result. client.Call <ISample>(recipientId, asyncDelegate).MyMethod(12); // Decoupled Asynchronous Invocation to Multiple Receivers (Addressed or Non-addressed). client.Call <ISample>(recipientsIds).MyMethod(12); // Addressed client.CallAll <ISample>().MyMethod(12); // Non-addressed }
/// <summary> /// Contructor. /// </summary> public Component(string name) { client = new SuperPoolClient(name, this); }
void asyncResultMethod(ISuperPoolClient clientInstance, AsyncResultParams param) { // Handle async result. }
void _client_SourceChangedEvent(ISuperPoolClient client, object oldSource, object newSource) { AssignClientSource(newSource); }