/// <summary> /// Notify /// </summary> /// <param name="workItem"></param> public void Notify(NotificationQueueWorkItem workItem) { ILocalizationService locale = this.Context.GetService(typeof(ILocalizationService)) as ILocalizationService; // Create a message utility MessageUtility msgUtil = new MessageUtility() { Context = this.Context }; // Create the EV formatters XmlIts1Formatter formatter = new XmlIts1Formatter() { ValidateConformance = false }; formatter.GraphAides.Add(new DatatypeFormatter() { ValidateConformance = false }); // Iterate through the targets attempting to notify each one using (WcfClientConnector wcfClient = new WcfClientConnector(Target.ConnectionString)) { wcfClient.Formatter = formatter; wcfClient.Open(); // Build the message Trace.TraceInformation("Sending notification to '{0}'...", this.Target.Name); IInteraction notification = msgUtil.CreateMessage(workItem.Event, workItem.Action, this.Target); // Send it var sendResult = wcfClient.Send(notification); if (sendResult.Code != Everest.Connectors.ResultCode.Accepted && sendResult.Code != Everest.Connectors.ResultCode.AcceptedNonConformant) { Trace.TraceWarning(string.Format(locale.GetString("NTFW002"), this.Target.Name)); DumpResultDetails(sendResult.Details); return; } // Receive the response var rcvResult = wcfClient.Receive(sendResult); if (rcvResult.Code != Everest.Connectors.ResultCode.Accepted && rcvResult.Code != Everest.Connectors.ResultCode.AcceptedNonConformant) { Trace.TraceWarning(string.Format(locale.GetString("NTFW003"), this.Target.Name)); DumpResultDetails(rcvResult.Details); return; } // Get structure var response = rcvResult.Structure as MCCI_IN000002UV01; if (response == null) { Trace.TraceWarning(string.Format(locale.GetString("NTFW003"), this.Target.Name)); return; } if (response.Acknowledgement.Count == 0 || response.Acknowledgement[0].TypeCode != AcknowledgementType.AcceptAcknowledgementCommitAccept) { Trace.TraceWarning(string.Format(locale.GetString("NTFW004"), this.Target.Name)); return; } // Close the connector and continue wcfClient.Close(); } }