You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2020/02/04 09:13:17 UTC
[activemq-nms-amqp] branch master updated: AMQNET-634: Use 4 as
default msg priority
This is an automated email from the ASF dual-hosted git repository.
michaelpearce pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git
The following commit(s) were added to refs/heads/master by this push:
new 3238ade AMQNET-634: Use 4 as default msg priority
new 89df500 Merge pull request #53 from Havret/fix-msg-priority
3238ade is described below
commit 3238aded3a1e974fe609bb855a22ecc69d4a6fae
Author: Havret <h4...@gmail.com>
AuthorDate: Mon Feb 3 22:53:47 2020 +0100
AMQNET-634: Use 4 as default msg priority
---
src/NMS.AMQP/NmsMessageProducer.cs | 2 +-
.../Integration/ProducerIntegrationTest.cs | 31 ++++++++++++++++++++++
.../Apache-NMS-AMQP-Test/NmsMessageProducerTest.cs | 2 +-
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/NMS.AMQP/NmsMessageProducer.cs b/src/NMS.AMQP/NmsMessageProducer.cs
index 3e29c78..e1b40ba 100644
--- a/src/NMS.AMQP/NmsMessageProducer.cs
+++ b/src/NMS.AMQP/NmsMessageProducer.cs
@@ -34,7 +34,7 @@ namespace Apache.NMS.AMQP
private MsgDeliveryMode deliveryMode = MsgDeliveryMode.Persistent;
private TimeSpan timeToLive = NMSConstants.defaultTimeToLive;
private TimeSpan requestTimeout;
- private MsgPriority priority = NMSConstants.defaultPriority;
+ private MsgPriority priority = NMSConstants.defaultPriority - 1;
private bool disableMessageId;
private bool disableMessageTimestamp;
diff --git a/test/Apache-NMS-AMQP-Test/Integration/ProducerIntegrationTest.cs b/test/Apache-NMS-AMQP-Test/Integration/ProducerIntegrationTest.cs
index ac9f351..18e0b9e 100644
--- a/test/Apache-NMS-AMQP-Test/Integration/ProducerIntegrationTest.cs
+++ b/test/Apache-NMS-AMQP-Test/Integration/ProducerIntegrationTest.cs
@@ -399,6 +399,37 @@ namespace NMS.AMQP.Test.Integration
testPeer.WaitForAllMatchersToComplete(1000);
}
}
+
+ [Test, Timeout(20_000)]
+ public void TestMessagesAreProducedWithProperDefaultPriorityWhenNoPrioritySpecified()
+ {
+ using (TestAmqpPeer testPeer = new TestAmqpPeer())
+ {
+ IConnection connection = EstablishConnection(testPeer);
+ testPeer.ExpectBegin();
+ testPeer.ExpectSenderAttach();
+
+ ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
+ IQueue destination = session.GetQueue("myQueue");
+ IMessageProducer producer = session.CreateProducer(destination);
+
+ byte priority = 4;
+
+ testPeer.ExpectTransfer(m => Assert.AreEqual(priority, m.Header.Priority));
+ testPeer.ExpectClose();
+
+ ITextMessage message = session.CreateTextMessage();
+ Assert.AreEqual(MsgPriority.BelowNormal, message.NMSPriority);
+
+ producer.Send(message);
+
+ Assert.AreEqual((MsgPriority) priority, message.NMSPriority);
+
+ connection.Close();
+
+ testPeer.WaitForAllMatchersToComplete(1000);
+ }
+ }
[Test, Timeout(20_000)]
public void TestNonDefaultPriorityProducesMessagesWithPriorityFieldAndSetsNMSPriority()
diff --git a/test/Apache-NMS-AMQP-Test/NmsMessageProducerTest.cs b/test/Apache-NMS-AMQP-Test/NmsMessageProducerTest.cs
index f0f139b..4c83e7a 100644
--- a/test/Apache-NMS-AMQP-Test/NmsMessageProducerTest.cs
+++ b/test/Apache-NMS-AMQP-Test/NmsMessageProducerTest.cs
@@ -77,7 +77,7 @@ namespace NMS.AMQP.Test
public void TestPriorityConfiguration()
{
IMessageProducer producer = session.CreateProducer(null);
- Assert.AreEqual(NMSConstants.defaultPriority, producer.Priority);
+ Assert.AreEqual(MsgPriority.BelowNormal, producer.Priority);
producer.Priority = MsgPriority.Highest;
Assert.AreEqual(MsgPriority.Highest, producer.Priority);
}