Get Started
| Product | Versions |
|---|---|
| .NET Standard |
README
.NET WEAS Migration SDK
Introduction
This SDK supports secured access to the WEAS Migration API.
For a quick start, follow the steps below:
Setup
Sample Project for the WEAS Migration API
A sample project is provided in the weas-migration-sdk-samples directory.
NuGet Package
This SDK is published as the NuGet package 'Vereniging-COIN.Sdk.WM'.
Configure Credentials
For secure access credentials are required.
- Check this README to find out how to configure these.
- In summary you will need:
- a consumer name
- a private key file (or a
System.Security.Cryptography.RSAinstance containing this key) - a file containing the encrypted Hmac secret
(or a
System.Security.Cryptography.HMACSHA256instance containing this (decrypted) secret)
- These can be used to create instances of the
WeasMigrationServiceand theSseConsumer, which is needed for theWeasMigrationMessageConsumer.
Messages
WmMessage.cs shows how the WEAS Migration domain has been structured.
The interfaces from this file can be used to define methods that can accept any message.
Coin.Sdk.WM.Messages.V5.Utils contains the useful static methods TypeName and Deserialize.
Send Messages
The WeasMigrationService has a SendMessage method to send any WEAS Migration message - wrapped in an instance of the MessageEnvelope class -
to the API.
Consume Messages
Create Message Listener
For message consumption, the WEAS Migration API makes use of HTTP's ServerSentEvents.
The SDK offers a Listener interface IWeasMigrationMessageListener which is triggered upon reception of a message payload.
Whenever the API doesn't send any other message for 20 seconds, it sends an empty 'heartbeat' message, which triggers the OnKeepAlive() method.
Start consuming messages
The WeasMigrationMessageConsumer has three startConsuming...() methods for consuming messages, of which startConsumingUnconfirmed() is most useful.
All these methods need an instance of the IWeasMigrationMessageListener.
Consume specific messages using filters
The WeasMigrationMessageConsumer provides various filters for message consumption. The filters are:
MessageType: All possible message types, including errors. Use theMessageType-enumeration to indicate which messages have to be consumed.- confirmation status: By using
startConsumingAll(), all messages will be received, both confirmed and unconfirmed.
Note: this enables the consumption of the whole message history. Therefore, this requires you to supply an implementation of theIOffsetPersisterinterface. The purpose of this interface is to track themessage-idof the last received and processed message. In the case of a reconnect, message consumption will then resume where it left off. offset: starts consuming messages based on the givenmessage-idoffset. Note: it is the responsibility of the client to keep track of theoffset.
Confirm Messages
Once a consumed message has been processed it needs to be confirmed.
To confirm a message use the WeasMigrationService.sendConfirmation(id) method.
Error Handling
The WEAS Migration API can return errors in one of two ways:
The server received an incorrect payload and replies with an error response (synchronous)
The REST layer of the system only performs basic payload checks, such as swagger schema validity and message authorization. Any errors in these checks are immediately returned as an error reply. The
WeasMigrationService.SendMessagemethod returns these asErrorResponse. Other http errors are thrown asHttpListenerException.As a ServerSentEvent containing an
WeasMigrationErrorFoundMessage(asynchronous)The system performs detailed functional validation asynchronously. Errors in this stage are sent via a
ServerSentEvent.Note:
WeasMigrationErrorFoundmessages need to be confirmed like any other message received via aServerSentEvent.
Downloads by Version
Depended On By
Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.