[英]How to Stop Message Queue Service
I have wriiten startMQ method to process message from websphere message queue. 我有writiten startMQ方法来处理来自Websphere消息队列的消息。 Below is my code snippet.
以下是我的代码段。
void startMQ(){
try {
// getting connection
// getting session
// getting queue
for(; ;){
// Processing every messages from queue
}
} catch (Exception e){
} finally {
// closing queue
// closing session
// closing connection
}
}
public static void main(String arg[]){
Listener l = new Listener();
l.startMQ();
}
From bat file i will call main method to start message queue. 我将从bat文件中调用main方法来启动消息队列。
if i want to stop this. 如果我想停止这个。 How to acheive this.
如何做到这一点。 i thought in many ways but cannot able to implement it.
我想过很多方法,但无法实现。 Please help.
请帮忙。
After the queue is empty, the program will get an exception with RC=2033
which means "No Message Available." 队列为空后,程序将获得
RC=2033
的异常,表示“无可用消息”。 As it falls out of the Catch
block and into the Finally
block it should hit the close queue, close session, close connection. 由于它属于了的
Catch
块,并进入Finally
阻止它应该打的密切队列,结束会话,关闭连接。 That should do it, yeah? 应该这样做,是吗? You may be over-thinking this one.
您可能对此有过多的思考。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.