示例#1
0
 ///<summary>Called by HandleCall and HandleCast when a
 ///"jms/stream-message" request is received.</summary>
 ///<remarks>
 ///<para>
 /// The args array contains the values decoded by HandleCall
 /// or HandleCast.
 ///</para>
 ///<para>
 /// The replyWriter parameter will be null if we were called
 /// from HandleCast, in which case a reply is not expected or
 /// possible, or non-null if we were called from
 /// HandleCall. Use the methods of replyWriter in this case to
 /// assemble your reply, which will be sent back to the remote
 /// caller.
 ///</para>
 ///<para>
 /// This default implementation does nothing, which
 /// effectively sends back an empty reply to any and all
 /// remote callers.
 ///</para>
 ///</remarks>
 public virtual void HandleStreamMessageCall(IStreamMessageBuilder replyWriter,
                                             bool isRedelivered,
                                             IBasicProperties requestProperties,
                                             object[] args)
 {
     // Override to do something with the request.
 }
 public override void HandleStreamMessageCall(IStreamMessageBuilder replyWriter,
                                              bool isRedelivered,
                                              IBasicProperties requestProperties,
                                              object[] args)
 {
     Console.Out.WriteLine("AddServer received a {0} request.",
                           isRedelivered ? "redelivered" : "new");
     double sum = 0;
     foreach (double v in args) {
         Console.Out.WriteLine("Adding {0} to {1}, giving {2}.", v, sum, sum + v);
         sum += v;
     }
     Console.Out.WriteLine("The reply is {0}.", sum);
     replyWriter.WriteObject(sum);
 }
示例#3
0
        public override void HandleStreamMessageCall(IStreamMessageBuilder replyWriter,
                                                     bool isRedelivered,
                                                     IBasicProperties requestProperties,
                                                     object[] args)
        {
            Console.Out.WriteLine("AddServer received a {0} request.",
                                  isRedelivered ? "redelivered" : "new");
            double sum = 0;

            foreach (double v in args)
            {
                Console.Out.WriteLine("Adding {0} to {1}, giving {2}.", v, sum, sum + v);
                sum += v;
            }
            Console.Out.WriteLine("The reply is {0}.", sum);
            replyWriter.WriteObject(sum);
        }
 public override void HandleStreamMessageCall(IStreamMessageBuilder replyWriter,
                                              bool isRedelivered,
                                              IBasicProperties requestProperties,
                                              object[] args)
 {
     Console.Out.WriteLine("ShutdownableServer received a {0} request.",
                           isRedelivered ? "redelivered" : "new");
     if ((double) args[0] == 0) {
         Console.Out.WriteLine("Shutting down immediately.");
         Close();
         replyWriter.WriteObject("Shut down immediately");
     } else {
         Timer t = new Timer((int) (((double) args[0]) * 1000));
         t.Elapsed += new ElapsedEventHandler(OnTimeout);
         t.Enabled = true;
         replyWriter.WriteObject("Will shut down in " + args[0] + " seconds");
     }
 }
示例#5
0
 public override void HandleStreamMessageCall(IStreamMessageBuilder replyWriter,
                                              bool isRedelivered,
                                              IBasicProperties requestProperties,
                                              object[] args)
 {
     Console.Out.WriteLine("ShutdownableServer received a {0} request.",
                           isRedelivered ? "redelivered" : "new");
     if ((double)args[0] == 0)
     {
         Console.Out.WriteLine("Shutting down immediately.");
         Close();
         replyWriter.WriteObject("Shut down immediately");
     }
     else
     {
         Timer t = new Timer((int)(((double)args[0]) * 1000));
         t.Elapsed += new ElapsedEventHandler(OnTimeout);
         t.Enabled  = true;
         replyWriter.WriteObject("Will shut down in " + args[0] + " seconds");
     }
 }
 ///<summary>Called by HandleCall and HandleCast when a
 ///"jms/stream-message" request is received.</summary>
 ///<remarks>
 ///<para>
 /// The args array contains the values decoded by HandleCall
 /// or HandleCast.
 ///</para>
 ///<para>
 /// The replyWriter parameter will be null if we were called
 /// from HandleCast, in which case a reply is not expected or
 /// possible, or non-null if we were called from
 /// HandleCall. Use the methods of replyWriter in this case to
 /// assemble your reply, which will be sent back to the remote
 /// caller.
 ///</para>
 ///<para>
 /// This default implementation does nothing, which
 /// effectively sends back an empty reply to any and all
 /// remote callers.
 ///</para>
 ///</remarks>
 public virtual void HandleStreamMessageCall(IStreamMessageBuilder replyWriter,
                                             bool isRedelivered,
                                             IBasicProperties requestProperties,
                                             object[] args)
 {
     // Override to do something with the request.
 }