repaired message return handling
This commit is contained in:
parent
7bfa85e96d
commit
0ae84839d1
@ -92,14 +92,19 @@ namespace bsmd.dbh
|
||||
|
||||
foreach (string inputFile in Directory.GetFiles(Properties.Settings.Default.IncomingFolder))
|
||||
{
|
||||
string justFilename = Path.GetFileName(inputFile);
|
||||
// lokale Dateien verarbeiten
|
||||
if (!ResponseUtil.Read(inputFile))
|
||||
{
|
||||
_log.ErrorFormat("Error reading input file {0}", inputFile);
|
||||
_log.ErrorFormat("Error reading input file {0}", justFilename);
|
||||
string errorPath = Path.Combine(Properties.Settings.Default.IncomingErrorFolder, justFilename);
|
||||
File.Move(inputFile, errorPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Move(inputFile, Properties.Settings.Default.IncomingArchiveFolder);
|
||||
_log.InfoFormat("Incoming file {0} processed", justFilename);
|
||||
string archivePath = Path.Combine(Properties.Settings.Default.IncomingArchiveFolder, justFilename);
|
||||
File.Move(inputFile, archivePath);
|
||||
}
|
||||
// remote Dateien löschen
|
||||
bsmd.dakosy.SFtp.RemoveProcessedFile(Properties.Settings.Default.RemoteOutgoingFolder, Path.GetFileName(inputFile));
|
||||
|
||||
9
bsmd.dbh/Properties/Settings.Designer.cs
generated
9
bsmd.dbh/Properties/Settings.Designer.cs
generated
@ -94,5 +94,14 @@ namespace bsmd.dbh.Properties {
|
||||
return ((string)(this["SFTPSessionName"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string IncomingErrorFolder {
|
||||
get {
|
||||
return ((string)(this["IncomingErrorFolder"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,5 +26,8 @@
|
||||
<Setting Name="SFTPSessionName" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">dbh</Value>
|
||||
</Setting>
|
||||
<Setting Name="IncomingErrorFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -29,7 +29,7 @@ namespace bsmd.dbh
|
||||
root.SourceDocumentVersion = "7.0";
|
||||
root.Timestamp = DateTime.Now;
|
||||
root.Sender = Properties.Settings.Default.Sender;
|
||||
root.SenderReference = "N";
|
||||
root.SenderReference = message.Id.ToString();
|
||||
bsmd.database.ReportingParty reportingParty = DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value];
|
||||
Request.ReportingParty rp = new Request.ReportingParty();
|
||||
rp.RPCity = reportingParty.City;
|
||||
|
||||
@ -34,7 +34,7 @@ namespace bsmd.dbh
|
||||
return result;
|
||||
}
|
||||
|
||||
string fileSeqString = m.Groups[0].Value;
|
||||
string fileSeqString = m.Groups[1].Value;
|
||||
|
||||
if(!Int32.TryParse(fileSeqString, out int fileSeqNum))
|
||||
{
|
||||
@ -57,7 +57,7 @@ namespace bsmd.dbh
|
||||
return result;
|
||||
}
|
||||
|
||||
bsmd.dbh.Response.Root root;
|
||||
bsmd.dbh.Response.Root root = null;
|
||||
|
||||
try
|
||||
{
|
||||
@ -66,14 +66,57 @@ namespace bsmd.dbh
|
||||
{
|
||||
root = (bsmd.dbh.Response.Root) serializer.Deserialize(s);
|
||||
}
|
||||
|
||||
if(Guid.TryParse(root.SenderReference, out Guid refGuid))
|
||||
{
|
||||
if (!sentMessage.Id.Equals(refGuid))
|
||||
_log.WarnFormat("sender ref {0} does not match sent message id {1}", refGuid, sentMessage.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.WarnFormat("sender ref {0} is no guid", root.SenderReference);
|
||||
}
|
||||
|
||||
switch(sentMessage.MessageNotificationClass)
|
||||
{
|
||||
case Message.NotificationClass.VISIT:
|
||||
if(root.Type == Response.RootType.VISIT)
|
||||
{
|
||||
if(aCore.VisitId.IsNullOrEmpty() && !root.VisitId.IsNullOrEmpty())
|
||||
{
|
||||
aCore.VisitId = root.VisitId;
|
||||
_log.InfoFormat("Received Visit-Id {0} for core {1}", root.VisitId, aCore.Id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Message.NotificationClass.TRANSIT:
|
||||
if (root.Type == Response.RootType.TRANSIT)
|
||||
{
|
||||
if (aCore.TransitId.IsNullOrEmpty() && !root.TransitId.IsNullOrEmpty())
|
||||
{
|
||||
aCore.TransitId = root.TransitId;
|
||||
_log.InfoFormat("Received Transit-Id {0} for core {1}", root.TransitId, aCore.Id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(aCore.Cancelled ?? false))
|
||||
aCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
||||
|
||||
DBManager.Instance.Save(aCore);
|
||||
result = true;
|
||||
}
|
||||
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Failed to deserialize: {0}", ex.Message);
|
||||
_log.ErrorFormat("Failed to deserialize return message: {0}", ex.Message);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -31,6 +31,9 @@
|
||||
<setting name="SFTPSessionName" serializeAs="String">
|
||||
<value>dbh</value>
|
||||
</setting>
|
||||
<setting name="IncomingErrorFolder" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</bsmd.dbh.Properties.Settings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user