Exemplo n.º 1
0
 /// <summary>
 /// Begins an asynchronous operation to push a message to the specified clients (subscribers).
 /// </summary>
 /// <param name="asyncCallback">The AsyncCallback delegate.</param>
 /// <param name="subscribers">Collection of subscribers.</param>
 /// <param name="message">The Message to push to the subscribers.</param>
 /// <returns>An IAsyncResult that references the asynchronous invocation.</returns>
 /// <remarks>
 /// <para>
 /// The Collection of subscribers is a collection of client Id strings.
 /// </para>
 /// <para>
 /// You can create a callback method that implements the AsyncCallback delegate and pass its name to the BeginPushMessageToClients method.
 /// </para>
 /// <para>
 /// Your callback method should invoke the EndPushMessageToClients method. When your application calls EndPushMessageToClients, the system will use a separate thread to execute the specified callback method, and will block on EndPushMessageToClients until the message is pushed successfully or throws an exception.
 /// </para>
 /// </remarks>
 public IAsyncResult BeginPushMessageToClients(AsyncCallback asyncCallback, ICollection subscribers, IMessage message)
 {
     // Create IAsyncResult object identifying the asynchronous operation
     AsyncResultNoResult ar = new AsyncResultNoResult(asyncCallback, new PushData(FluorineContext.Current, subscribers, message));
     // Use a thread pool thread to perform the operation
     dotFlex.Threading.ThreadPoolEx.Global.QueueUserWorkItem(new System.Threading.WaitCallback(OnBeginPushMessageToClients), ar);
     // Return the IAsyncResult to the caller
     return ar;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Begins an asynchronous operation to invoke a service using service call object and channel.
 /// </summary>
 /// <param name="asyncCallback">The AsyncCallback delegate.</param>
 /// <param name="serviceCall">Service call object.</param>
 /// <param name="channel">Channel to use.</param>
 /// <returns>An IAsyncResult that references the asynchronous invocation.</returns>
 /// <remarks>
 /// <para>
 /// You can create a callback method that implements the AsyncCallback delegate and pass its name to the BeginInvoke method.
 /// </para>
 /// <para>
 /// Your callback method should invoke the EndInvoke method. When your application calls BeginInvoke, the system will use a separate thread to execute the specified callback method, and will block on EndInvoke until the client is invoked successfully or throws an exception.
 /// </para>
 /// </remarks>        
 public IAsyncResult BeginInvoke(AsyncCallback asyncCallback, IServiceCall serviceCall, byte channel)
 {
     // Create IAsyncResult object identifying the asynchronous operation
     AsyncResultNoResult ar = new AsyncResultNoResult(asyncCallback, new InvokeData(FluorineContext.Current, serviceCall, channel));
     // Use a thread pool thread to perform the operation
     dotFlex.Threading.ThreadPoolEx.Global.QueueUserWorkItem(new System.Threading.WaitCallback(OnBeginInvoke), ar);
     // Return the IAsyncResult to the caller
     return ar;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Begins an asynchronous operation to invoke clients with parameters and callback.
 /// </summary>
 /// <param name="asyncCallback">The AsyncCallback delegate.</param>
 /// <param name="method">Method name.</param>
 /// <param name="arguments">Invocation parameters passed to the method.</param>
 /// <param name="callback">Callback used to handle return values.</param>
 /// <param name="ignoreSelf">Current client shoud be ignored.</param>
 /// <param name="targetScope">Invoke clients subscribed to the specified Scope.</param>
 /// <returns>An IAsyncResult that references the asynchronous invocation.</returns>
 /// <remarks>
 /// <para>
 /// The <i>asyncCallback</i> delegate identifies the callback invoked when the messages are sent, the <i>callback</i> object identifies the callback handling client responses.
 /// </para>
 /// <para>
 /// You can create a callback method that implements the AsyncCallback delegate and pass its name to the BeginInvokeClients method.
 /// </para>
 /// <para>
 /// Your callback method should invoke the EndInvokeClients method. When your application calls BeginInvokeClients, the system will use a separate thread to execute the specified callback method, and will block on EndInvokeClients until the clients are invoked successfully or throws an exception.
 /// </para>
 /// </remarks>
 protected IAsyncResult BeginInvokeClients(AsyncCallback asyncCallback, string method, object[] arguments, IPendingServiceCallback callback, bool ignoreSelf, IScope targetScope)
 {
     // Create IAsyncResult object identifying the asynchronous operation
     AsyncResultNoResult ar = new AsyncResultNoResult(asyncCallback, new InvokeData(FluorineContext.Current, method, arguments, callback, ignoreSelf, targetScope));
     // Use a thread pool thread to perform the operation
     dotFlex.Threading.ThreadPoolEx.Global.QueueUserWorkItem(new System.Threading.WaitCallback(OnBeginInvokeClients), ar);
     // Return the IAsyncResult to the caller
     return ar;
 }