Цитата:
Сообщение от
Dimonishe
А постоянное чтение прийдется, как я понимаю, пакетником организовывать.
Да. Вот примерчик:
X++:
void ScanDirectory(FilePath _folderPath, GatewayOrgId _gatewayOrgId)
{
int hndFile;
boolean showInfo = true;
FileName scanFileName;
ProblemGatewayImportProtocol importProtocol;
;
if (! _folderPath)
throw error("@SFI525");
if (! _gatewayOrgId)
throw error("@SFI529");
if (! WinAPI::folderExists(_folderPath))
throw error( strfmt("@SFI526", _folderPath) );
gatewayOrgId = _gatewayOrgId;
[hndFile, scanFileName] = WinAPI::findFirstFile(_folderPath + "\\*.tmp");
while (scanFileName)
{
fileName = _folderPath + scanFileName;
if (!ProblemGatewayImportProtocol::exist(fileName))
{
if (showInfo)
{
info("@SFI527");
showInfo = false;
}
importProtocol.clear();
importProtocol.FilePath = fileName;
importProtocol.GatewayOrgId = gatewayOrgId;
try
{
this.run();
importProtocol.ImportStatus = ImportStatus::Imported;
}
catch
{
importProtocol.ImportStatus = ImportStatus::InvalidFile;
}
importProtocol.insert();
}
scanFileName = WinAPI::findNextFile(hndFile);
}
}
В целом, надо заметить, что MSMQ работает много медленнее, чем файловая система NTFS.