/* * 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.NMS { /// /// Represents a single unit of work on an IConnection. /// So the ISession can be used to perform transactional receive and sends /// public interface ISession : IDisposable { /// /// Creates a producer of messages /// IMessageProducer CreateProducer(); /// /// Creates a producer of messages on a given destination /// IMessageProducer CreateProducer(IDestination destination); /// /// Creates a consumer of messages on a given destination /// IMessageConsumer CreateConsumer(IDestination destination); /// /// Creates a consumer of messages on a given destination with a selector /// IMessageConsumer CreateConsumer(IDestination destination, string selector); /// /// Creates a consumer of messages on a given destination with a selector /// IMessageConsumer CreateConsumer(IDestination destination, string selector, bool noLocal); /// /// Creates a named durable consumer of messages on a given destination with a selector /// IMessageConsumer CreateDurableConsumer(ITopic destination, string name, string selector, bool noLocal); /// /// Deletes a durable consumer created with CreateDurableConsumer(). /// /// Name of the durable consumer void DeleteDurableConsumer(string name); /// /// Creates a QueueBrowser object to peek at the messages on the specified queue. /// /// /// A /// /// /// A /// /// /// If the Prodiver does not support creation of Queue Browsers. /// IQueueBrowser CreateBrowser(IQueue queue); /// /// Creates a QueueBrowser object to peek at the messages on the specified queue /// using a message selector. /// /// /// A /// /// /// A /// /// /// A /// /// /// If the Prodiver does not support creation of Queue Browsers. /// IQueueBrowser CreateBrowser(IQueue queue, string selector); /// /// Returns the queue for the given name /// IQueue GetQueue(string name); /// /// Returns the topic for the given name /// ITopic GetTopic(string name); /// /// Creates a temporary queue /// ITemporaryQueue CreateTemporaryQueue(); /// /// Creates a temporary topic /// ITemporaryTopic CreateTemporaryTopic(); /// /// Delete a destination (Queue, Topic, Temp Queue, Temp Topic). /// void DeleteDestination(IDestination destination); // Factory methods to create messages /// /// Creates a new message with an empty body /// IMessage CreateMessage(); /// /// Creates a new text message with an empty body /// ITextMessage CreateTextMessage(); /// /// Creates a new text message with the given body /// ITextMessage CreateTextMessage(string text); /// /// Creates a new Map message which contains primitive key and value pairs /// IMapMessage CreateMapMessage(); /// /// Creates a new Object message containing the given .NET object as the body /// IObjectMessage CreateObjectMessage(object body); /// /// Creates a new binary message /// IBytesMessage CreateBytesMessage(); /// /// Creates a new binary message with the given body /// IBytesMessage CreateBytesMessage(byte[] body); /// /// Creates a new stream message /// IStreamMessage CreateStreamMessage(); /// /// Closes the session. There is no need to close the producers and consumers /// of a closed session. /// void Close(); #region Transaction methods /// /// If this is a transactional session then commit all message /// send and acknowledgements for producers and consumers in this session /// void Commit(); /// /// If this is a transactional session then rollback all message /// send and acknowledgements for producers and consumers in this session /// void Rollback(); #endregion #region Attributes TimeSpan RequestTimeout { get; set; } bool Transacted { get; } AcknowledgementMode AcknowledgementMode { get; } #endregion } }