activemq的MapMessage的问题

yanyanyan165 2009-02-16 05:12:41
我照着java的程序用vc做了一个activemq的客户端结果TextMessage类型可以接发,而MapMessage类型就只能发不能接
virtual void onMessage( const Message* message ){

static int count = 0;

try
{
count++;
const TextMessage* textMessage =
dynamic_cast< const TextMessage* >( message );
string text,sd,sd1,sd2,sd3;

if( textMessage != NULL ) {
// text = textMessage->getText();

sd3 = textMessage->getStringProperty("materialName");
sd=textMessage->getStringProperty("verifyOrderId");
sd1=textMessage->getStringProperty("supplierName");
sd2=textMessage->getStringProperty("vehicleCard");
text = "NOT A3333 TEXTMESSAGE!";
} else {
text = "NOT A TEXTMESSAGE!";
}

printf( "Message #%d Received: %s\n", count, text.c_str() );
} catch (CMSException& e) {
e.printStackTrace();
}

// No matter what, tag the count down latch until done.
doneLatch.countDown();
}

// If something bad happens you see it here as this class is also been
// registered as an ExceptionListener with the connection.
virtual void onException( const CMSException& ex AMQCPP_UNUSED) {
printf("CMS Exception occured. Shutting down client.\n");
}
以上是接收段源代码
...全文
318 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gao125210 2009-04-10
  • 打赏
  • 举报
回复
up
ActiveMQ 使用例子,包含静态库和头文件,VS2015 编译。 // testActiveMQ.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // START SNIPPET: demo /*extern "C" {*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //} #include #include #include #include using namespace activemq::core; using namespace decaf::util::concurrent; using namespace decaf::util; using namespace decaf::lang; using namespace cms; using namespace std; #pragma comment (lib, "apr-1.lib") #pragma comment (lib, "aprutil-1.lib") #pragma comment (lib, "libapriconv.lib") #pragma comment (lib, "libactivemq-cpp.lib") #ifdef _WIN32 #pragma comment(lib,"ws2_32.lib") #pragma comment(lib,"Mswsock.lib") #pragma comment(lib,"Rpcrt4

24,855

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧