在 qpid cpp 客户端中接收传入消息时除外
excpetion on reception of incoming message in qpid cpp client
首先感谢您提供讨论问题的平台。
我发现 qpid cpp 客户端程序有问题。
try{
cout << "Trying to open a connection" << endl;
connection.open("1.1.1.8", 10002);
session = connection.newSession();
SubscriptionManager subscriptions(session);
Listener listener(subscriptions);
subscriptions.subscribe(listener, receiver_queue);
// subscriptions.run();
subscriptions.start();
sleep(10);
}
catch(const std::exception& error) {
DEBUG(DBG_ERR, (char *)"AMQP-[%s]: Connection Error [%s].", __func__,error.what());
connection.close();
return RESULT_FAILURE;
}
在 subscriptions.start 之后,如果我向客户端程序发送任何消息,我可以看到收到消息,但它失败并出现以下异常。
terminate called after throwing an instance of 'qpid::Exception'
what(): Invalid argument (../include/qpid/sys/posix/Mutex.h:116)
Aborted
堆栈说..
(gdb) bt
#0 0x0024b424 in __kernel_vsyscall ()
#1 0x00276af1 in raise () from /lib/libc.so.6
#2 0x002783ca in abort () from /lib/libc.so.6
#3 0x0026fdcb in __assert_fail_base () from /lib/libc.so.6
#4 0x0026fe86 in __assert_fail () from /lib/libc.so.6
#5 0x00b683b6 in unlock (this=0x88501fc, name="A.B.ToApplication")
at ../include/qpid/sys/posix/Mutex.h:120
#6 ~ScopedLock (this=0x88501fc, name="A.B.ToApplication")
at . ./include/qpid/sys/Mutex.h:34
#7 qpid::client::Dispatcher::find (this=0x88501fc,
name="A.B.ToApplication")
at qpid/client/Dispatcher.cpp:137
#8 0x00b68752 in qpid::client::Dispatcher::run (this=0x88501fc) at
qpid/client/Dispatcher.cpp:83
#9 0x00d5b701 in qpid::sys::(anonymous namespace)::runRunnable (p=0x88501fc) at
qpid/sys/posix/Thread.cpp:35
#10 0x00564a09 in start_thread () from /lib/libpthread.so.0
#11 0x0032915e in clone () from /lib/libc.so.6
(gdb)
我在这里错过了什么吗?
请帮助我。
不要使用 SubscriptionManager::
start() - 它被破坏了,因为它不允许处理异常 - 使用 SubscriptionManager::run() 代替,在需要时生成一个新线程。
我还强烈建议您迁移到 qpid::messaging API,而不是旧的和现在已弃用的 qpid::client API。前者更简单,可以更轻松地过渡到 AMQP 1.0,这就是所有新开发将发生的地方。
相关文章:
- .cpp和.h文件中的模板专用化声明
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- Linux的Cpp上的计时器
- boost::进程间消息队列引发错误
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- 命名空间中具有.h和.cpp文件的类
- 内置函数可查看CPP中的成员变量
- 无法编译 rtmidi 测试 cmidiin.cpp 文件, 非法指令
- Cpp-Tuple使用带有变量的get
- C++-试图将函数指针推回到另一个CPP文件中的矢量时出错
- 有充分的理由在h文件中使用include保护而不是cpp文件吗
- 如何通过cpp程序运行shell脚本
- 在线编译器中的分段C++没有打印消息
- C++错误消息*成员参考.**初学者*
- 使用2个键的cpp-stl::优先级队列排序不正确
- 使用 Microsoft VS 编写程序C++,但我在这里收到调试断言消息.它可以在 cpp.sh 上运行,repl.i
- 如何在 cpp 中使用味精包序列化嵌套消息
- 在 qpid cpp 客户端中接收传入消息时除外
- 协议缓冲cpp嵌入的消息
- ActiveMQ-CPP -消息重新传递延迟没有得到应用