Skip to content
Permalink
Browse files
AMQNET-637 NMS 2.0 - Add some missing methods from JMS 2.0
Message - Get Body and IsBodyAssignableTo
MessageConsumer - Get MessageSelector
NMSContext - AutoStart
NMSProducer - Method chaining, one of the key parts of the JMS 2.0 spec
Added reference to oracle article on features in NMSConsumer and NMSProducer
Added Default DeliveryDelay constant
  • Loading branch information
michaelandrepearce committed Apr 19, 2020
1 parent 7340cb9 commit 26f71f6824a8dea1ff1088bdbffecae3017026ba
Showing 10 changed files with 78 additions and 17 deletions.
@@ -14,8 +14,8 @@
# limitations under the License.

$pkgname = "Apache.NMS"
$pkgver = "1.8.1"
$frameworks = "net35", "net40", "netstandard2.0"
$pkgver = "2.0.0"
$frameworks = "net40", "netstandard2.0"

write-progress "Creating package directory." "Initializing..."
if (!(test-path package)) {
@@ -114,5 +114,9 @@ public interface IMessage
/// before the delivery time has been reached.
/// <summary>
DateTime NMSDeliveryTime { get; set; }

T Body<T>();

bool IsBodyAssignableTo(Type type);
}
}
@@ -76,5 +76,7 @@ public interface IMessageConsumer : System.IDisposable
/// any necessary transformations on the received message before it is delivered.
/// </summary>
ConsumerTransformerDelegate ConsumerTransformer { get; set; }

string MessageSelector { get; }
}
}
@@ -21,11 +21,10 @@ namespace Apache.NMS
{
/// <summary>
/// An object capable of sending messages to some destination
/// https://www.oracle.com/technical-resources/articles/java/jms20.html
/// </summary>
public interface INMSConsumer : System.IDisposable
{
string MessageSelector { get; }

/// <summary>
/// Waits until a message is available and returns it
/// </summary>
@@ -51,6 +50,7 @@ public interface INMSConsumer : System.IDisposable

T ReceiveBodyNoWait<T>();

string MessageSelector { get; }

/// <summary>
/// An asynchronous listener which can be used to consume messages asynchronously
@@ -247,7 +247,9 @@ public interface INMSContext : IDisposable, IStartable, IStoppable

AcknowledgementMode AcknowledgementMode { get; }

String ClientID { get; set; }
string ClientId { get; set; }

bool AutoStart { get; set; }

#endregion

@@ -16,12 +16,14 @@
*/

using System;
using System.Collections;
using System.Threading.Tasks;

namespace Apache.NMS
{
/// <summary>
/// An object capable of sending messages to some destination
/// https://www.oracle.com/technical-resources/articles/java/jms20.html
/// </summary>
public interface INMSProducer : System.IDisposable
{
@@ -45,9 +47,7 @@ public interface INMSProducer : System.IDisposable

Task<INMSProducer> SendAsync(IDestination destination, object body);

INMSProducer SetAsync(CompletionListener completionListener);

CompletionListener GetAsync();
CompletionListener CompletionListener { get; set; }

/// <summary>
/// Provides access to the message properties (headers).
@@ -59,14 +59,13 @@ public interface INMSProducer : System.IDisposable
///
/// The message's header fields and body are not cleared.
/// </summary>
void ClearProperties();
INMSProducer ClearProperties();

/// <summary>
/// The correlation ID used to correlate messages from conversations or long running business processes.
/// </summary>
string NMSCorrelationID { get; set; }


/// <summary>
/// The destination that the consumer of this message should send replies to
/// </summary>
@@ -99,6 +98,53 @@ public interface INMSProducer : System.IDisposable

bool DisableMessageTimestamp { get; set; }

//Method chaining setters
//Allows message delivery options, headers, and properties to be configured using method chaining
INMSProducer SetCompletionListener(CompletionListener completionListener);

INMSProducer SetDeliveryDelay(TimeSpan deliveryDelay);

INMSProducer SetTimeToLive(TimeSpan timeToLive);

INMSProducer SetDeliveryMode(MsgDeliveryMode deliveryMode);

INMSProducer SetDisableMessageID(bool value);

INMSProducer SetDisableMessageTimestamp(bool value);

INMSProducer SetNMSCorrelationID(string correlationID);

INMSProducer SetNMSReplyTo(IDestination replyTo);

INMSProducer SetNMSType(string type);

INMSProducer SetPriority(MsgPriority priority);

INMSProducer SetProperty(string name, bool value);

INMSProducer SetProperty(string name, byte value);

INMSProducer SetProperty(string name, double value);

INMSProducer SetProperty(string name, float value);

INMSProducer SetProperty(string name, int value);

INMSProducer SetProperty(string name, long value);

INMSProducer SetProperty(string name, short value);

INMSProducer SetProperty(string name, char value);

INMSProducer SetProperty(string name, string value);

INMSProducer SetProperty(string name, byte[] value);

INMSProducer SetProperty(string name, IList value);

INMSProducer SetProperty(string name, IDictionary value);


#region Factory methods to create messages

/// <summary>
@@ -56,6 +56,7 @@ public class NMSConstants
{
public const MsgPriority defaultPriority = MsgPriority.Normal;
public const MsgDeliveryMode defaultDeliveryMode = MsgDeliveryMode.Persistent;
public static readonly TimeSpan defaultDeliveryDelay = TimeSpan.Zero;
public static readonly TimeSpan defaultTimeToLive = TimeSpan.Zero;
public static readonly TimeSpan defaultRequestTimeout = TimeSpan.FromMilliseconds(Timeout.Infinite);
}
@@ -33,7 +33,7 @@ with the License. You may obtain a copy of the License at
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Apache.NMS</PackageId>
<Version>1.8.1</Version>
<Version>2.0.0</Version>
<Authors>Apache ActiveMQ</Authors>
<Company>Apache Software Foundation</Company>
<Product>Apache NMS API</Product>
@@ -279,6 +279,16 @@ public string NMSType

public DateTime NMSDeliveryTime { get; set; }

public T Body<T>()
{
throw new NotImplementedException();
}

public bool IsBodyAssignableTo(Type type)
{
throw new NotImplementedException();
}

#endregion

#region NMS Extension headers
@@ -20,7 +20,7 @@ with the License. You may obtain a copy of the License at
<PropertyGroup>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<TargetFrameworks>net35;net40;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net40;netstandard2.0</TargetFrameworks>
<RootNamespace>Apache.NMS.Test</RootNamespace>
<AssemblyName>Apache.NMS.Test</AssemblyName>
</PropertyGroup>
@@ -33,7 +33,7 @@ with the License. You may obtain a copy of the License at
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Apache.NMS.Test</PackageId>
<Version>1.8.0</Version>
<Version>2.0.0</Version>
<Authors>Apache ActiveMQ</Authors>
<Company>Apache Software Foundation</Company>
<Product>Apache NMS API</Product>
@@ -64,10 +64,6 @@ with the License. You may obtain a copy of the License at
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net35'">
<Reference Include="System.Web" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net40'">
<Reference Include="System.Web" />
</ItemGroup>

0 comments on commit 26f71f6

Please sign in to comment.