/// <summary> /// Trigger the Actor Instances of the given Actor Type. /// </summary> /// <param name="actorType">Destination Actor Type.</param> /// <param name="trigger">Trigger message.</param> /// <param name="awaitCompletion">Boolean indicating whether this a synchronous call or not.</param> /// <returns>Boolean indicating success or failure.</returns> public bool TriggerActorInstances(ActorTypeEnum actorType, BaseTrigger trigger, bool awaitCompletion) { bool triggerResult = false; // can only trigger an actor that is started if (_actorState == ActorStateEnum.ActorStarted) { triggerResult = true; ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType); foreach (ActorName activeActorName in activeDestinationActors) { if (trigger is Hl7Trigger) { Hl7Client hl7Client = GetHl7Client(activeActorName); if (hl7Client != null) { if (hl7Client.TriggerClient(activeActorName, trigger, awaitCompletion) == false) { // set returned result - but continue with other triggers triggerResult = false; } } } else { DicomClient dicomClient = GetDicomClient(activeActorName); if (dicomClient != null) { if (dicomClient.TriggerClient(activeActorName, trigger, awaitCompletion) == false) { // set returned result - but continue with other triggers triggerResult = false; } } } } } return(triggerResult); }
/// <summary> /// Add a reponse trigger to the Actor. /// </summary> /// <param name="actorType">Destination Actor Type.</param> /// <param name="trigger">Trigger message.</param> public void AddResponseTriggerToActor(ActorTypeEnum actorType, BaseTrigger trigger) { // can only load and actor that is started if (_actorState == ActorStateEnum.ActorStarted) { ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType); foreach (ActorName activeActorName in activeDestinationActors) { if (trigger is Hl7Trigger) { Hl7Server hl7Server = GetHl7Server(activeActorName); if ((hl7Server != null) && (hl7Server is Hl7QueryServer)) { Hl7QueryServer hl7QueryServer = (Hl7QueryServer)hl7Server; hl7QueryServer.AddResponseTrigger(activeActorName, trigger); } } } } }
/// <summary> /// Dequeue a Trigger message. /// </summary> /// <returns>Trigger message.</returns> public BaseTrigger Dequeue() { BaseTrigger trigger = (BaseTrigger)_queue.Dequeue(); return(trigger); }
/// <summary> /// Enqueue a Trigger message. /// </summary> /// <param name="trigger">Trigger message.</param> public void Enqueue(BaseTrigger trigger) { _queue.Enqueue(trigger); }