为何msmq从本地队列收发信息是报告事务无效 ( 积分: 100 )

  • 主题发起人 主题发起人 delphi7tzj
  • 开始时间 开始时间
D

delphi7tzj

Unregistered / Unconfirmed
GUEST, unregistred user!
下列程序在队列位于非本地机器时正常,但队列位于本地机器时提示事务使用方式无效,为何
var
qinfo:MSMQQueueInfo;
q:MSMQQueue;
msend:MSMQMessage;
xact:olevariant;
formatname:string;
pathname:string;
msmqxact:MSMQCoordinatedTransactionDispenser;
begin
qinfo:=coMSMQQueueInfo.Create as MSMQQueueInfo;
q:=coMSMQQueue.Create as MSMQQueue;
msend:=coMSMQMessage.Create as MSMQMessage;
msmqxact:=coMSMQCoordinatedTransactionDispenser.Create as MSMQCoordinatedTransactionDispenser;
//formatname:='DIRECT=TCP:192.68.0.126/PRIVATE$/ReceiveTest';
//qinfo.FormatName:=formatname;
pathname:='./PRIVATE$/ReceiveTest';
qinfo.PathName:=pathname;
q:=qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE);
mSend.Body :='CM_table2_';
xact:=msmqxact.BeginTransaction;
mSend.Send(q,xact);
end;
 
下列程序在队列位于非本地机器时正常,但队列位于本地机器时提示事务使用方式无效,为何
var
qinfo:MSMQQueueInfo;
q:MSMQQueue;
msend:MSMQMessage;
xact:olevariant;
formatname:string;
pathname:string;
msmqxact:MSMQCoordinatedTransactionDispenser;
begin
qinfo:=coMSMQQueueInfo.Create as MSMQQueueInfo;
q:=coMSMQQueue.Create as MSMQQueue;
msend:=coMSMQMessage.Create as MSMQMessage;
msmqxact:=coMSMQCoordinatedTransactionDispenser.Create as MSMQCoordinatedTransactionDispenser;
//formatname:='DIRECT=TCP:192.68.0.126/PRIVATE$/ReceiveTest';
//qinfo.FormatName:=formatname;
pathname:='./PRIVATE$/ReceiveTest';
qinfo.PathName:=pathname;
q:=qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE);
mSend.Body :='CM_table2_';
xact:=msmqxact.BeginTransaction;
mSend.Send(q,xact);
end;
 
后退
顶部