I need to write a piece of code to put a message into MQ using C++. When I test it on localhost, using the default port (1414) it works. However, in the actual environment, which uses specific channel definition and different port (1420), it fails with reason code 2058 / MQRC_Q_MGR_NAME_ERROR. There is no problem connecting to the remote MQ using Websphere MQ Explorer. There is also no problem connecting to the same remote server in a C# app to prove connectivity. Any ideas what could be causing it?
Some sample code extract: C++ which fails when .connect() is called...
ImqChannel * pChannel_ = 0; // Channel definition which is at class level
ImqQueueManager queueManager_; // Queue Manager, also declared at class level
// extract from the MQHelper::Connect() method...
int MQClient::Connect() {
pChannel_ = new ImqChannel;
pChannel_->setChannelName("CLCHL.QM");
pChannel_->setTransportType(MQXPT_TCP);
pChannel_->setConnectionName("10.2.3.4(1420)");
pChannel_->setModeName("Client");
queueManager_.setName("QM");
queueManager_.setChannelReference(pChannel_);
if (!queueManager_.connect()) {
// ERROR IS HERE: _lastCompletionCode is 2, _lastReasonCode is 2058
_lastCompletionCode = queueManager_.completionCode();
_lastReasonCode = queueManager_.reasonCode();
return (int)_lastReasonCode;
}
// If we get here, we're all good:
return 0;
}
In C#, there is no such problem: the following code will connect fine..
queueManager = new MQQueueManager("QM", "CLCHL.QM", "10.2.3.4(1420)");
Other info:
- Server MQ installation is 7.0.1.0 Websphere MQ Explorer version:
- 7.5.0.1 (no problem connecting here) In the C# app, I am only referencing amqmdnet.dll... all fine.
- In the C++ app, I have the external dependencies set up for the 26 various mq .h or .hpp files.
- Also I have included the appropriate libs etc... again - I know it is capable of working as it the same code will work pointing to a localhost queue manager.
- I am using VS 2017
Any ideas?
Aucun commentaire:
Enregistrer un commentaire