Implement enhancements for EMS provider.
Fixes [AMQNET-271]. (See https://issues.apache.org/activemq/browse/AMQNET-271)
diff --git a/src/main/csharp/IConnection.cs b/src/main/csharp/IConnection.cs
index 0377083..4ef6196 100644
--- a/src/main/csharp/IConnection.cs
+++ b/src/main/csharp/IConnection.cs
@@ -18,161 +18,153 @@
namespace Apache.NMS
{
- /// <summary>
- /// The mode used to acknowledge messages after they are consumed
- /// </summary>
- public enum AcknowledgementMode
- {
- /// <summary>
- /// With this acknowledgment mode, the session will not
- /// acknowledge receipt of a message since the broker assumes
- /// successful receipt of a message after the onMessage handler
- /// has returned without error.
- /// </summary>
- AutoAcknowledge,
+ /// <summary>
+ /// The mode used to acknowledge messages after they are consumed
+ /// </summary>
+ public enum AcknowledgementMode
+ {
+ /// <summary>
+ /// With this acknowledgment mode, the session will not
+ /// acknowledge receipt of a message since the broker assumes
+ /// successful receipt of a message after the onMessage handler
+ /// has returned without error.
+ /// </summary>
+ AutoAcknowledge,
- /// <summary>
- /// With this acknowledgment mode, the session automatically
- /// acknowledges a client's receipt of a message either when
- /// the session has successfully returned from a call to receive
- /// or when the message listener the session has called to
- /// process the message successfully returns. Acknowlegements
- /// may be delayed in this mode to increase performance at
- /// the cost of the message being redelivered this client fails.
- /// </summary>
- DupsOkAcknowledge,
+ /// <summary>
+ /// With this acknowledgment mode, the session automatically
+ /// acknowledges a client's receipt of a message either when
+ /// the session has successfully returned from a call to receive
+ /// or when the message listener the session has called to
+ /// process the message successfully returns. Acknowlegements
+ /// may be delayed in this mode to increase performance at
+ /// the cost of the message being redelivered this client fails.
+ /// </summary>
+ DupsOkAcknowledge,
- /// <summary>
- /// With this acknowledgment mode, the client acknowledges a
- /// consumed message by calling the message's acknowledge method.
- /// This acknowledgement acknowledges the given message and all
- /// unacknowedged messages that have preceeded it for the session
- /// in which the message was delivered.
- /// </summary>
- ClientAcknowledge,
+ /// <summary>
+ /// With this acknowledgment mode, the client acknowledges a
+ /// consumed message by calling the message's acknowledge method.
+ /// This acknowledgement acknowledges the given message and all
+ /// unacknowedged messages that have preceeded it for the session
+ /// in which the message was delivered.
+ /// </summary>
+ ClientAcknowledge,
- /// <summary>
- /// Messages will be consumed when the transaction commits.
- /// </summary>
- Transactional,
+ /// <summary>
+ /// Messages will be consumed when the transaction commits.
+ /// </summary>
+ Transactional,
- /// <summary>
- /// With this acknowledgment mode, the client acknowledges a
- /// consumed message by calling the message's acknowledge method.
- /// This acknowledgement mode allows the client to acknowledge a
- /// single message. This mode is not required to be supported by
- /// all NMS providers, however the provider should throw an appropriate
- /// exception to indicate that the mode is unsupported.
- /// </summary>
- IndividualAcknowledge
- }
+ /// <summary>
+ /// With this acknowledgment mode, the client acknowledges a
+ /// consumed message by calling the message's acknowledge method.
+ /// This acknowledgement mode allows the client to acknowledge a
+ /// single message. This mode is not required to be supported by
+ /// all NMS providers, however the provider should throw an appropriate
+ /// exception to indicate that the mode is unsupported.
+ /// </summary>
+ IndividualAcknowledge
+ }
- /// <summary>
- /// A delegate that can receive transport level exceptions.
- /// </summary>
- public delegate void ExceptionListener(Exception exception);
+ /// <summary>
+ /// A delegate that can receive transport level exceptions.
+ /// </summary>
+ public delegate void ExceptionListener(Exception exception);
- /// <summary>
- /// A delegate that is used by Fault tolerant NMS Implementation to notify their
- /// clients that the Connection is not currently active to due some error.
- /// </summary>
- public delegate void ConnectionInterruptedListener();
+ /// <summary>
+ /// A delegate that is used by Fault tolerant NMS Implementation to notify their
+ /// clients that the Connection is not currently active to due some error.
+ /// </summary>
+ public delegate void ConnectionInterruptedListener();
- /// <summary>
- /// A delegate that is used by Fault tolerant NMS Implementation to notify their
- /// clients that the Connection that was interrupted has now been restored.
- /// </summary>
- public delegate void ConnectionResumedListener();
-
- /// <summary>
- /// Represents a connection with a message broker
- /// </summary>
- public interface IConnection : IDisposable, IStartable, IStoppable
- {
- /// <summary>
- /// Creates a new session to work on this connection
- /// </summary>
- ISession CreateSession();
+ /// <summary>
+ /// A delegate that is used by Fault tolerant NMS Implementation to notify their
+ /// clients that the Connection that was interrupted has now been restored.
+ /// </summary>
+ public delegate void ConnectionResumedListener();
- /// <summary>
- /// Creates a new session to work on this connection
- /// </summary>
- ISession CreateSession(AcknowledgementMode acknowledgementMode);
+ /// <summary>
+ /// Represents a connection with a message broker
+ /// </summary>
+ public interface IConnection : IDisposable, IStartable, IStoppable
+ {
+ /// <summary>
+ /// Creates a new session to work on this connection
+ /// </summary>
+ ISession CreateSession();
- /// <summary>
- /// Closes the connection.
- /// </summary>
- void Close();
+ /// <summary>
+ /// Creates a new session to work on this connection
+ /// </summary>
+ ISession CreateSession(AcknowledgementMode acknowledgementMode);
- /// <summary>
- /// An asynchronous listener which can be notified if an error occurs
- /// </summary>
- event ExceptionListener ExceptionListener;
+ /// <summary>
+ /// Closes the connection.
+ /// </summary>
+ void Close();
- /// <summary>
- /// An asynchronous listener that is notified when a Fault tolerant connection
- /// has been interrupted.
- /// </summary>
- event ConnectionInterruptedListener ConnectionInterruptedListener;
+ /// <summary>
+ /// An asynchronous listener which can be notified if an error occurs
+ /// </summary>
+ event ExceptionListener ExceptionListener;
- /// <summary>
- /// An asynchronous listener that is notified when a Fault tolerant connection
- /// has been resumed.
- /// </summary>
- event ConnectionResumedListener ConnectionResumedListener;
-
- /// <summary>
- /// A Delegate that is called each time a Message is dispatched to allow the client to do
- /// any necessary transformations on the received message before it is delivered. The
- /// Connection sets the provided delegate instance on each Session it creates which then
- /// passes that along to the Consumers it creates.
- /// </summary>
- ConsumerTransformerDelegate ConsumerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// An asynchronous listener that is notified when a Fault tolerant connection
+ /// has been interrupted.
+ /// </summary>
+ event ConnectionInterruptedListener ConnectionInterruptedListener;
- /// <summary>
- /// A delegate that is called each time a Message is sent from this Producer which allows
- /// the application to perform any needed transformations on the Message before it is sent.
- /// The Connection sets the provided delegate instance on each Session it creates which then
- /// passes that along to the Producer it creates.
- /// </summary>
- ProducerTransformerDelegate ProducerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// An asynchronous listener that is notified when a Fault tolerant connection
+ /// has been resumed.
+ /// </summary>
+ event ConnectionResumedListener ConnectionResumedListener;
- #region Attributes
+ /// <summary>
+ /// A Delegate that is called each time a Message is dispatched to allow the client to do
+ /// any necessary transformations on the received message before it is delivered. The
+ /// Connection sets the provided delegate instance on each Session it creates which then
+ /// passes that along to the Consumers it creates.
+ /// </summary>
+ ConsumerTransformerDelegate ConsumerTransformer { get; set; }
- /// <summary>
- /// The default timeout for network requests.
- /// </summary>
- TimeSpan RequestTimeout { get; set; }
+ /// <summary>
+ /// A delegate that is called each time a Message is sent from this Producer which allows
+ /// the application to perform any needed transformations on the Message before it is sent.
+ /// The Connection sets the provided delegate instance on each Session it creates which then
+ /// passes that along to the Producer it creates.
+ /// </summary>
+ ProducerTransformerDelegate ProducerTransformer { get; set; }
- /// <summary>
- /// The default acknowledgement mode
- /// </summary>
- AcknowledgementMode AcknowledgementMode { get; set; }
+ #region Attributes
- /// <summary>
- /// Sets the unique clienet ID for this connection before Start() or returns the
- /// unique client ID after the connection has started
- /// </summary>
- string ClientId { get; set; }
+ /// <summary>
+ /// The default timeout for network requests.
+ /// </summary>
+ TimeSpan RequestTimeout { get; set; }
+
+ /// <summary>
+ /// The default acknowledgement mode
+ /// </summary>
+ AcknowledgementMode AcknowledgementMode { get; set; }
+
+ /// <summary>
+ /// Sets the unique clienet ID for this connection before Start() or returns the
+ /// unique client ID after the connection has started
+ /// </summary>
+ string ClientId { get; set; }
/// <summary>
/// Get/or set the redelivery policy for this connection.
/// </summary>
IRedeliveryPolicy RedeliveryPolicy { get; set; }
-
- /// <summary>
- /// Gets the Meta Data for the NMS Connection instance.
- /// </summary>
- IConnectionMetaData MetaData{ get; }
- #endregion
- }
+ /// <summary>
+ /// Gets the Meta Data for the NMS Connection instance.
+ /// </summary>
+ IConnectionMetaData MetaData{ get; }
+
+ #endregion
+ }
}
diff --git a/src/main/csharp/IConnectionFactory.cs b/src/main/csharp/IConnectionFactory.cs
index c2956d5..8094185 100644
--- a/src/main/csharp/IConnectionFactory.cs
+++ b/src/main/csharp/IConnectionFactory.cs
@@ -28,7 +28,7 @@
/// Creates a new connection
/// </summary>
IConnection CreateConnection();
-
+
/// <summary>
/// Creates a new connection with the given user name and password
/// </summary>
@@ -39,36 +39,28 @@
/// </summary>
Uri BrokerUri { get; set; }
- /// <summary>
- /// Get/or set the redelivery policy that new IConnection objects are
- /// assigned upon creation.
- /// </summary>
- IRedeliveryPolicy RedeliveryPolicy{ get; set; }
+ /// <summary>
+ /// Get/or set the redelivery policy that new IConnection objects are
+ /// assigned upon creation.
+ /// </summary>
+ IRedeliveryPolicy RedeliveryPolicy { get; set; }
- /// <summary>
- /// A Delegate that is called each time a Message is dispatched to allow the client to do
- /// any necessary transformations on the received message before it is delivered. The
- /// ConnectionFactory sets the provided delegate instance on each Connection instance that
- /// is created from this factory, each connection in turn passes the delegate along to each
- /// Session it creates which then passes that along to the Consumers it creates.
- /// </summary>
- ConsumerTransformerDelegate ConsumerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// A Delegate that is called each time a Message is dispatched to allow the client to do
+ /// any necessary transformations on the received message before it is delivered. The
+ /// ConnectionFactory sets the provided delegate instance on each Connection instance that
+ /// is created from this factory, each connection in turn passes the delegate along to each
+ /// Session it creates which then passes that along to the Consumers it creates.
+ /// </summary>
+ ConsumerTransformerDelegate ConsumerTransformer { get; set; }
- /// <summary>
- /// A delegate that is called each time a Message is sent from this Producer which allows
- /// the application to perform any needed transformations on the Message before it is sent.
- /// The ConnectionFactory sets the provided delegate instance on each Connection instance that
- /// is created from this factory, each connection in turn passes the delegate along to each
- /// Session it creates which then passes that along to the Producers it creates.
- /// </summary>
- ProducerTransformerDelegate ProducerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// A delegate that is called each time a Message is sent from this Producer which allows
+ /// the application to perform any needed transformations on the Message before it is sent.
+ /// The ConnectionFactory sets the provided delegate instance on each Connection instance that
+ /// is created from this factory, each connection in turn passes the delegate along to each
+ /// Session it creates which then passes that along to the Producers it creates.
+ /// </summary>
+ ProducerTransformerDelegate ProducerTransformer { get; set; }
}
}
diff --git a/src/main/csharp/IMessageConsumer.cs b/src/main/csharp/IMessageConsumer.cs
index 4ad781d..be4fdaa 100644
--- a/src/main/csharp/IMessageConsumer.cs
+++ b/src/main/csharp/IMessageConsumer.cs
@@ -21,16 +21,16 @@
/// </summary>
public delegate void MessageListener(IMessage message);
- /// <summary>
- /// A delegate that a client can register that will be called each time a consumer dispatches a message
- /// to the client code to allow the client to Transform a received message from one type to another,
- /// StreamMessage to TextMessage, ObjectMessage to TextMessage containing XML, etc. This allows a
- /// client to create a consumer that will automatically transform a message to a type that the client is
- /// capable of processing or adding additional information to a received message. For messages that do
- /// not need to be processed the client should return null from this method, in this case the original
- /// message will be dispatched to the client.
- /// </summary>
- public delegate IMessage ConsumerTransformerDelegate(ISession session, IMessageConsumer consumer, IMessage message);
+ /// <summary>
+ /// A delegate that a client can register that will be called each time a consumer dispatches a message
+ /// to the client code to allow the client to Transform a received message from one type to another,
+ /// StreamMessage to TextMessage, ObjectMessage to TextMessage containing XML, etc. This allows a
+ /// client to create a consumer that will automatically transform a message to a type that the client is
+ /// capable of processing or adding additional information to a received message. For messages that do
+ /// not need to be processed the client should return null from this method, in this case the original
+ /// message will be dispatched to the client.
+ /// </summary>
+ public delegate IMessage ConsumerTransformerDelegate(ISession session, IMessageConsumer consumer, IMessage message);
/// <summary>
/// A consumer of messages
@@ -41,24 +41,24 @@
/// Waits until a message is available and returns it
/// </summary>
IMessage Receive();
-
+
/// <summary>
/// If a message is available within the timeout duration it is returned otherwise this method returns null
/// </summary>
IMessage Receive(System.TimeSpan timeout);
-
+
/// <summary>
/// If a message is available immediately it is returned otherwise this method returns null
/// </summary>
IMessage ReceiveNoWait();
-
+
/// <summary>
/// An asynchronous listener which can be used to consume messages asynchronously
/// </summary>
event MessageListener Listener;
/// <summary>
- /// Closes the message consumer.
+ /// Closes the message consumer.
/// </summary>
/// <remarks>
/// Clients should close message consumers them when they are not needed.
@@ -67,17 +67,13 @@
/// </remarks>
void Close();
- /// <summary>
- /// A Delegate that is called each time a Message is dispatched to allow the client to do
- /// any necessary transformations on the received message before it is delivered.
- /// </summary>
- ConsumerTransformerDelegate ConsumerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// A Delegate that is called each time a Message is dispatched to allow the client to do
+ /// any necessary transformations on the received message before it is delivered.
+ /// </summary>
+ ConsumerTransformerDelegate ConsumerTransformer { get; set; }
- }
+ }
}
diff --git a/src/main/csharp/IMessageProducer.cs b/src/main/csharp/IMessageProducer.cs
index b009f39..c72d488 100644
--- a/src/main/csharp/IMessageProducer.cs
+++ b/src/main/csharp/IMessageProducer.cs
@@ -18,16 +18,16 @@
namespace Apache.NMS
{
- /// <summary>
- /// A delegate that a client can register that will be called each time a Producer's send method is
- /// called to allow the client to Transform a sent message from one type to another, StreamMessage to
- /// TextMessage, ObjectMessage to TextMessage containing XML, etc. This allows a client to create a
- /// producer that will automatically transform a message to a type that some receiving client is
- /// capable of processing or adding additional information to a sent message such as additional message
- /// headers, etc. For messages that do not need to be processed the client should return null from
- /// this method, in this case the original message will be sent.
- /// </summary>
- public delegate IMessage ProducerTransformerDelegate(ISession session, IMessageProducer producer, IMessage message);
+ /// <summary>
+ /// A delegate that a client can register that will be called each time a Producer's send method is
+ /// called to allow the client to Transform a sent message from one type to another, StreamMessage to
+ /// TextMessage, ObjectMessage to TextMessage containing XML, etc. This allows a client to create a
+ /// producer that will automatically transform a message to a type that some receiving client is
+ /// capable of processing or adding additional information to a sent message such as additional message
+ /// headers, etc. For messages that do not need to be processed the client should return null from
+ /// this method, in this case the original message will be sent.
+ /// </summary>
+ public delegate IMessage ProducerTransformerDelegate(ISession session, IMessageProducer producer, IMessage message);
/// <summary>
/// An object capable of sending messages to some destination
@@ -59,15 +59,11 @@
/// </summary>
void Close();
- /// <summary>
- /// A delegate that is called each time a Message is sent from this Producer which allows
- /// the application to perform any needed transformations on the Message before it is sent.
- /// </summary>
- ProducerTransformerDelegate ProducerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// A delegate that is called each time a Message is sent from this Producer which allows
+ /// the application to perform any needed transformations on the Message before it is sent.
+ /// </summary>
+ ProducerTransformerDelegate ProducerTransformer { get; set; }
MsgDeliveryMode DeliveryMode { get; set; }
diff --git a/src/main/csharp/ISession.cs b/src/main/csharp/ISession.cs
index b12f4dc..123be91 100644
--- a/src/main/csharp/ISession.cs
+++ b/src/main/csharp/ISession.cs
@@ -23,7 +23,7 @@
/// So the ISession can be used to perform transactional receive and sends
/// </summary>
public interface ISession : IDisposable
- {
+ {
/// <summary>
/// Creates a producer of messages
/// </summary>
@@ -60,38 +60,38 @@
/// <param name="name">Name of the durable consumer</param>
void DeleteDurableConsumer(string name);
- /// <summary>
- /// Creates a QueueBrowser object to peek at the messages on the specified queue.
- /// </summary>
- /// <param name="queue">
- /// A <see cref="IQueue"/>
- /// </param>
- /// <returns>
- /// A <see cref="IQueueBrowser"/>
- /// </returns>
- /// <exception cref="System.NotSupportedException">
- /// If the Prodiver does not support creation of Queue Browsers.
- /// </exception>
- IQueueBrowser CreateBrowser(IQueue queue);
-
- /// <summary>
- /// Creates a QueueBrowser object to peek at the messages on the specified queue
- /// using a message selector.
- /// </summary>
- /// <param name="queue">
- /// A <see cref="IQueue"/>
- /// </param>
- /// <param name="selector">
- /// A <see cref="System.String"/>
- /// </param>
- /// <returns>
- /// A <see cref="IQueueBrowser"/>
- /// </returns>
- /// <exception cref="System.NotSupportedException">
- /// If the Prodiver does not support creation of Queue Browsers.
- /// </exception>
- IQueueBrowser CreateBrowser(IQueue queue, string selector);
-
+ /// <summary>
+ /// Creates a QueueBrowser object to peek at the messages on the specified queue.
+ /// </summary>
+ /// <param name="queue">
+ /// A <see cref="IQueue"/>
+ /// </param>
+ /// <returns>
+ /// A <see cref="IQueueBrowser"/>
+ /// </returns>
+ /// <exception cref="System.NotSupportedException">
+ /// If the Prodiver does not support creation of Queue Browsers.
+ /// </exception>
+ IQueueBrowser CreateBrowser(IQueue queue);
+
+ /// <summary>
+ /// Creates a QueueBrowser object to peek at the messages on the specified queue
+ /// using a message selector.
+ /// </summary>
+ /// <param name="queue">
+ /// A <see cref="IQueue"/>
+ /// </param>
+ /// <param name="selector">
+ /// A <see cref="System.String"/>
+ /// </param>
+ /// <returns>
+ /// A <see cref="IQueueBrowser"/>
+ /// </returns>
+ /// <exception cref="System.NotSupportedException">
+ /// If the Prodiver does not support creation of Queue Browsers.
+ /// </exception>
+ IQueueBrowser CreateBrowser(IQueue queue, string selector);
+
/// <summary>
/// Returns the queue for the given name
/// </summary>
@@ -165,27 +165,19 @@
/// </summary>
void Close();
- /// <summary>
- /// A Delegate that is called each time a Message is dispatched to allow the client to do
- /// any necessary transformations on the received message before it is delivered.
- /// The Session instance sets the delegate on each Consumer it creates.
- /// </summary>
- ConsumerTransformerDelegate ConsumerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// A Delegate that is called each time a Message is dispatched to allow the client to do
+ /// any necessary transformations on the received message before it is delivered.
+ /// The Session instance sets the delegate on each Consumer it creates.
+ /// </summary>
+ ConsumerTransformerDelegate ConsumerTransformer { get; set; }
- /// <summary>
- /// A delegate that is called each time a Message is sent from this Producer which allows
- /// the application to perform any needed transformations on the Message before it is sent.
- /// The Session instance sets the delegate on each Producer it creates.
- /// </summary>
- ProducerTransformerDelegate ProducerTransformer
- {
- get;
- set;
- }
+ /// <summary>
+ /// A delegate that is called each time a Message is sent from this Producer which allows
+ /// the application to perform any needed transformations on the Message before it is sent.
+ /// The Session instance sets the delegate on each Producer it creates.
+ /// </summary>
+ ProducerTransformerDelegate ProducerTransformer { get; set; }
#region Transaction methods