Hello,
I’m trying to receive information from Broker by means of Delphi. There are 6 records in UOW with information, but I receive 6 empty records. Application moves accross all steps without any errors. What can it be.
I use Comminicator for Windows, Version 7.2.1
Thanks advance.
Source code of the program
Logon(Broker1);
Broker1.ConvID := 'NEW';
Broker1.Service := Service;
Broker1.ServerClass := ServerClass;
Broker1.ServerName := ServerName;
Broker1.Wait := '10S';
Broker1.APIVersion := 4;
Broker1.CompressLevel := 'Y';
Broker1.LocaleString := 'LOCAL';
RegisterBroker(Broker1);
Broker1.GetErrorText);
while (Broker1.ErrorCode = BROL500_BROKER_RESPONSE_OK) do
begin
{ New conversation about to start. }
Broker1.ConvID := 'NEW';
MsgLength := 105;
Broker1.ReceiveBufferSize := MsgLength;
{ Start syncpoint (transaction) }
Broker1.Option := OPT_SYNC;
try
{ Start receiving data }
while (Broker1.ErrorCode = BROL500_BROKER_RESPONSE_OK) do
begin
Broker1.ReceiveBufferSize := MsgLength;
{ Receive }
Broker1.Function_ := FCT_RECEIVE;
{ Invoke broker }
InvokeBroker(Broker1);
{ Get the data }
sStr := Broker1.GetReceiveData;
ProcessData;
if (Broker1.UOWStatus = ONLY) or (Broker1.UOWStatus = LAST) then
begin
Break;
end
else
if Broker1.ErrorCode = BROL500_WAIT_TIMEOUT then
Break;
end;
if ((Broker1.ErrorCode = BROL500_PARTNER_FINISHD_CONVSN) or
(Broker1.ErrorCode = BROL500_END_OF_CONVERSATION) or
(Broker1.ErrorCode = BROL500_BROKER_RESPONSE_OK)) then
begin
{ Set syncpoint option to Commit }
Broker1.Option := OPT_COMMIT;
Memo1.Lines.Add('Syncing...');
Syncpoint(Broker1);
{ If everything ok, close the file and copy it to received files. }
end
else
begin
Break;
end;
finally
end;//try - finally
end;//while loop
finally
{ After syncpoint if data has been sent to Nissan then move the file sent to archive folder. }
DeRegisterBroker(Broker1);
{ Log off the server. }
LogOff(Broker1);
Broker1.GetErrorText;
end;
//------------------------------------------//
procedure Logon(var Broker: TBroker);
begin
{ Set function to logon }
Broker.Function_ := FCT_LOGON;
{ Set userID }
Broker.UserID := ‘our ID’;
{ Set API version }
Broker.APIVersion := 4;
{ Set Password }
Broker.Password := ‘our Password’;
Broker.BrokerID := ‘10.128.134.33:18024’;
{ Set token }
Broker.Store := 2;
Broker.Token := CreateToken + DateTimeToStr(Now);
{ Invoke broker }
InvokeBroker(Broker);
end;