Skip to content

Latest commit

 

History

History
90 lines (77 loc) · 3.51 KB

File metadata and controls

90 lines (77 loc) · 3.51 KB

Azure Functions

The Mock Data Recipient solution contains azure function projects.
The DiscoverDataHolders function is used to get the list of Data Holder Brands
from the Mock Register and update the Mock Data Recipient repository DataHolderBrands table.
The DCR function is used to register the software product included in the Mock Data Recipient
with the newly discovered Data Holder Brands from the Mock Register.

To Run and Debug Azure Functions

The following procedures can be used to run the functions in a local development environment for evaluation of the functions.
1) Start the Mock Register, Mock Data Holder, Mock Data Holder Energy and Mock Data Recipient solutions.
Noting that the Mock Data Recipient must be running as it is required for the https://localhost:9001/jwks
endpoint that is used for the Access Token.
2) Start the Azure Storage Emulator (Azurite):
using a MS Windows command prompt:
md C:\azurite
cd "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator"
azurite --silent --location c:\azurite --debug c:\azurite\debug.log
Noting this is only required to be performed once, it will then be listening on ports - 10000, 10001 and 10002
when debugging is started from MS Visual Studio by selecting CDR.DiscoverDataHolder or CDR.DCR as the startup project
(by starting a debug instance using F5 or Debug > Start Debugging)
or by using a MS Windows command prompt:
navigate to .\mock-data-holder\Source\CDR.GetDataRecipients
func host start --verbose
To reset the message queue, uncomment the following line of code and start the debug instance as indicated above, placing a
breakpoint after this code;
await DeleteAllMessagesAsync(log, qConnString, qName);
3) Open two instances of Mock Data Recipient in MS Visual Studio,
(select CDR.DCR as the startup project in one and CDR.DiscoverDataHolder as the startup project in the other)
4) Start each debug instances (F5 or Debug > Start Debugging), this will simulate the discovery of Data Holder brands and the
processing of the messages added to the queue.
Noting the below sql script is used to clear out the registrations as the seed data is not a good reflection on reality as the
infosecBaseUri values are either invalid or duplicated, so running this script resets the data so the registration process can
occur for the processed message queue item.
DECLARE @i INT = 1;
WHILE (@i <= 3600000)
BEGIN
WAITFOR DELAY '00:00:01'
	DELETE FROM [cdr-mdr].[dbo].[Registration]
	DELETE FROM [cdr-idsvr].[dbo].[Clients]
	DELETE FROM [cdr-idsvre].[dbo].[Clients]
SET  @i = @i + 1;
END


Observing the following tables shows the above functions in operation from the database perspective:
SELECT * FROM [cdr-mdr].[dbo].[DcrMessage]
SELECT * FROM [cdr-mdr].[dbo].[LogEvents_DCRService]