-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrated interfaces/added channel mapping
removed a bunch of the message interfaces in favor of using record objects instead to make implemenetation of connectors simpler as well as clean up the code added in a channel mapper class that allows for the channels specificed to be mapped/changed during run time for the different messaging styles in case there is a need to do so.
- Loading branch information
1 parent
dbd19f7
commit eb9afe4
Showing
63 changed files
with
1,949 additions
and
1,233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using MQContract.Messages; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Interfaces.Messages | ||
{ | ||
public interface IEncodedMessage | ||
{ | ||
IMessageHeader Header { get; } | ||
string MessageTypeID { get; } | ||
ReadOnlyMemory<byte> Data { get; } | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Messages | ||
{ | ||
public sealed class MessageHeader(IEnumerable<KeyValuePair<string,string>> data) | ||
: IMessageHeader | ||
{ | ||
public MessageHeader(Dictionary<string, string?>? headers) | ||
: this(headers?.AsEnumerable().Select(pair=>new KeyValuePair<string,string>(pair.Key,pair.Value??string.Empty))?? []) { } | ||
|
||
public MessageHeader(IMessageHeader? originalHeader, Dictionary<string, string?>? appendedHeader) | ||
: this( | ||
(appendedHeader?.AsEnumerable().Select(pair => new KeyValuePair<string, string>(pair.Key, pair.Value??string.Empty))?? []) | ||
.Concat(originalHeader?.Keys.Select(k => new KeyValuePair<string, string>(k, originalHeader?[k]!))?? []) | ||
.DistinctBy(k => k.Key) | ||
) | ||
{ } | ||
|
||
public string? this[string tagKey] | ||
=> data.Where(p=>Equals(p.Key,tagKey)) | ||
.Select(p=>p.Value) | ||
.FirstOrDefault(); | ||
|
||
public IEnumerable<string> Keys | ||
=> data.Select(p=>p.Key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Messages | ||
{ | ||
public record PingResult(string Host,string Version, TimeSpan ResponseTime) | ||
{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Messages | ||
{ | ||
public record QueryResult<T>(string ID,IMessageHeader Header,T? Result=null,string? Error=null) | ||
: TransmissionResult(ID,Error) | ||
where T : class | ||
{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Messages | ||
{ | ||
public record RecievedServiceMessage(string ID, string MessageTypeID, string Channel, IMessageHeader Header, ReadOnlyMemory<byte> Data) | ||
: ServiceMessage(ID,MessageTypeID,Channel,Header,Data) | ||
{ | ||
public DateTime RecievedTimestamp { get; private init; } = DateTime.Now; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using MQContract.Interfaces.Messages; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Messages | ||
{ | ||
public record ServiceMessage(string ID,string MessageTypeID,string Channel,IMessageHeader Header,ReadOnlyMemory<byte> Data) | ||
: IEncodedMessage | ||
{ } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using MQContract.Interfaces.Messages; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Messages | ||
{ | ||
public record ServiceQueryResult(string ID, IMessageHeader Header,string MessageTypeID,ReadOnlyMemory<byte> Data) | ||
: IEncodedMessage | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MQContract.Messages | ||
{ | ||
public record TransmissionResult(string ID,string? Error=null) | ||
{ | ||
public bool IsError=>!string.IsNullOrWhiteSpace(Error); | ||
} | ||
} |
Oops, something went wrong.