Skip to content

Commit

Permalink
V1.1 (#2)
Browse files Browse the repository at this point in the history
* migrated subscription storage

migrated subscription storage into the ContractConnection from underlying connections to reduce repeated code.

* moved to AsyncDisposable

moved items from Disposable to AsyncDisposable to allow for Tasks required for the disposal of some items

* migrated to valuetask

migrated most functionality calls to ValueTask instead of Task or just generic results to allow for more asynchronous concepts

* completed migration to ValueTask

changed all items available to use ValueTask instead of Task for efficiency

* Removed Disposal Defaults

Removed the Disposal Defaults in base interfaces to allow underlying classes to specify as well as implemented code to handle the disposals
Added in End/Close calls for both subscriptions and Connections
Updated unit testing accordingly
Updated the samples to demonstrate how to properly close off the items in a console application due to some Task Scheduling concepts causing locks.

* adding unit test pr

adding in unit test pr call

* migrated query response

migrated query response concepts up to the contract connection level where underlying connections do not support that messaging style and adjusted/created/implemented new interfaces accordingly.

* moved packaging info to shared

moved all the packaging info to a shared props to make changing version numbers easier

* Corrected ActiveMQ

changed underlying package used for ActiveMQ as well as produced a sample application using it and tested functionality.

* changed service channel options

Removed the Channel Service Options concept form the higher levels and allowed for it to be specified through the underlying connector to clean up and simplify the Contract Connection concepts and usage.

* added in Redis support

added in full support for Redis as a MQ bus.  Added in an initial attempt at RabbitMQ but requires much more thorough testing and validation.

* added in rabbitmq support

added in and tested rabbitmq support, need to explore a slight refactor to support query response natively

* code cleanup and commenting

added in comments and did some additional code cleanup

* multiple fixes

Added in initial middleware concepts, need to implement testing
Updated all external connections to use interface specific calls instead of public to reduce the comments needed
Corrected typo for spelling of received
Moved contract connection to interface specifics instead of public to reduce repeated comments

* added metric tests

added in unit testing for the metrics

* adjusted testing timings

Adjusted some of the unit test timings to ensure that all metric tracking has occured

* code cleanup, test extensions

added in more testing to cover middleware usage as well as cleaned up some code.  Need to extend logging.

* Updating versions

updating linked nuget package versions

* adding HiveMQ

adding support for HiveMQ messaging

* updated HiveMQ

updated HiveMQ to implement an inbox pattern for the query response model similar to the Redix design

* added inbox

added in concept of inbox style service connection, corrected typo for timeout and updated unit testing accordingly.

* added in In Memory

Added in an In Memory connector to allow for some semblance of virtualization where all messaging is handled internally
  • Loading branch information
roger-castaldo authored Oct 3, 2024
1 parent 27ae5b9 commit 9a4db80
Show file tree
Hide file tree
Showing 164 changed files with 8,614 additions and 3,630 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/unit-test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Dot Net Test Reporter"

on:
pull_request_target:
types: [ opened, synchronize ]

permissions:
pull-requests: write
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
8.0.x
- name: Restore dependencies
run: dotnet restore -p:TargetFramework=net8.0 AutomatedTesting
- name: Build-8.0
run: dotnet build --framework net8.0 --no-restore AutomatedTesting
- name: Test-8.0
run: dotnet test --framework net8.0 --no-build --verbosity normal AutomatedTesting
- name: report results
uses: bibipkins/dotnet-test-reporter@v1.4.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-title: 'Unit Test Results'
results-path: ./**/*.trx
coverage-path: ./**/coverage.xml
coverage-threshold: 90
16 changes: 2 additions & 14 deletions Abstractions/Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../Shared.props" />

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>MQContract.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>MQContract</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationMarkdown>$(MSBuildProjectDirectory)\Readme.md</DocumentationMarkdown>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>roger-castaldo</Authors>
<Title>Abstractions for MQContract</Title>
<Company>$(AssemblyName)</Company>
<PackageProjectUrl>https://github.com/roger-castaldo/MQContract</PackageProjectUrl>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/roger-castaldo/MQContract</RepositoryUrl>
<PackageTags>Message Queue MQ Contract</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<IncludeSymbols>True</IncludeSymbols>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions Abstractions/Attributes/MessageResponseTimeoutAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ public class MessageResponseTimeoutAttribute(int value) : Attribute
/// The number of milliseconds for the timeout to trigger for this RPC call class
/// </summary>
public int Value => value;

/// <summary>
/// The converted TimeSpan value from the supplied milliseconds value in the constructor
/// </summary>
public TimeSpan TimeSpanValue => TimeSpan.FromMilliseconds(value);
}
}
16 changes: 16 additions & 0 deletions Abstractions/Attributes/QueryResponseChannelAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace MQContract.Attributes
{
/// <summary>
/// Used to allow the specification of a response channel to be used without supplying it to the contract calls.
/// IMPORTANT: This particular attribute and the response channel argument are only used when the underlying connection does not support QueryResponse messaging.
/// </summary>
/// <param name="name">The name of the channel to use for responses</param>
[AttributeUsage(AttributeTargets.Class)]
public class QueryResponseChannelAttribute(string name) : Attribute
{
/// <summary>
/// The Name of the response channel
/// </summary>
public string Name => name;
}
}
67 changes: 0 additions & 67 deletions Abstractions/Exceptions.cs

This file was deleted.

6 changes: 3 additions & 3 deletions Abstractions/Interfaces/Conversion/IMessageConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
{
/// <summary>
/// Used to define a message converter. These are called upon if a
/// message is recieved on a channel of type T but it is waiting for
/// message is received on a channel of type T but it is waiting for
/// message of type V
/// </summary>
/// <typeparam name="T">The source message type</typeparam>
/// <typeparam name="V">The destination message type</typeparam>
public interface IMessageConverter<in T, out V>
public interface IMessageConverter<in T, V>
{
/// <summary>
/// Called to convert a message from type T to type V
/// </summary>
/// <param name="source">The message to convert</param>
/// <returns>The source message converted to the destination type V</returns>
V Convert(T source);
ValueTask<V> ConvertAsync(T source);
}
}
4 changes: 2 additions & 2 deletions Abstractions/Interfaces/Encoding/IMessageEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public interface IMessageEncoder
/// <typeparam name="T">The type of message being encoded</typeparam>
/// <param name="message">The message being encoded</param>
/// <returns>A byte array of the message in it's encoded form that will be transmitted</returns>
byte[] Encode<T>(T message);
ValueTask<byte[]> EncodeAsync<T>(T message);

/// <summary>
/// Called to decode a message from a byte array
/// </summary>
/// <typeparam name="T">The type of message being decoded</typeparam>
/// <param name="stream">A stream representing the byte array data that was transmitted as the message body in KubeMQ</param>
/// <returns>Null when fails or the value of T that was encoded inside the stream</returns>
T? Decode<T>(Stream stream);
ValueTask<T?> DecodeAsync<T>(Stream stream);
}
}
4 changes: 2 additions & 2 deletions Abstractions/Interfaces/Encoding/IMessageTypeEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public interface IMessageTypeEncoder<T>
/// </summary>
/// <param name="message">The message value to encode</param>
/// <returns>The message encoded as a byte array</returns>
byte[] Encode(T message);
ValueTask<byte[]> EncodeAsync(T message);
/// <summary>
/// Called to decode the message from a byte stream into the specified type
/// </summary>
/// <param name="stream">The byte stream containing the encoded message</param>
/// <returns>null if the Decode fails, otherwise an instance of the message decoded from the stream</returns>
T? Decode(Stream stream);
ValueTask<T?> DecodeAsync(Stream stream);
}
}
6 changes: 3 additions & 3 deletions Abstractions/Interfaces/Encrypting/IMessageEncryptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ namespace MQContract.Interfaces.Encrypting
public interface IMessageEncryptor
{
/// <summary>
/// Called to decrypt the message body stream recieved as a message
/// Called to decrypt the message body stream received as a message
/// </summary>
/// <param name="stream">The stream representing the message body binary data</param>
/// <param name="headers">The message headers that were provided by the message</param>
/// <returns>A decrypted stream of the message body</returns>
Stream Decrypt(Stream stream, MessageHeader headers);
ValueTask<Stream> DecryptAsync(Stream stream, MessageHeader headers);

/// <summary>
/// Called to encrypt the message body prior to transmitting a message
/// </summary>
/// <param name="data">The original unencrypted body data</param>
/// <param name="headers">The headers that are desired to attache to the message if needed</param>
/// <returns>An encrypted byte array of the message body</returns>
byte[] Encrypt(byte[] data, out Dictionary<string, string?> headers);
ValueTask<byte[]> EncryptAsync(byte[] data, out Dictionary<string, string?> headers);
}
}
Loading

0 comments on commit 9a4db80

Please sign in to comment.