资源简介
ativemq异步消息服务器用C开发的客户端源码,来自apache官网的例子。本在linux 上编译通过测试。

代码片段和文件信息
/**
*
* 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.
*/
#include
#include “amqcs.h“
int die(int exitCode const char *message apr_status_t reason) {
char msgbuf[80];
apr_strerror(reason msgbuf sizeof(msgbuf));
fprintf(stderr “%s: %s (%d)\n“ message msgbuf reason);
exit(exitCode);
return reason;
}
static void terminate(void)
{
apr_terminate();
}
int main(int argc char *argv[])
{
apr_status_t rc;
amqcs_connection *connection;
apr_pool_t *pool;
amqcs_connect_options connect_options;
memset(&connect_options 0 sizeof(connect_options));
strcpy(connect_options.hostname “127.0.0.1“);
connect_options.port = 61616;
setbuf(stdout NULL);//取消输出缓存
rc = apr_initialize();
if( rc!=APR_SUCCESS )
return rc;
atexit(terminate);
//atexit注册终止函数(即main执行结束后调用的函数)
rc = apr_pool_create(&pool NULL);
rc==APR_SUCCESS || die(-2 “Could not allocate pool“ rc);
fprintf(stdout “Connecting......“);
rc=amqcs_connect( &connection &connect_options pool);
rc==APR_SUCCESS || die(-2 “Could not connect“ rc);
fprintf(stdout “OK\n“);
fprintf(stdout “Sending message.“);
{
char *buffer = “Hello World!“;
ow_ActiveMQQueue *dest;
ow_ActiveMQTextMessage *message = ow_ActiveMQTextMessage_create(pool);
message->content = ow_byte_array_create_with_data(poolsizeof(buffer)buffer);
dest = ow_ActiveMQQueue_create(pool);
dest->physicalName = ow_string_create_from_cstring(pool“TEST.QUEUE“);
rc = amqcs_send(connection (ow_ActiveMQDestination*)dest (ow_ActiveMQMessage*)message 140pool);
rc==APR_SUCCESS || die(-2 “Could not send message“ rc);
}
fprintf(stdout “OK\n“);
fprintf(stdout “Disconnecting...“);
rc=amqcs_disconnect(&connection);
rc==APR_SUCCESS || die(-2 “Could not disconnect“ rc);
fprintf(stdout “OK\n“);
apr_pool_destroy(pool);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2722 2011-11-29 11:28 src\examples\main.c
文件 8585 2011-11-28 18:49 src\libactivemq\amqcs.c
文件 1647 2011-11-28 18:49 src\libactivemq\amqcs.h
文件 8077 2011-11-28 18:50 src\libopenwire\ow.c
文件 10713 2011-11-28 18:50 src\libopenwire\ow.h
文件 8520 2011-11-28 18:50 src\libopenwire\ow_buffer.c
文件 126321 2011-11-28 18:50 src\libopenwire\ow_commands_v1.c
文件 25554 2011-11-28 18:50 src\libopenwire\ow_commands_v1.h
文件 128978 2011-11-28 18:50 src\libopenwire\ow_commands_v2.c
文件 27956 2011-11-28 18:50 src\libopenwire\ow_commands_v2.h
文件 4313 2011-11-28 18:50 src\libopenwire\ow_command_types_v1.h
文件 14329 2011-11-28 18:50 src\libopenwire\ow_marshal.c
文件 162 2011-11-30 16:20 src\Makefile
文件 245760 2011-11-29 11:20 src\prj\activemq_c.IAB
文件 2728 2011-11-29 11:20 src\prj\activemq_c.IAD
文件 61440 2011-11-29 11:20 src\prj\activemq_c.IMB
文件 928 2011-11-29 11:20 src\prj\activemq_c.IMD
文件 48 2011-11-29 11:28 src\prj\activemq_c.PFI
文件 776 2011-11-29 11:28 src\prj\activemq_c.PO
文件 4256 2011-11-29 11:19 src\prj\activemq_c.PR
文件 24800 2011-11-29 11:20 src\prj\activemq_c.PRI
文件 416924 2011-11-29 11:20 src\prj\activemq_c.PS
文件 67556 2011-12-01 14:20 src\prj\activemq_c.WK3
目录 0 2011-12-01 14:25 src\examples
目录 0 2011-12-01 14:25 src\libactivemq
目录 0 2011-12-01 14:25 src\libopenwire
目录 0 2011-12-01 14:25 src\prj
目录 0 2011-12-01 14:25 src
----------- --------- ---------- ----- ----
1193093 28
............此处省略1个文件信息
相关资源
- Navicat Premium 15汉化包.zip55438
- 登录注册界面.zip48872
- 条码字体barcode128
- Rational Rose Common破解文件
- res10_300x300_ssd_iter_140000.caffemodel与dep
- scratch 第1课 翻跟斗的小猫(入门)
- stm32f407上的两个can发送和接收例程
- Scrach 欢乐狙击手.sb2
- 04741计算机网络原理知识点整理.docx(
- Wolfram Mathematica 矩阵初等变换函数(
- pscad近海风电模型 Fortran语言
- 程序员专用字体YaHei.Consolas.1.11b42517
- scratch3.0 源程序(说相声)
- AutoCAD永久去教育版破解补丁
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- 欧姆龙CP1系列单轴定位PLC程序.cxp
- 用Beckhoff(倍福)PLC读写巴鲁夫RFID
- CVSNT 完整覆盖版防TortoiseCVS中文乱码
- pfc 使用说明.doc
- Scratch 飞机大战.sb3
- STC8951系列单片机中方指南
- 《Visual Prolog 基础类》 中文参考.chm
- Omron ETN21模块进行modbustcp通讯
- 基于ACCESS的生产管理信息系统.mdb
- CANopen使用手册_埃斯顿
- Scratch 吃豆人追踪者.sb3
- Scratch 变脸(将人物图片变成各种各样
- oracle数据迁移项目实施方案
评论
共有 条评论