You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/10/18 14:56:59 UTC
svn commit: r465241 - in
/incubator/activemq/activemq-dotnet/trunk/src/main/csharp:
ActiveMQ/Connection.cs NMS/IConnection.cs
Author: jstrachan
Date: Wed Oct 18 05:56:58 2006
New Revision: 465241
URL: http://svn.apache.org/viewvc?view=rev&rev=465241
Log:
added an ExceptionListener to be notified of transport level issues
Modified:
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IConnection.cs
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs?view=diff&rev=465241&r1=465240&r2=465241
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs Wed Oct 18 05:56:58 2006
@@ -40,8 +40,7 @@
private long temporaryDestinationCounter;
private long localTransactionCounter;
private bool closing;
-
-
+
public Connection(ITransport transport, ConnectionInfo info)
{
this.transport = transport;
@@ -51,6 +50,8 @@
this.transport.Start();
}
+ public event ExceptionListener ExceptionListener;
+
/// <summary>
/// Starts message delivery for this connection.
/// </summary>
@@ -109,8 +110,7 @@
get { return transport; }
set { this.transport = value; }
}
-
-
+
public AcknowledgementMode AcknowledgementMode
{
get { return acknowledgementMode; }
@@ -289,6 +289,7 @@
protected void OnException(ITransport sender, Exception exception)
{
Tracer.ErrorFormat("Transport Exception: {0}", exception.ToString());
+ ExceptionListener(exception);
}
protected SessionInfo CreateSessionInfo(AcknowledgementMode acknowledgementMode)
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IConnection.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IConnection.cs?view=diff&rev=465241&r1=465240&r2=465241
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IConnection.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IConnection.cs Wed Oct 18 05:56:58 2006
@@ -14,78 +14,84 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-namespace NMS
-{
- /// <summary>
- /// The mode used to acknowledge messages after they are consumed
- /// </summary>
- public enum AcknowledgementMode
- {
- /**
- * 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.
- */
- AutoAcknowledge,
-
- /**
- * 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.
- */
- DupsOkAcknowledge,
-
- /**
- * With this acknowledgment mode, the client acknowledges a
- * consumed message by calling the message's acknowledge method.
- */
- ClientAcknowledge,
-
- /**
- * Messages will be consumed when the transaction commits.
- */
- Transactional
- }
-
- /// <summary>
- /// Represents a connection with a message broker
- /// </summary>
- public interface IConnection : System.IDisposable, IStartable, IStoppable
- {
-
- /// <summary>
- /// Creates a new session to work on this connection
- /// </summary>
- ISession CreateSession();
-
+using System;
+
+namespace NMS {
/// <summary>
- /// Creates a new session to work on this connection
+ /// The mode used to acknowledge messages after they are consumed
/// </summary>
- ISession CreateSession(AcknowledgementMode acknowledgementMode);
-
-
- // Properties
-
- AcknowledgementMode AcknowledgementMode
+ public enum AcknowledgementMode
{
- get;
- set;
+ /**
+ * 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.
+ */
+ AutoAcknowledge,
+
+ /**
+ * 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.
+ */
+ DupsOkAcknowledge,
+
+ /**
+ * With this acknowledgment mode, the client acknowledges a
+ * consumed message by calling the message's acknowledge method.
+ */
+ ClientAcknowledge,
+
+ /**
+ * Messages will be consumed when the transaction commits.
+ */
+ Transactional
}
-
- string ClientId
+
+ /// <summary>
+ /// A delegate that can receive transport level exceptions.
+ /// </summary>
+ public delegate void ExceptionListener(Exception exception);
+
+
+ /// <summary>
+ /// Represents a connection with a message broker
+ /// </summary>
+ public interface IConnection : System.IDisposable, IStartable, IStoppable
{
- get;
- set;
- }
-
-
- }
-}
+
+ /// <summary>
+ /// Creates a new session to work on this connection
+ /// </summary>
+ ISession CreateSession();
+
+ /// <summary>
+ /// Creates a new session to work on this connection
+ /// </summary>
+ ISession CreateSession(AcknowledgementMode acknowledgementMode);
+ /// <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>
+ /// An asynchronous listener which can be notified if an error occurs
+ /// </summary>
+ event ExceptionListener ExceptionListener;
+ }
+}