尝试逐行将文件读取到MQ队列 [英] Trying to read a file onto an MQ queue, line by line

查看:84
本文介绍了尝试逐行将文件读取到MQ队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将这段代码以完整的方式读取文件到MQ队列中:

Hi, I am trying to take this piece of code that reads a file in it''s entirety onto an MQ queue:

String msgText = FileUtils.readFile(txtFileToSend.getText());
mtmqs.send(msgText,sendCount);


(sendCount是消息发送的次数)
并添加了功能,该功能可以将文件包含多行,并在每行中将其分别写入队列.这是我所做的(鉴于它是多行消息文件):


(sendCount is the number of times the message is sent)
and add in functionality that takes a file with multiple messages on individual lines and writes them individually to the queue. This is what I''ve done (given it''s a multi-line message file):

FileReader fr = new FileReader(txtFileToSend.getText());
BufferedReader br = new BufferedReader(fr);
String msgLine;
int count = 1;
while ((msgLine = br.readLine()) != null){
mtmqs.send(msgLine, sendCount);
log.info("sent line "+count+" of multi-line messages");
count++;
}
br.close();


这行不通.有人可以告诉我我要去哪里了.我非常感谢您的帮助.

谢谢,

Deji


This doesn''t work. Could someone please show me where I''m going wrong. I would really appreciate the help.

Thanks,

Deji

推荐答案

什么不起作用?读取文件还是发送到消息队列?
what does not work? reading the file or send to message queue?


托马斯,

感谢您的回复.尝试将消息发送到队列时失败.
Hi Thomas,

Thanks for your reply. It fails when it attempts to send the message to the queue.


我现在收到此错误:

java.lang.UnsatisfiedLinkError:mqjbnd05(在java.library.path中找不到)

我已经将我的MQ目录添加到了我的类路径中,所以我很困惑它是从哪里来的

我还添加了以下内容:-Djava.library.path =/usr/mqm/java/lib

我的VM参数.

我应该指出我正在使用RAD作为我的IDE.
I now get this error:

java.lang.UnsatisfiedLinkError: mqjbnd05 (Not found in java.library.path)

I''ve added my MQ directory to my classpath, so I''m confused to where this is coming from

I also added this: -Djava.library.path=/usr/mqm/java/lib

to my VM arguments.

I should point out I''m using RAD as my IDE.


这篇关于尝试逐行将文件读取到MQ队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆