-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pair incoming responses to the original requests (#61)
- Loading branch information
Showing
22 changed files
with
541 additions
and
374 deletions.
There are no files selected for viewing
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
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 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 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 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 Paranext.DataProvider.Messages; | ||
|
||
namespace Paranext.DataProvider.MessageHandlers; | ||
|
||
internal interface IMessageHandler | ||
{ | ||
/// <summary> | ||
/// Handle an incoming message, and optionally respond with another message | ||
/// </summary> | ||
/// <param name="message">Incoming message to handle</param> | ||
/// <returns>Optional response to the incoming message</returns> | ||
public Message? HandleMessage(Message message); | ||
} |
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,22 @@ | ||
using Paranext.DataProvider.Messages; | ||
|
||
namespace Paranext.DataProvider.MessageHandlers; | ||
|
||
/// <summary> | ||
/// Handler for "Event" messages | ||
/// </summary> | ||
internal class MessageHandlerEvent : IMessageHandler | ||
{ | ||
public Message? HandleMessage(Message message) | ||
{ | ||
if (message == null) | ||
throw new ArgumentNullException(nameof(message)); | ||
|
||
if (message.Type != MessageType.Event) | ||
throw new ArgumentException("Incorrect message type", nameof(message)); | ||
|
||
Console.WriteLine($"Event received: {message}"); | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.