Показать сообщение отдельно
Старый 04.04.2007, 13:18   #4  
EVGL is offline
EVGL
Banned
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
4,445 / 3001 (0) ++++++++++
Регистрация: 09.07.2002
Адрес: Parndorf, AT
Цитата:
Сообщение от 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.

Последний раз редактировалось EVGL; 04.04.2007 в 13:23.