Skip to content

Commit

Permalink
Version/2.0 (#3)
Browse files Browse the repository at this point in the history
* updated InMemory

Updated InMemory to use more performant ideas for thread locking as well as added in grouping and message blitzing inside the Sample Execution to prove both effectiveness and allow more valuable metrics to be sampled.

* added bulk publish

added in ability to bulk publish a set of messages

* updated ActiveMQ

cannot have 2 instances of the same group and channel on the same session, so updated code accordingly

* Update Connection.cs

added attempt to create queue automatically when specifying a group

* migrated contract connection

migrated contract connection to an internal style class to allow for internal abstraction in preparation for the Multi Service contract connection

* added mutli service contract

added in a multi service contract connection, need to implement unit testing for it but had to move things around to reduce code copying.

* test restructure

restructuring testing project in preperation for building mutli service connection unit testing

* added in base unit testing for MultiService

added in the base unit testing for multiservice to ensure that the basic calls are not broken.  Need to implement testing for service connection selection calls including errors and then may extend the class to also implement IContractConnection with additional calls to ensure only 1 connection returns.

* rebuild interfaces

rebuilt interfaces to introduce 3 types of contract connnections, the standard, a multi service one and a mapped one that has the standard calls, but supports multiple service connection mappings and expects only 1 to ever map properly for a given call

* added mapped testing

added basics for mapped connection testing

* updating libraries and tests

updating library version for nuget packages for underlying services and added additional unit testing.  Need to implement testing for the cleanup of inbox style query connections.

* completed testing

added in remaining unit tests to get nearly full coverage

* moved outs and began logging

Added in some initial logging
Shifted encryptor calls to not use out but instead use a Tuple style response for better performance

* added comments and logging

added in xml comments to finish abstractions documentation as well as completed logging inside contract connections.

* added azure service bus

added in support for azure service bus

* Added Google PubSub support

Added in support for the Google PubSub stack as a connector

* added apache pulsar support

Added in the connector and therefore support for running against apache pulsar

* Update unit-test-report.yml

Signed-off-by: Roger Castaldo <roger.castaldo@gmail.com>

* updating coverage report check

---------

Signed-off-by: Roger Castaldo <roger.castaldo@gmail.com>
  • Loading branch information
roger-castaldo authored Dec 6, 2024
1 parent 41f3487 commit 72c5260
Show file tree
Hide file tree
Showing 110 changed files with 15,572 additions and 1,829 deletions.
5 changes: 2 additions & 3 deletions Abstractions/Interfaces/Encrypting/IMessageEncryptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public interface IMessageEncryptor
/// 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>
ValueTask<byte[]> EncryptAsync(byte[] data, out Dictionary<string, string?> headers);
/// <returns>An encrypted byte array of the message body and any headers that might be needed</returns>
ValueTask<(byte[] data, Dictionary<string, string?> headers)> EncryptAsync(byte[] data);
}
}
76 changes: 76 additions & 0 deletions Abstractions/Interfaces/IBaseContractConnection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using MQContract.Messages;

namespace MQContract.Interfaces
{
/// <summary>
/// Represents the Base for all Contract Connections and contains the definition of all items defined by all Contract Connections
/// </summary>
public interface IBaseContractConnection : IDisposable, IAsyncDisposable
{
/// <summary>
/// Called to create a subscription into the underlying service Pub/Sub style and have the messages processed asynchronously
/// </summary>
/// <typeparam name="T">The type of message to listen for</typeparam>
/// <param name="messageReceived">The callback invoked when a new message is received</param>
/// <param name="errorReceived">The callback to invoke when an error occurs</param>
/// <param name="channel">Specifies the message channel to use. The prefered method is using the MessageChannelAttribute on the class.</param>
/// <param name="group">The subscription group if desired (typically used when multiple instances of the same system are running)</param>
/// <param name="ignoreMessageHeader">If true, the message type specified will be ignored and it will automatically attempt to convert the underlying message to the given class</param>
/// <param name="cancellationToken">A cancellation token</param>
///
/// <returns>A subscription instance that can be ended when desired</returns>
ValueTask<ISubscription> SubscribeAsync<T>(Func<IReceivedMessage<T>, ValueTask> messageReceived, Action<Exception> errorReceived, string? channel = null, string? group = null, bool ignoreMessageHeader = false, CancellationToken cancellationToken = new CancellationToken())
where T : class;
/// <summary>
/// Called to create a subscription into the underlying service Pub/Sub style and have the messages processed syncrhonously
/// </summary>
/// <typeparam name="T">The type of message to listen for</typeparam>
/// <param name="messageReceived">The callback invoked when a new message is received</param>
/// <param name="errorReceived">The callback to invoke when an error occurs</param>
/// <param name="channel">Specifies the message channel to use. The prefered method is using the MessageChannelAttribute on the class.</param>
/// <param name="group">The subscription group if desired (typically used when multiple instances of the same system are running)</param>
/// <param name="ignoreMessageHeader">If true, the message type specified will be ignored and it will automatically attempt to convert the underlying message to the given class</param>
/// <param name="cancellationToken">A cancellation token</param>
///
/// <returns>A subscription instance that can be ended when desired</returns>
ValueTask<ISubscription> SubscribeAsync<T>(Action<IReceivedMessage<T>> messageReceived, Action<Exception> errorReceived, string? channel = null, string? group = null, bool ignoreMessageHeader = false, CancellationToken cancellationToken = new CancellationToken())
where T : class;
/// <summary>
/// Called to create a subscription into the underlying service Query/Reponse style and have the messages processed asynchronously
/// </summary>
/// <typeparam name="Q">The type of message to listen for</typeparam>
/// <typeparam name="R">The type of message to respond with</typeparam>
/// <param name="messageReceived">The callback invoked when a new message is received expecting a response of the type response</param>
/// <param name="errorReceived">The callback invoked when an error occurs.</param>
/// <param name="channel">Specifies the message channel to use. The prefered method is using the MessageChannelAttribute on the class.</param>
/// <param name="group">The subscription group if desired (typically used when multiple instances of the same system are running)</param>
/// <param name="ignoreMessageHeader">If true, the message type specified will be ignored and it will automatically attempt to convert the underlying message to the given class</param>
/// <param name="cancellationToken">A cancellation token</param>
///
/// <returns>A subscription instance that can be ended when desired</returns>
ValueTask<ISubscription> SubscribeQueryAsyncResponseAsync<Q, R>(Func<IReceivedMessage<Q>, ValueTask<QueryResponseMessage<R>>> messageReceived, Action<Exception> errorReceived, string? channel = null, string? group = null, bool ignoreMessageHeader = false, CancellationToken cancellationToken = new CancellationToken())
where Q : class
where R : class;
/// <summary>
/// Called to create a subscription into the underlying service Query/Reponse style and have the messages processed synchronously
/// </summary>
/// <typeparam name="Q">The type of message to listen for</typeparam>
/// <typeparam name="R">The type of message to respond with</typeparam>
/// <param name="messageReceived">The callback invoked when a new message is received expecting a response of the type response</param>
/// <param name="errorReceived">The callback invoked when an error occurs.</param>
/// <param name="channel">Specifies the message channel to use. The prefered method is using the MessageChannelAttribute on the class.</param>
/// <param name="group">The subscription group if desired (typically used when multiple instances of the same system are running)</param>
/// <param name="ignoreMessageHeader">If true, the message type specified will be ignored and it will automatically attempt to convert the underlying message to the given class</param>
/// <param name="cancellationToken">A cancellation token</param>
///
/// <returns>A subscription instance that can be ended when desired</returns>
ValueTask<ISubscription> SubscribeQueryResponseAsync<Q, R>(Func<IReceivedMessage<Q>, QueryResponseMessage<R>> messageReceived, Action<Exception> errorReceived, string? channel = null, string? group = null, bool ignoreMessageHeader = false, CancellationToken cancellationToken = new CancellationToken())
where Q : class
where R : class;
/// <summary>
/// Called to close off the contract connection and close it's underlying service connection
/// </summary>
/// <returns>A task for the closure of the connection</returns>
ValueTask CloseAsync();
}
}
Loading

0 comments on commit 72c5260

Please sign in to comment.