- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我正在调试一些使用 Apache POI 从 Microsoft Office 文档中提取数据的 Java 代码。偶尔会遇到大文档,内存不足时 POI 崩溃。此时,它会尝试将错误发布到 RabbitMQ,以便其他组件可以知道此步骤失败并采取适当的措施。但是,当它尝试发布到队列时,会收到 com.rabbitmq.client.AlreadyClosedException (clean connection shutdown;reason: Attempt to use closed channel)
。
这是错误处理程序代码:
try {
//Extraction and indexing code
}
catch(Throwable t) {
// Something went wrong! We'll publish the error and then move on with
// our lives
System.out.println("Error received when indexing message: ");
t.printStackTrace();
System.out.println();
String error = PrintExc.format(t);
message.put("error", error);
if(mime == null) {
mime = "application/vnd.unknown";
}
message.put("mime", mime);
publish("IndexFailure", "", MessageProperties.PERSISTENT_BASIC, message);
}
为了完整起见,这里是发布方法:
private void publish(String exch, String route,
AMQP.BasicProperties props, Map<String, Object> message) throws Exception{
chan.basicPublish(exch, route, props,
JSONValue.toJSONString(message).getBytes());
}
我在 try block 中找不到任何似乎关闭 RabbitMQ channel 的代码。是否存在可以隐式关闭 channel 的情况?
编辑:我应该注意,AlreadyClosedException 是由发布中的 basicPublish
调用引发的。
最佳答案
AMQP channel 因 channel 错误而关闭。可能导致 channel 错误的两种常见情况:
我会考虑在您尝试使用 addShutdownListener() 发布消息的 channel 上设置一个 ShutdownListener捕获关闭事件并查看导致它的原因。
关于java - 为什么我的 RabbitMQ channel 一直关闭?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8839094/
我有一个在 Android 市场上相当流行的应用程序,它允许数以万计的用户按下一个按钮并向它发出语音命令。然后我就可以做很多不同的事情,比如给他们提供当前的天气预报等等...... 无论如何,我的应用
令人惊讶的是,标题基本上解释了它。我们有一个我们的客户制作的页面,我们正在重新创建该页面。 页面高度会一直增加,直到(我假设是这样)浏览器达到它的极限。我已经尝试过 Firebug 和 W3 验证器,
我是 react-native 的新手,试图创建我自己的组件,但它一直显示一个空屏幕。 这是我的组件代码 class BoxComponent extends Component { cons
我正在为我的 PHP 元素创建一个非常简单的博客,但遇到了一个简单的问题。我无法让我的页眉图像一直 float 。我有一个横幅,左边有一些文字,我有一个 1px 的切片,在可以选择的任何分辨率的宽度上
为什么我可以在另一个 Controller 的 View 中访问一个 Controller 的辅助方法?有没有办法在不破解/修补 Rails 的情况下禁用它? 最佳答案 @George Schreib
我正在使用带有最新 ADT 插件的 Eclipse Kepler SP2。每隔一分钟 Eclipse 就会说“为 Android 4.4.2 加载数据”并阻止我想做的一切。我在不同的文件夹中有几个 E
我是一名优秀的程序员,十分优秀!