我正在用 Delphi 编写一个应用程序来连接到远程 MQ 服务器并获取消息。
我在我的计算机上安装了一个 MQ 服务器并编写了一个测试应用程序。
一切都很好连接,打开,放置,获取,..一切都很好。
然后我尝试通过更改地址连接到远程 MQ,它工作但不正确,它仍然与本地 MQ 一起工作并从本地获取信息。没有切换到其他远程服务器!!!!
我的来源如下,我该怎么办?谢谢
var
QMgrName : MQCHAR48;
ConnectOpts : TMQCNO;
ClientConn : TMQCD;
Compcode : MQLONG;
Reason : MQLONG;
begin
StrPCopy(QMgrName, AQueueManager+#0);
ConnectOpts.StrucId := MQCNO_STRUC_ID;
ConnectOpts.Version := MQCNO_VERSION_1;
ConnectOpts.Options := MQCNO_STANDARD_BINDING;
ConnectOpts.ClientConnOffset := 0;
ConnectOpts.ClientConnPtr := @ClientConn;
with ClientConn do begin
StrPCopy(ClientConn.ConnectionName, format('%s(%s)'#0, [AIP,APort]));
Version := MQCD_VERSION_6;
ChannelType := MQCHT_CLNTCONN;
TransportType := MQXPT_TCP;
Desc := '';
QMgrName := '';
XmitQName := '';
ShortConnectionName := '';
MCAName := '';
ModeName := '';
TpName := '';
BatchSize := 50;
DiscInterval := 6000;
ShortRetryCount := 10;
ShortRetryInterval := 60;
LongRetryCount := 999999999;
LongRetryInterval := 1200;
SecurityExit := '';
MsgExit := '';
SendExit := '';
ReceiveExit := '';
SeqNumberWrap := 999999999;
MaxMsgLength := 4194304;
PutAuthority := MQPA_DEFAULT;
DataConversion := MQCDC_NO_SENDER_CONVERSION;
SecurityUserData := '';
MsgUserData := '';
SendUserData := '';
ReceiveUserData := '';
UserIdentifier := '';
Password := '';
MCAUserIdentifier := '';
MCAType := MQMCAT_PROCESS;
ConnectionName := '';
RemoteUserIdentifier := '';
RemotePassword := '';
MsgRetryExit := '';
MsgRetryUserData := '';
MsgRetryCount := 10;
MsgRetryInterval := 1000;
HeartbeatInterval := 1;
BatchInterval := 0;
NonPersistentMsgSpeed := MQNPMS_FAST;
StrucLength := MQCD_LENGTH_6;
ExitNameLength := MQ_EXIT_NAME_LENGTH;
ExitDataLength := MQ_EXIT_DATA_LENGTH;
MsgExitsDefined := 0;
SendExitsDefined := 0;
ReceiveExitsDefined := 0;
MsgExitPtr := nil;
MsgUserDataPtr := nil;
SendExitPtr := nil;
SendUserDataPtr := nil;
ReceiveExitPtr := nil;
ReceiveUserDataPtr := nil;
ClusterPtr := nil;
ClustersDefined := 0;
NetworkPriority := 0;
LongMCAUserIdLength := 0;
LongRemoteUserIdLength := 0;
LongMCAUserIdPtr := nil;
LongRemoteUserIdPtr := nil;
// MCASecurityId := MQSID_NONE_ARRAY;
// RemoteSecurityId := MQSID_NONE_ARRAY;
end;
MQCONNX(@QMgrName, ConnectOpts, HConn,Compcode,Reason);
if CompCode <> MQCC_OK then
raise Exception.Create(format('MQCONNX Fail, Completion Code: %d, Reason: %d',[CompCode,Reason]));