当消息禁用消费者时 ActiveMQ/Stomp 调试
我正在摸不着头脑试图调试一个 PHP 事务,它似乎让我的一个消费者出错了。在插入新消息之前,我可以通过 GREPping 进程列表来检测我的消费者是否正在运行,但无法知道之前有什么以及导致致命错误的原因。
我的 PHP 消费者大致是:
while($isRunning == true) {
try{
if($frame = $this->stomp->readFrame()) {
$body = $frame->body;
$this->stomp->ack($frame);
}
} catch(StompException $e) {
$msg = 'Stomp Monitor readFrame() Callback Fail: '.$e->getMessage();
error_log($msg);
}
}
有什么方法可以捕获致命错误或任何可以使其摆脱无限循环的方法吗?
谢谢, 史蒂夫
I am scratching my head trying to debug a PHP transaction that seems to error out one of my consumers. I can detect if my consumer is running by GREPping the process list, before I insert a new message, but no way of knowing what was in there before and what caused the fatal error.
My PHP consumer is roughly:
while($isRunning == true) {
try{
if($frame = $this->stomp->readFrame()) {
$body = $frame->body;
$this->stomp->ack($frame);
}
} catch(StompException $e) {
$msg = 'Stomp Monitor readFrame() Callback Fail: '.$e->getMessage();
error_log($msg);
}
}
Is there any way to catch fatal errors or anything that will break it out of the infinite loop?
Thanks,
Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试设置顶级 异常处理程序
也许有一个异常你没抓住。抓住它并记录下来,这样你就知道进程终止的原因。
Try setting a top level exception handler
Perhaps there is an exception that your not catching. Catch it and log it so you know why the process dies.