diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2011-05-27 15:44:23 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2011-05-27 15:44:23 +0000 |
commit | 66765100f4257159622cefe57bed50125a5ad017 (patch) | |
tree | a88ee23bb194eb91f0ebb2d9b23ff423e3ea8e37 /qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs | |
parent | 1aeaa7b16e5ce54f10c901d75c4d40f9f88b9db6 (diff) | |
parent | 88b98b2f4152ef59a671fad55a0d08338b6b78ca (diff) | |
download | qpid-python-rajith_jms_client.tar.gz |
Creating a branch for experimenting with some ideas for JMS client.rajith_jms_client
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/rajith_jms_client@1128369 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs')
-rw-r--r-- | qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs b/qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs new file mode 100644 index 0000000000..86b5405707 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs @@ -0,0 +1,79 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +using System; + +namespace Apache.Qpid.Messaging +{ + /// <summary> + /// Describes an object that can be used to receive (consume) + /// messages from an AMQP queue. + /// </summary> + /// <remarks> + /// Consumers are created using either + /// <see cref="IChannel.CreateConsumer"/> or using + /// the builder pattern (preferred) with + /// <see cref="IChannel.CreateConsumerBuilder"/>. + /// + /// <para> + /// Consumers offer two different ways of receiving messages: + /// You can attach a delegate to the <see cref="OnMessage"/> + /// event and be notified when a message arrives, or you can + /// use the <see cref="Receive"/> and <see cref="ReceiveNoWait"/> + /// methods to control when you receive messages. Be aware that you can use + /// one or the other, but not both at the same time. + /// </para> + /// <para> + /// Regardless of which method you choose, the prefetch settings + /// specified when creating the channel will still control when messages + /// are actually received from the AMQP broker. Any messages that arrive + /// between the prefetch window will be queued by the channel + /// until they can be delivered to the consumer (either though the event + /// or until the consumer actively calls <see cref="Receive"/>). + /// </para> + /// </remarks> + public interface IMessageConsumer : IDisposable, ICloseable + { + /// <summary> + /// Fired when a message is received from the broker by the consumer + /// </summary> + MessageReceivedDelegate OnMessage { get; set; } + + /// <summary> + /// Wait infinitely for a message to be received from the broker + /// </summary> + /// <returns>The message received</returns> + IMessage Receive(); + + /// <summary> + /// Wait the specified time until a message is receive from the broker + /// </summary> + /// <param name="delay">Maximum number of milliseconds to wait for a message</param> + /// <returns>The message received, or null if the timeout expires</returns> + IMessage Receive(long delay); + + /// <summary> + /// Return a message if one is already available in the channel. + /// Does not wait for one to be received from the broker. + /// </summary> + /// <returns>The message, if it was available, otherwise null</returns> + IMessage ReceiveNoWait(); + } +} |