Exemple #1
0
        private void GetPyroServerConnectionUrl()
        {
            // FhirApiDiscoveryTask
            var FhirApiDiscoveryTaskLauncher = new FhirApiDiscoveryTaskLauncher(Container);

            ConsoleSupport.TimeStampWriteLine(LogMessageSupport.RegisterTask("FhirApiDiscoveryTaskLauncher"));
            PyroServerConnectionUrl = FhirApiDiscoveryTaskLauncher.Launch();
        }
 /// <summary>
 /// Launches the service as a Task on it's own thread
 /// Creates new Dependancy Injection instance for each thread/Task
 /// </summary>
 /// <param name="TaskPayloadHiServiceIHISearch"></param>
 public void Launch(ITaskPayloadHiServiceIHISearch TaskPayloadHiServiceIHISearch)
 {
     ConsoleSupport.TimeStampWriteLine(LogMessageSupport.TaskReceived(TaskPayloadHiServiceIHISearch));
       Task.Factory.StartNew(() =>
       {
     try
     {
       using (AsyncScopedLifestyle.BeginScope(Container))
       {
     this.Container.GetInstance<IIhiSearchService>().Run(TaskPayloadHiServiceIHISearch);
       }
     }
     catch (Exception Exec)
     {
       Pyro.Common.Logging.Logger.Log.Error(Exec, "IhiSearchServiceTaskLauncher threw uncaught exception in Task/Thread.");
     }
       });
 }
Exemple #3
0
        private void LoadTasks()
        {
            var hubProxy = hubConnection.CreateHubProxy("BroadcastHub");

            Tools.ConsoleSupport.TimeStampWriteLine("Registered Tasks:");
            // ========================================================================================
            // ==============  Registered each task Launcher to run ====================================
            // ========================================================================================

            // IHI Search Service
            var IhiSearchServiceTaskLauncher = new IhiSearchServiceTaskLauncher(Container);

            ConsoleSupport.TimeStampWriteLine(LogMessageSupport.RegisterTask(BackgroundTaskType.HiServiceIHISearch.GetPyroLiteral()));
            hubProxy.On <TaskPayloadHiServiceIHISearch>(BackgroundTaskType.HiServiceIHISearch.GetPyroLiteral(),
                                                        IHiServiceResolveIHIPayload => IhiSearchServiceTaskLauncher.Launch(IHiServiceResolveIHIPayload));

            // ========================================================================================
        }
Exemple #4
0
        public void Run(ITaskPayloadHiServiceIHISearch TaskPayloadHiServiceIHISearch)
        {
            using (DbContextTransaction Transaction = IUnitOfWork.BeginTransaction())
            {
                try
                {
                    IRequestMeta            RequestMeta            = IRequestMetaFactory.CreateRequestMeta().Set("Patient/IHIStatusExample");
                    IResourceServiceOutcome ResourceServiceOutcome = IResourceApiServices.GetRead("IHIStatusExample", RequestMeta);
                    ResourceServiceOutcome.SummaryType = RequestMeta.SearchParameterGeneric.SummaryType;

                    Transaction.Commit();


                    ConsoleSupport.TimeStampWriteLine(LogMessageSupport.TaskOutCome(TaskPayloadHiServiceIHISearch, Hl7.Fhir.Model.Task.TaskStatus.Completed));
                }
                catch (Exception Exec)
                {
                    Transaction.Rollback();
                    ConsoleSupport.TimeStampWriteLine(LogMessageSupport.TaskException(TaskPayloadHiServiceIHISearch, Hl7.Fhir.Model.Task.TaskStatus.Failed));
                    ILog.Error(Exec, $"FHIR Task ID: {TaskPayloadHiServiceIHISearch.TaskId}, FHIR Patient ID: {TaskPayloadHiServiceIHISearch.PatientId}");
                }
            }
        }