Skip to content
Permalink
Browse files
Merge pull request #23 from lukeabsent/AMQNET-637
AMQNET-637 NMS 2.0 More async methods - few additional methods/updates
  • Loading branch information
michaelandrepearce committed Feb 9, 2021
2 parents 76b6d0a + 1386309 commit ae4e414d745e476f6e8824cf8e03c0723df10323
Showing 7 changed files with 85 additions and 4 deletions.
@@ -16,6 +16,7 @@
*/

using System;
using System.Threading.Tasks;

namespace Apache.NMS
{
@@ -29,6 +30,12 @@ public interface IMessage
/// message has been processed correctly.
/// </summary>
void Acknowledge();

/// <summary>
/// If using client acknowledgement mode on the session, then this method will acknowledge that the
/// message has been processed correctly.
/// </summary>
Task AcknowledgeAsync();

/// <summary>
/// Clears out the message body. Clearing a message's body does not clear its header
@@ -324,16 +324,29 @@ public interface INMSContext : IDisposable, IStartable, IStoppable

/// <summary>
/// Stops all Message delivery in this session and restarts it again
/// with the oldest unabcknowledged message. Messages that were delivered
/// with the oldest unacknowledged message. Messages that were delivered
/// but not acknowledge should have their redelivered property set.
/// This is an optional method that may not by implemented by all NMS
/// providers, if not implemented an Exception will be thrown.
/// Message redelivery is not requried to be performed in the original
/// order. It is not valid to call this method on a Transacted Session.
/// </summary>
void Recover();

/// <summary>
/// Stops all Message delivery in this session and restarts it again
/// with the oldest unacknowledged message. Messages that were delivered
/// but not acknowledge should have their redelivered property set.
/// This is an optional method that may not by implemented by all NMS
/// providers, if not implemented an Exception will be thrown.
/// Message redelivery is not requried to be performed in the original
/// order. It is not valid to call this method on a Transacted Session.
/// </summary>
Task RecoverAsync();

void Acknowledge();

Task AcknowledgeAsync();

#region Transaction methods

@@ -342,12 +355,24 @@ public interface INMSContext : IDisposable, IStartable, IStoppable
/// send and acknowledgements for producers and consumers in this session
/// </summary>
void Commit();

/// <summary>
/// If this is a transactional session then commit all message
/// send and acknowledgements for producers and consumers in this session
/// </summary>
Task CommitAsync();

/// <summary>
/// If this is a transactional session then rollback all message
/// send and acknowledgements for producers and consumers in this session
/// </summary>
void Rollback();
void Rollback();

/// <summary>
/// If this is a transactional session then rollback all message
/// send and acknowledgements for producers and consumers in this session
/// </summary>
Task RollbackAsync();

#endregion

@@ -346,16 +346,29 @@ public interface ISession : IDisposable

/// <summary>
/// Stops all Message delivery in this session and restarts it again
/// with the oldest unabcknowledged message. Messages that were delivered
/// with the oldest unacknowledged message. Messages that were delivered
/// but not acknowledge should have their redelivered property set.
/// This is an optional method that may not by implemented by all NMS
/// providers, if not implemented an Exception will be thrown.
/// Message redelivery is not requried to be performed in the original
/// order. It is not valid to call this method on a Transacted Session.
/// </summary>
void Recover();

/// <summary>
/// Stops all Message delivery in this session and restarts it again
/// with the oldest unacknowledged message. Messages that were delivered
/// but not acknowledge should have their redelivered property set.
/// This is an optional method that may not by implemented by all NMS
/// providers, if not implemented an Exception will be thrown.
/// Message redelivery is not requried to be performed in the original
/// order. It is not valid to call this method on a Transacted Session.
/// </summary>
Task RecoverAsync();

void Acknowledge();

Task AcknowledgeAsync();

#region Transaction methods

@@ -15,6 +15,8 @@
* limitations under the License.
*/

using System.Threading.Tasks;

namespace Apache.NMS
{
/// <summary>
@@ -32,5 +34,15 @@ public interface ITemporaryQueue : IQueue
/// not support this operation.
/// </exception>
void Delete();
}

/// <summary>
/// Deletes this Temporary Destination, If there are existing receivers
/// still using it, a NMSException will be thrown.
/// </summary>
/// <exception cref="Apache.NMS.NMSException">
/// If NMS Provider fails to Delete the Temp Destination or the client does
/// not support this operation.
/// </exception>
Task DeleteAsync();
}
}
@@ -15,6 +15,8 @@
* limitations under the License.
*/

using System.Threading.Tasks;

namespace Apache.NMS
{
/// <summary>
@@ -32,5 +34,15 @@ public interface ITemporaryTopic : ITopic
/// not support this operation.
/// </exception>
void Delete();

/// <summary>
/// Deletes this Temporary Destination, If there are existing receivers
/// still using it, a NMSException will be thrown.
/// </summary>
/// <exception cref="Apache.NMS.NMSException">
/// If NMS Provider fails to Delete the Temp Destination or the client does
/// not support this operation.
/// </exception>
Task DeleteAsync();
}
}
@@ -17,6 +17,7 @@

using System;
using System.Collections;
using System.Threading.Tasks;
using Apache.NMS.Util;

namespace Apache.NMS.Commands
@@ -92,6 +93,11 @@ public void Acknowledge()
{
}

public Task AcknowledgeAsync()
{
return Task.Factory.StartNew(Acknowledge);
}

public virtual void ClearBody()
{
this.content = null;
@@ -16,6 +16,7 @@
*/

using System;
using System.Threading.Tasks;

namespace Apache.NMS.Commands
{
@@ -58,6 +59,11 @@ public override Object Clone()
return o;
}

public Task DeleteAsync()
{
return Task.Factory.StartNew(Delete);
}

public void Delete()
{
throw new NotSupportedException("Stomp Cannot Delete Temporary Destinations");

0 comments on commit ae4e414

Please sign in to comment.