This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| nebolintegration_basic_integration [2021/08/11 23:15] – nebol | nebolintegration_basic_integration [2021/11/03 17:24] (current) – nebol | ||
|---|---|---|---|
| Line 18: | Line 18: | ||
| Install-Package SharpRepository.EfCoreRepository # EF Core support for SharpRepository | Install-Package SharpRepository.EfCoreRepository # EF Core support for SharpRepository | ||
| Install-Package Microsoft.EntityFrameworkCore.SqlServer # MS SQL support for Entity Framework | Install-Package Microsoft.EntityFrameworkCore.SqlServer # MS SQL support for Entity Framework | ||
| - | Install-Package SharpRepository.IocMicrosoft.DependencyInjection # MS dependency injection support for SharpRepository | + | Install-Package SharpRepository.Ioc.Microsoft.DependencyInjection # MS dependency injection support for SharpRepository |
| Install-Package NewtonSoft.Json # needed for some JSON converting later | Install-Package NewtonSoft.Json # needed for some JSON converting later | ||
| </ | </ | ||
| Line 24: | Line 24: | ||
| SharpRepository.EfCoreRepository is needed for EF Core support for SharpRepository | SharpRepository.EfCoreRepository is needed for EF Core support for SharpRepository | ||
| Microsoft.EntityFrameworkCore.SqlServer is needed for MS SQL support for Entity Framework | Microsoft.EntityFrameworkCore.SqlServer is needed for MS SQL support for Entity Framework | ||
| - | SharpRepository.IocMicrosoft.DependencyInjection is needed for MS dependency injection support for SharpRepository | + | SharpRepository.Ioc.Microsoft.DependencyInjection is needed for MS dependency injection support for SharpRepository |
| NewtonSoft.Json is needed for some JSON converting later on | NewtonSoft.Json is needed for some JSON converting later on | ||
| Line 38: | Line 38: | ||
| < | < | ||
| "Data Source=(LocalDb)\MSSQLLocalDB; | "Data Source=(LocalDb)\MSSQLLocalDB; | ||
| + | </ | ||
| + | or something like this for MS SQL Server: | ||
| + | < | ||
| + | " | ||
| </ | </ | ||
| Line 46: | Line 50: | ||
| First, the actual integration. We'll use a public webservice that just returns a UUID. Very simple. | First, the actual integration. We'll use a public webservice that just returns a UUID. Very simple. | ||
| - | We create a class derived from SystemIntegration. We supply it with a few parameters that specifies how the integration is managed, and we override the ProcessRequest() and ProcessResponse() methods. | + | We create a class derived from SystemIntegration. We supply it with a few parameters that specifies how the integration is managed |
| The ProcessRequest() method is called when a new task is found in the queue. It does what needs to be done, in this case call a simple webservice. The ProcessResponse() handles the response recieved from the webservice, in this case it just outputs the UUID that is fetched. | The ProcessRequest() method is called when a new task is found in the queue. It does what needs to be done, in this case call a simple webservice. The ProcessResponse() handles the response recieved from the webservice, in this case it just outputs the UUID that is fetched. | ||
| - | < | + | < |
| // Representation of a successful response | // Representation of a successful response | ||
| public class FetchedUUID | public class FetchedUUID | ||
| Line 104: | Line 108: | ||
| Now let's set everything up. | Now let's set everything up. | ||
| - | < | + | A couple of static variables in the Program class: |
| + | < | ||
| + | static Engine engine; | ||
| + | static ServiceCollection services; | ||
| + | </ | ||
| + | |||
| + | <code csharp> | ||
| static void SetupIntegration() | static void SetupIntegration() | ||
| { | { | ||
| Line 144: | Line 154: | ||
| NebolIntegration takes advantage of NebolLogger, | NebolIntegration takes advantage of NebolLogger, | ||
| - | < | + | < |
| protected static void InitLoggingFramework() | protected static void InitLoggingFramework() | ||
| { | { | ||
| Line 153: | Line 163: | ||
| Now let's start the integration engine: | Now let's start the integration engine: | ||
| - | < | + | < |
| engine.StartIntegrations(); | engine.StartIntegrations(); | ||
| </ | </ | ||
| - | And we'll add a basic console loop: | + | And we'll add a simple |
| - | < | + | < |
| string command; | string command; | ||
| Console.WriteLine(" | Console.WriteLine(" | ||
| Line 175: | Line 185: | ||
| Finally, the cleanup: | Finally, the cleanup: | ||
| - | < | + | < |
| engine.StopIntegrations(); | engine.StopIntegrations(); | ||
| </ | </ | ||
| Line 190: | Line 200: | ||
| {{: | {{: | ||
| - | Congrats! A call was made to the webservice and the responce | + | Congrats! A call was made to the webservice and the response |
| Next: [[NebolIntegration_Database_and_Flow]] - So what happened? | Next: [[NebolIntegration_Database_and_Flow]] - So what happened? | ||