private void OnMessageReceived(DuplexAmqpLink link, AmqpMessage amqpMessage)
 {
     try
     {
         Fx.AssertAndThrow(amqpMessage.BodyType == SectionFlag.Data, "Only 'Data' type is supported!");
         Data datum = null;
         foreach (Data dataBody in amqpMessage.DataBody)
         {
             Fx.AssertAndThrow(datum == null, "Serialization of AMQP messages with multiple body frames is not implemented.");
             datum = dataBody;
         }
         ArraySegment <byte> value   = (ArraySegment <byte>)datum.Value;
         Message             message = this.client.encoder.ReadMessage(value, this.client.bufferManager);
         this.receivedMessages.EnqueueAndDispatch(message);
         amqpMessage.Link.DisposeDelivery(amqpMessage, true, AmqpConstants.AcceptedOutcome);
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         Fx.Exception.TraceHandled(exception, "AmqpRelayedListenerChannel.OnMessageReceived", null);
     }
 }
Exemplo n.º 2
0
        private void OnTokenRenewed(object sender, AmqpRelay.TokenEventArgs args)
        {
            DuplexAmqpLink duplexAmqpLink = this.link;

            if (duplexAmqpLink != null)
            {
                Fields field = new Fields()
                {
                    { AmqpConstants.SimpleWebTokenPropertyName, args.Token.Token }
                };
                duplexAmqpLink.SendProperties(field);
            }
        }