简体   繁体   English

如何停止消息队列服务

[英]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.

相关问题 如何阻止一个微服务消费消息队列中的消息-RabbitMQ - How to stop one micro service from consuming the message from Message queue-RabbitMQ 集成API服务与消息队列 - Integrate api service with message queue 互操作性 Azure 服务总线消息队列消息 - Interoperability Azure Service Bus Message Queue Messages 如何阻止阻塞队列大小增加线程池执行器服务? - How to stop blocking queue size from increasing in thread pool executor service? 如何将消息直接发送到 azure 服务总线(java)中的死信队列? - How can I send a message directly into a dead letter queue in azure service bus (java)? 如何在azure服务总线中一直监听队列并拦截每条消息 - How to listen a queue all the time in azure service bus and intercept each message 我们如何使用 java 对 azure 服务总线队列中存在的消息添加延迟? - How can we add a delay on the message which is present in azure service bus queue using java? 如何在UAT中运行集成测试,其中输出是到另一个服务消耗的队列的jms消息? - How to run integration tests in UAT where the output is a jms message to a queue consumed by another service? 如何从队列中删除消息 - How to remove a message from the queue 如何停止我的服务? - How to stop my service?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM