Esempio n. 1
0
 public QueueBatchConsumer(string source, ISyncQueueDispatcher disp, String readLabelReformatExpression)
     : base(String.Format("QueueBatchConsumer[{0}]", source))
 {
     srcq = new OpaqueMessageQueue(readLabelReformatExpression)
     {
         Name = source
     };
     dst = disp;
 }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            var omq = new OpaqueMessageQueue(textBox2.Text)
            {
                Name = comboBox1.Text
            };
            var om = omq.Peek();

            if (om == null)
            {
                MessageBox.Show("No hay datos!");
                return;
            }
            MessageBox.Show(String.Format("Label: {0} Length: {1} OpaqueBody: {2}", om.Label, om.Length,
                                          Convert.ToBase64String(om.OpaqueBody)));
        }
Esempio n. 3
0
        public static Result Dispatch(OpaqueMessageQueue Source, IAsyncQueueDispatcher Destination)
        {
            var msg = Source.WindowPeek(0);

            if (msg == null)
            {
                return(Result.SourceEmpty);
            }
            if (!Destination.CanPush)
            {
                return(Result.DestinationLocked);
            }
            var state = new DispatchState {
                LookupId = msg.Id, Source = Source
            };

            if (!Destination.BeginPush(msg, AsyncDispatched, state))
            {
                return(Result.DestinationFailure);
            }
            return(Result.Deferred);
        }
Esempio n. 4
0
 private bool CompleteChunkReceive(Version Version, Stream Stream, int Size)
 {
     try
     {
         TRACE("Chunk Recibido: {0}, total={1}", source_endpoint, Size);
         OpaqueMessage om;
         if (Version == Version.UIQP_1_2)
         {
             var obj = GZip.DecompressAndDeserialize(Stream);
             om = (OpaqueMessage)obj;
         }
         else
         {
             var formatter = new BinaryFormatter();
             var obj       = formatter.Deserialize(Stream);
             om = (OpaqueMessage)obj;
         }
         if (om == null)
         {
             TRACE("recibi un mensaje y no puede convertir a opaco.");
             SendOpaqueMessageAck(om, OpaqueMessageAck.Responses.DataError);
             return(false);
         }
         var queue = new OpaqueMessageQueue("")
         {
             Name = om.DestinationQueueName
         };
         queue.Push(om);
         SendOpaqueMessageAck(om, OpaqueMessageAck.Responses.Enqueued);
         TRACE("Mensaje encolado en {0}", om.DestinationQueueName);
         return(true);
     } catch (Exception e)
     {
         TRACE("recibi un mensaje y no puede convertir a opaco.");
         T.EXCEPTION(e, "TcpInterQueueAcceptor.CompleteChunkReceive");
         return(false);
     }
 }
Esempio n. 5
0
        public static Result Dispatch(OpaqueMessageQueue Source, ISyncQueueDispatcher Destination)
        {
            var msg = Source.Peek();

            if (msg == null)
            {
                return(Result.SourceEmpty);
            }
            if (!Destination.CanPush)
            {
                return(Result.DestinationLocked);
            }
            if (!Destination.BeginPush(msg))
            {
                return(Result.DestinationFailure);
            }
            if (Destination.WaitCompleted(msg))
            {
                Source.Pop(msg.Id, false);
                return(Result.Dispatched);
            }
            return(Result.DestinationFailure);
        }