|
| 1 | +// This source code is dual-licensed under the Apache License, version |
| 2 | +// 2.0, and the Mozilla Public License, version 1.1. |
| 3 | +// |
| 4 | +// The APL v2.0: |
| 5 | +// |
| 6 | +//--------------------------------------------------------------------------- |
| 7 | +// Copyright (C) 2007-2014 GoPivotal, Inc. |
| 8 | +// |
| 9 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | +// you may not use this file except in compliance with the License. |
| 11 | +// You may obtain a copy of the License at |
| 12 | +// |
| 13 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | +// |
| 15 | +// Unless required by applicable law or agreed to in writing, software |
| 16 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | +// See the License for the specific language governing permissions and |
| 19 | +// limitations under the License. |
| 20 | +//--------------------------------------------------------------------------- |
| 21 | +// |
| 22 | +// The MPL v1.1: |
| 23 | +// |
| 24 | +//--------------------------------------------------------------------------- |
| 25 | +// The contents of this file are subject to the Mozilla Public License |
| 26 | +// Version 1.1 (the "License"); you may not use this file except in |
| 27 | +// compliance with the License. You may obtain a copy of the License |
| 28 | +// at http://www.mozilla.org/MPL/ |
| 29 | +// |
| 30 | +// Software distributed under the License is distributed on an "AS IS" |
| 31 | +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See |
| 32 | +// the License for the specific language governing rights and |
| 33 | +// limitations under the License. |
| 34 | +// |
| 35 | +// The Original Code is RabbitMQ. |
| 36 | +// |
| 37 | +// The Initial Developer of the Original Code is GoPivotal, Inc. |
| 38 | +// Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. |
| 39 | +//--------------------------------------------------------------------------- |
| 40 | + |
| 41 | +namespace RabbitMQ.Client |
| 42 | +{ |
| 43 | + ///<summary>Represents Basic.GetOk responses from the server.</summary> |
| 44 | + ///<remarks> |
| 45 | + /// Basic.Get either returns an instance of this class, or null if |
| 46 | + /// a Basic.GetEmpty was received. |
| 47 | + ///</remarks> |
| 48 | + public class BasicGetResult |
| 49 | + { |
| 50 | + private ulong m_deliveryTag; |
| 51 | + private bool m_redelivered; |
| 52 | + private string m_exchange; |
| 53 | + private string m_routingKey; |
| 54 | + private uint m_messageCount; |
| 55 | + private IBasicProperties m_basicProperties; |
| 56 | + private byte[] m_body; |
| 57 | + |
| 58 | + ///<summary>Sets the new instance's properties from the |
| 59 | + ///arguments passed in.</summary> |
| 60 | + public BasicGetResult(ulong deliveryTag, |
| 61 | + bool redelivered, |
| 62 | + string exchange, |
| 63 | + string routingKey, |
| 64 | + uint messageCount, |
| 65 | + IBasicProperties basicProperties, |
| 66 | + byte[] body) |
| 67 | + { |
| 68 | + m_deliveryTag = deliveryTag; |
| 69 | + m_redelivered = redelivered; |
| 70 | + m_exchange = exchange; |
| 71 | + m_routingKey = routingKey; |
| 72 | + m_messageCount = messageCount; |
| 73 | + m_basicProperties = basicProperties; |
| 74 | + m_body = body; |
| 75 | + } |
| 76 | + |
| 77 | + ///<summary>Retrieve the delivery tag for this message. See also IModel.BasicAck.</summary> |
| 78 | + public ulong DeliveryTag { get { return m_deliveryTag; } } |
| 79 | + ///<summary>Retrieve the redelivered flag for this message.</summary> |
| 80 | + public bool Redelivered { get { return m_redelivered; } } |
| 81 | + ///<summary>Retrieve the exchange this message was published to.</summary> |
| 82 | + public string Exchange { get { return m_exchange; } } |
| 83 | + ///<summary>Retrieve the routing key with which this message was published.</summary> |
| 84 | + public string RoutingKey { get { return m_routingKey; } } |
| 85 | + |
| 86 | + ///<summary>Retrieve the number of messages pending on the |
| 87 | + ///queue, excluding the message being delivered.</summary> |
| 88 | + ///<remarks> |
| 89 | + /// Note that this figure is indicative, not reliable, and can |
| 90 | + /// change arbitrarily as messages are added to the queue and |
| 91 | + /// removed by other clients. |
| 92 | + ///</remarks> |
| 93 | + public uint MessageCount { get { return m_messageCount; } } |
| 94 | + |
| 95 | + ///<summary>Retrieves the Basic-class content header properties for this message.</summary> |
| 96 | + public IBasicProperties BasicProperties { get { return m_basicProperties; } } |
| 97 | + ///<summary>Retrieves the body of this message.</summary> |
| 98 | + public byte[] Body { get { return m_body; } } |
| 99 | + } |
| 100 | +} |
0 commit comments