SPRNET-1218 - Update to use Apache NMS 1.1

This commit is contained in:
markpollack
2009-06-16 20:02:46 +00:00
parent f7734690f4
commit 4ae54fe77b
3 changed files with 52 additions and 33 deletions

View File

@@ -37,9 +37,9 @@ namespace Spring.Messaging.Nms.Connections
private object originalDisableMessageTimestamp = null;
private bool persistent;
private MsgDeliveryMode msgDeliveryMode;
private byte priority;
private MsgPriority priority;
private TimeSpan timeToLive;
@@ -53,7 +53,7 @@ namespace Spring.Messaging.Nms.Connections
public CachedMessageProducer(IMessageProducer target)
{
this.target = target;
this.persistent = target.Persistent;
this.msgDeliveryMode = target.DeliveryMode;
this.priority = target.Priority;
this.timeToLive = target.TimeToLive;
}
@@ -81,12 +81,12 @@ namespace Spring.Messaging.Nms.Connections
/// Sends a message to the specified message.
/// </summary>
/// <param name="message">The message to send.</param>
/// <param name="persistent">if set to <c>true</c> use persistent QOS.</param>
/// <param name="deliveryMode">The QOS to use for sending <see cref="msgDeliveryMode"/>.</param>
/// <param name="priority">The message priority.</param>
/// <param name="timeToLive">The time to live.</param>
public void Send(IMessage message, bool persistent, byte priority, TimeSpan timeToLive)
public void Send(IMessage message, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
{
target.Send(message, persistent, priority, timeToLive);
target.Send(message, deliveryMode, priority, timeToLive);
}
/// <summary>
@@ -104,12 +104,12 @@ namespace Spring.Messaging.Nms.Connections
/// </summary>
/// <param name="destination">The destination.</param>
/// <param name="message">The message to send.</param>
/// <param name="persistent">if set to <c>true</c> use persistent QOS.</param>
/// <param name="deliveryMode">The QOS to use for sending <see cref="msgDeliveryMode"/>.</param>
/// <param name="priority">The priority.</param>
/// <param name="timeToLive">The time to live.</param>
public void Send(IDestination destination, IMessage message, bool persistent, byte priority, TimeSpan timeToLive)
public void Send(IDestination destination, IMessage message, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
{
target.Send(destination, message, persistent, priority, timeToLive);
target.Send(destination, message, deliveryMode, priority, timeToLive);
}
#region Odd Message Creationg Methods on IMessageProducer - not in-line with JMS APIs.
@@ -181,13 +181,14 @@ namespace Spring.Messaging.Nms.Connections
#endregion
/// <summary>
/// Gets or sets a value indicating whether this <see cref="CachedMessageProducer"/> uses a persistent QOS
/// Gets or sets a value indicating what DeliveryMode this <see cref="CachedMessageProducer"/>
/// should use, for example a persistent QOS
/// </summary>
/// <value><c>true</c> if persistent; otherwise, <c>false</c>.</value>
public bool Persistent
/// <value><see cref="MsgDeliveryMode"/></value>
public MsgDeliveryMode DeliveryMode
{
get { return persistent; }
set { persistent = value; }
get { return msgDeliveryMode; }
set { msgDeliveryMode = value; }
}
/// <summary>
@@ -215,7 +216,7 @@ namespace Spring.Messaging.Nms.Connections
/// Gets or sets the priority of messages sent with this producer.
/// </summary>
/// <value>The priority.</value>
public byte Priority
public MsgPriority Priority
{
get { return priority; }
set { priority = value;}

View File

@@ -80,12 +80,12 @@ namespace Spring.Messaging.Nms.Core
private bool explicitQosEnabled = false;
private byte priority = NMSConstants.defaultPriority;
private bool persistent = NMSConstants.defaultPersistence;
private TimeSpan timeToLive;
private MsgPriority priority = NMSConstants.defaultPriority;
private TimeSpan timeToLive;
private MsgDeliveryMode deliveryMode = NMSConstants.defaultDeliveryMode;
#endregion
#region Constructor (s)
@@ -319,9 +319,27 @@ namespace Spring.Messaging.Nms.Core
/// <value><c>true</c> if [delivery persistent]; otherwise, <c>false</c>.</value>
virtual public bool Persistent
{
get { return persistent; }
get { return (deliveryMode == MsgDeliveryMode.Persistent); }
set { persistent = value; }
set
{
if (value) {
deliveryMode = MsgDeliveryMode.Persistent;
} else {
deliveryMode = MsgDeliveryMode.NonPersistent;
}
}
}
/// <summary>
/// Gets or sets a value indicating what DeliveryMode this <see cref="CachedMessageProducer"/>
/// should use, for example a persistent QOS
/// </summary>
/// <value><see cref="MsgDeliveryMode"/></value>
virtual public MsgDeliveryMode DeliveryMode
{
get { return deliveryMode; }
set { deliveryMode = value; }
}
/// <summary>
@@ -330,7 +348,7 @@ namespace Spring.Messaging.Nms.Core
/// <remarks>Since a default value may be defined administratively,
/// this is only used when "isExplicitQosEnabled" equals "true".</remarks>
/// <value>The priority.</value>
virtual public byte Priority
virtual public MsgPriority Priority
{
get { return priority; }
@@ -568,7 +586,7 @@ namespace Spring.Messaging.Nms.Core
{
if (ExplicitQosEnabled)
{
producer.Send(message, Persistent, Priority, TimeToLive);
producer.Send(message, DeliveryMode, Priority, TimeToLive);
}
else
{

View File

@@ -26,7 +26,7 @@ namespace Spring.Messaging.Nms.Connections
public class TestMessageProducer : IMessageProducer
{
private bool persistent;
private MsgDeliveryMode msgDeliveryMode;
private TimeSpan timeToLive = new TimeSpan(0,0,0,60,0);
private TimeSpan requestTimeout;
@@ -35,7 +35,7 @@ namespace Spring.Messaging.Nms.Connections
throw new NotImplementedException();
}
public void Send(IMessage message, bool persistent, byte priority, TimeSpan timeToLive)
public void Send(IMessage message, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
{
throw new NotImplementedException();
}
@@ -45,7 +45,7 @@ namespace Spring.Messaging.Nms.Connections
throw new NotImplementedException();
}
public void Send(IDestination destination, IMessage message, bool persistent, byte priority, TimeSpan timeToLive)
public void Send(IDestination destination, IMessage message, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
{
throw new NotImplementedException();
}
@@ -90,10 +90,10 @@ namespace Spring.Messaging.Nms.Connections
throw new NotImplementedException();
}
public bool Persistent
public MsgDeliveryMode DeliveryMode
{
get { return persistent; }
set { persistent = value; }
get { return msgDeliveryMode; }
set { msgDeliveryMode = value; }
}
public TimeSpan TimeToLive
@@ -108,9 +108,9 @@ namespace Spring.Messaging.Nms.Connections
set { requestTimeout = value; }
}
public byte Priority
public MsgPriority Priority
{
get { return 1; }
get { return MsgPriority.Normal; }
set { }
}