You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/03/14 21:34:05 UTC
svn commit: r1081551 - in
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src:
main/csharp/PrefetchPolicy.cs main/csharp/Session.cs
test/csharp/NMSConnectionFactoryTest.cs
test/csharp/OpenWire/PrefetchSizeZeroTest.cs
Author: tabish
Date: Mon Mar 14 20:34:05 2011
New Revision: 1081551
URL: http://svn.apache.org/viewvc?rev=1081551&view=rev
Log:
fix for https://issues.apache.org/jira/browse/AMQNET-318
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs?rev=1081551&r1=1081550&r2=1081551&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs Mon Mar 14 20:34:05 2011
@@ -73,6 +73,11 @@ namespace Apache.NMS.ActiveMQ
get { return this.maximumPendingMessageLimit; }
set { this.maximumPendingMessageLimit = value; }
}
+
+ public int All
+ {
+ set { this.SetAll(value); }
+ }
public void SetAll(int value)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs?rev=1081551&r1=1081550&r2=1081551&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs Mon Mar 14 20:34:05 2011
@@ -105,15 +105,6 @@ namespace Apache.NMS.ActiveMQ
#region Property Accessors
/// <summary>
- /// Sets the prefetch size, the maximum number of messages a broker will dispatch to consumers
- /// until acknowledgements are received.
- /// </summary>
- public int PrefetchSize
- {
- set{ this.connection.PrefetchPolicy.SetAll(value); }
- }
-
- /// <summary>
/// Sets the maximum number of messages to keep around per consumer
/// in addition to the prefetch window for non-durable topics until messages
/// will start to be evicted for slow consumers.
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs?rev=1081551&r1=1081550&r2=1081551&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs Mon Mar 14 20:34:05 2011
@@ -153,5 +153,32 @@ namespace Apache.NMS.ActiveMQ.Test
connection.Close();
}
}
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(1)]
+ [TestCase(1000)]
+ public void TestURIForPrefetchHandlingOfAll(int allPreFetch)
+ {
+ string testuri = string.Format("activemq:tcp://${{activemqhost}}:61616" +
+ "?nms.PrefetchPolicy.all={0}", allPreFetch);
+
+ NMSConnectionFactory factory = new NMSConnectionFactory(NMSTestSupport.ReplaceEnvVar(testuri));
+
+ Assert.IsNotNull(factory);
+ Assert.IsNotNull(factory.ConnectionFactory);
+ using(IConnection connection = factory.CreateConnection("", ""))
+ {
+ Assert.IsNotNull(connection);
+
+ Connection amqConnection = connection as Connection;
+ Assert.AreEqual(allPreFetch, amqConnection.PrefetchPolicy.QueuePrefetch);
+ Assert.AreEqual(allPreFetch, amqConnection.PrefetchPolicy.QueueBrowserPrefetch);
+ Assert.AreEqual(allPreFetch, amqConnection.PrefetchPolicy.TopicPrefetch);
+ Assert.AreEqual(allPreFetch, amqConnection.PrefetchPolicy.DurableTopicPrefetch);
+
+ connection.Close();
+ }
+ }
}
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs?rev=1081551&r1=1081550&r2=1081551&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs Mon Mar 14 20:34:05 2011
@@ -18,6 +18,7 @@
using System;
using Apache.NMS.Test;
using Apache.NMS.Util;
+using Apache.NMS.ActiveMQ;
using NUnit.Framework;
namespace Apache.NMS.ActiveMQ.Test
@@ -32,11 +33,12 @@ namespace Apache.NMS.ActiveMQ.Test
{
using(IConnection connection = CreateConnection())
{
+ (connection as Apache.NMS.ActiveMQ.Connection).PrefetchPolicy.All = 0;
+
connection.Start();
using(Session session = (Session)connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
{
IDestination destination = SessionUtil.GetDestination(session, DESTINATION_NAME);
- session.PrefetchSize = 0;
using(IMessageConsumer consumer = session.CreateConsumer(destination))
using(IMessageProducer producer = session.CreateProducer(destination))
{