Во время тестирования приложения, использующего mq-очереди, возникла следующая проблема.
Каждый новый тред успешно подключается к входящей и исходящей очередям, отправляет и считывает сообщение в первой итерации, но начиная со второй итерации только отправляет, а при чтении получает ошибку 2033 "Сообщение не найдено". В то же время в исходящей очереди появляется никем не считанное сообщение.
Я использую groovy-скрипт для отправки/чтения, аналогичный алгоритм проверялся на HP LR и была получена та же ошибка.
class QueueController{
// параметры для подключения к MQ`
public String inputMgrName;
public String outputMgrName;
public String putQueueName;
public String getQueueName;
public String msgBody;
// менеджер и очереди
public MQQueueManager inputMgr;
public MQQueueManager outputMgr;
public MQQueue getQueue;
public MQQueue putQueue;
public MQPutMessageOptions pmo = new MQPutMessageOptions();
public MQGetMessageOptions gmo = new MQGetMessageOptions();
public MQMessage requestMsg = new MQMessage();
public MQMessage responseMsg = new MQMessage();
// queueMgrName - имя менеджера MQ
// putQueueName - имя очереди входящих сообщений
// getQueueName - имя очереди исходящих сообщений
// msgBody - тело сообщения
public QueueController(String inputMgrName, String outputMgrName, String putQueueName, String getQueueName, String msgBody){
this.inputMgrName = inputMgrName;
this.outputMgrName = outputMgrName;
this.putQueueName = putQueueName;
this.getQueueName = getQueueName;
this.msgBody = msgBody;
// параметры MQ enviroment - могут быть заменены
MQEnvironment.hostname="host";
MQEnvironment.port=port;
MQEnvironment.channel = "SYSTEM.ADMIN.SVRCONN";
MQEnvironment.userID = "user";
MQEnvironment.password = "password";
this.inputMgr = new MQQueueManager(inputMgrName);
this.putQueue = inputMgr.accessQueue(putQueueName, MQC.MQOO_BIND_NOT_FIXED | MQC.MQOO_OUTPUT);
// дополнительные настройки для MQ сообщения
public void initialRequestAndResponseMessage(){
requestMsg.clearMessage();
responseMsg.clearMessage();
requestMsg.replyToQueueName = getQueueName;
requestMsg.report=MQC.MQRO_PASS_MSG_ID;
requestMsg.format = MQC.MQFMT_STRING;
requestMsg.messageType=MQC.MQMT_REQUEST;
requestMsg.writeString(msgBody);
}
}
String msg = new String(Files.readAllBytes(Paths.get("X:/xxxx/xxxxxxx/File.xml")));
QueueController queueController = new QueueController("QM", "QM", "Q1", "Q2", msg);
vars.putObject('queueController',queueController);
UPDATE: Более детальное изучение ошибки привело к тому, что виновником оказалась ошибка установления tcp/ip с менеджером очередей mq (mq error code 9208), из-за которой менеджер блокирует все попытки получения сообщения после первого. В спойлере лог проблемы. Проблема все еще не устранена.
Настройки tcp connection keepAlive на генераторе, сервере и самом менеджере не дали результата.
Скрытый текст
AMQ9208: Error on receive from host b2lw5k2 (192.168.6.185).
EXPLANATION:
An error occurred receiving data from b2lw5k2 (192.168.6.185) over TCP/IP. This
may be due to a communications failure.
ACTION:
The return code from the TCP/IP read() call was 104 (X'68'). Record these
values and tell the systems administrator.
----- amqccita.c : 4117 -------------------------------------------------------
05/16/2018 01:02:48 PM - Process(6548.35) User(mqm) Program(amqrmppa)
Host(h2h-test1-mq1.vm.cmx.ru) Installation(Installation1)
VRMF(8.0.0.8) QMgr(MIXMOTD)
AMQ9999: Channel 'SYSTEM.ADMIN.SVRCONN' to host '192.168.6.185' ended
abnormally.
EXPLANATION:
The channel program running under process ID 6548 for channel
'SYSTEM.ADMIN.SVRCONN' ended abnormally. The host name is '192.168.6.185'; in
some cases the host name cannot be determined and so is shown as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide.
----- amqrmrsa.c : 930 --------------------------------------------------------
05/16/2018 01:09:01 PM - Process(6548.38) User(mqm) Program(amqrmppa)
Host(h2h-test1-mq1.vm.cmx.ru) Installation(Installation1)
VRMF(8.0.0.8) QMgr(MIXMOTD)