Added C++ client contributed by Amazon for AMQ-842

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@427057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-07-31 09:36:40 +00:00
parent 518e981b4b
commit 5ad1202426
344 changed files with 70503 additions and 0 deletions

1
amazon/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = command marshal amq_corelib amq_transport amq_brokersession amq_examples

587
amazon/Makefile.in Normal file
View File

@ -0,0 +1,587 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure config.guess \
config.sub depcomp install-sh ltmain.sh missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = command marshal amq_corelib amq_transport amq_brokersession amq_examples
all: all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-libtool clean-recursive \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-libtool distclean-recursive \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

7227
amazon/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,117 @@
/*
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 "BrokerSession.h"
#include "BrokerSessionImpl_.h"
#include "amq_corelib/BlockingMessageConsumerRef.h"
#include "amq_corelib/NonBlockingMessageConsumerRef.h"
#include "amq_corelib/Logger.h"
#include "amq_corelib/RCSID.h"
using namespace ActiveMQ;
using namespace std;
RCSID(BrokerSession, "$Id$");
BrokerSession::BrokerSession(const string& uri,
const string& user,
const string& password)
: impl_(new BrokerSessionImpl(uri, user, password))
{}
void
BrokerSession::connect() {
impl_->connect();
}
bool
BrokerSession::isConnected() const {
return impl_->isConnected();
}
void
BrokerSession::disconnect() {
impl_->disconnect();
}
void
BrokerSession::publish(const Message& msg) {
impl_->publish(msg);
}
void
BrokerSession::publish(const Destination& d, const Message& msg) {
impl_->publish(d, msg);
}
void
BrokerSession::subscribe(const Destination& dest, MessageConsumerRef& q) {
impl_->subscribe(dest, q);
}
void
BrokerSession::unsubscribe(const Destination& dest) {
impl_->unsubscribe(dest);
}
NonBlockingMessageConsumerRef
BrokerSession::newNonBlockingMessageConsumer() {
return impl_->newNonBlockingMessageConsumer();
}
BlockingMessageConsumerRef
BrokerSession::newBlockingMessageConsumer() {
return impl_->newBlockingMessageConsumer();
}
ExceptionCallback
BrokerSession::setExceptionCallback(ExceptionCallback c) {
return impl_->setExceptionCallback(c);
}
void
BrokerSession::setLogger(auto_ptr<Logger> lgr) {
impl_->setLogger(lgr);
}
void
BrokerSession::setLogger(Logger *lgr) {
setLogger(auto_ptr<Logger>(lgr));
}
Destination
BrokerSession::createTopic(const std::string& name) {
return impl_->createTopic(name);
}
Destination
BrokerSession::createQueue(const std::string& name) {
return impl_->createQueue(name);
}
Destination
BrokerSession::createTemporaryTopic() {
return impl_->createTemporaryTopic();
}
Destination
BrokerSession::createTemporaryQueue() {
return impl_->createTemporaryQueue();
}

View File

@ -0,0 +1,255 @@
/*
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.
*/
#ifndef ACTIVEMQ_BROKERSESSION_H
#define ACTIVEMQ_BROKERSESSION_H
#include <string>
#include <memory>
#include "BrokerSessionImpl_.h"
#include "amq_corelib/ExceptionCallback.h"
#include "amq_corelib/Logger.h"
/// Holds all of the ActiveMQ-related classes
/**
This namespace contains all classes needed to do asynchronous
messaging with ActiveMQ.
*/
namespace ActiveMQ {
class NonBlockingMessageConsumerRef;
class BlockingMessageConsumerRef;
class MessageConsumerRef;
class Transport;
class Destination;
class Message;
/// High-level ActiveMQ messaging library with background thread
/**
This class is the primary class for use with ActiveMQ if your application:
- doesn't have out-of-the-ordinary needs for message transport
- can tolerate a background thread
This library creates a background thread which listens to
messages from ActiveMQ. This thread takes care of shuffling
data between the core library(see ActiveMQ::CoreLib) and the
transport represented by the URI provided.
The BrokerSession library is able to be shared between multiple
threads (see ActiveMQ::BlockingMessageConsumer for a
multi-thread-friendly way to have messages delivered).
@version $Id$
*/
class BrokerSession {
public:
/// Creates a new handle on an ActiveMQ broker.
/**
Creates a new (unconnected) handle and state associated
with a logical ActiveMQ broker.
@param uri uri of the broker
@param user username to use for authentication
@param password password to use for authentication
*/
BrokerSession(const std::string& uri,
const std::string& user = "",
const std::string& password = "");
/// Connects to the broker
/**
Connects to the broker and enables the other commands.
Connection semantics / reconnects / timeouts etc work
within URI configuration options. See the ActiveMQ
documentation regarding transport URIs at:
http://www.activemq.org/Configuring+Transports
*/
void connect();
/// Checks connection
/**
Indicates whether this BrokerSession is connected.
@returns true if connected
*/
bool isConnected() const;
/// Disconnects from the broker
/**
Disconnects from the broker and disables the other commands.
*/
void disconnect();
/// Publishes a message
/**
Publishes a message. It extracts the Destination from the
message and calls publish(msg,dest).
When this method returns, the message has been guaranteed
to have been sent to the broker.
@param msg message to send
*/
void publish(const Message& msg);
/// Publishes a message
/**
Publishes a message on a given Destination.
When this method returns, the message has been guaranteed
to have been sent to the broker.
@param dest destination of the message
@param msg message to send
*/
void publish(const Destination& dest, const Message& msg);
/// Subscribes
/**
Subscribes this session to a particular Destination. When
a message is received on this Destination, it will be
delivered to the given consumer.
When this method returns, all new messages on the given
Destination will be passed to the given MessageConsumer.
Any existing MessageConsumers receiving on this Destination
will cease to.
@param dest destination to receive messages on
@param q MessageConsumer to deliver messages to
*/
void subscribe(const Destination& dest, MessageConsumerRef& q);
/// Unsubscribes
/**
Stops the receipt of messages from the broker on the given
Destination. After this call no more messages will be
received from the MessageConsumer subscribed to this
Destination.
Throws ActiveMQ::Exception if this destination is not already subscribed.
@param dest the Destination to stop listening to
*/
void unsubscribe(const Destination& dest);
/// Creates a new NonBlockingMessageConsumer
/**
This creates a new MessageConsumer with its own event fd
and nonblocking semantics.
@returns a weak reference to the new object (which is owned by the library).
*/
NonBlockingMessageConsumerRef newNonBlockingMessageConsumer();
/// Creates a new BlockingMessageConsumer
/**
This creates a new MessageConsumer with blocking semantics.
@returns a weak reference to the new object (which is owned by the library).
*/
BlockingMessageConsumerRef newBlockingMessageConsumer();
/// Sets the exception handler for internally-generated exceptions
/**
Since the BrokerSession library has an internal thread for
doing I/O and interaction with the core library, it needs a
way to communicate these exceptions to the user of the
library. This is done by setting this callback - any
function or function object that can be called with a const
ActiveMQ::Exception & will be implicitly constructed into
an ExceptionCallback object. The default handler simply
prints the exception message to stderr.
@param c The function/functor to call with an internally-generated exception.
@returns The previously-set exception handler
*/
ExceptionCallback setExceptionCallback(ExceptionCallback c);
/// Gets the exception handler
/**
Gets the callback that will be called on exceptions. See
documentation for setExceptionCallback above.
@returns the exception handler
*/
ExceptionCallback& getExceptionCallback() const;
/// Sets the handler for log events.
/**
Sets the handler for log events. This call will deallocate
any existing Logger set by a previous call.
Note this is passed in as an auto_ptr to demonstrate the
library's ownership of this memory. If this doesn't work
well with your application, there is a dumb pointer overload.
@param lgr the subclass instance of ActiveMQ::Logger to log with
*/
void setLogger(std::auto_ptr<Logger> lgr);
/// Sets the handler for log events.
/**
Sets the handler for log events. Any heap-allocated
pointer to an instance of a subclass of ActiveMQ::Logger
will be accepted. This call will deallocate any existing
Logger set by a previous call.
<b>The library will own this pointer and take care of freeing it.</b>
@param lgr the subclass instance of ActiveMQ::Logger to log with
*/
void setLogger(Logger *lgr);
/// Creates a new topic
/**
@returns a new Destination that represents a topic
*/
Destination createTopic(const std::string& name);
/// Creates a new queue
/**
@returns a new Destination that represents a queue
*/
Destination createQueue(const std::string& name);
/// Creates a new temporary topic
/**
@returns a new Destination that represents a temporary topic
*/
Destination createTemporaryTopic();
/// Creates a new temporary queue
/**
@returns a new Destination that represents a temporary queue
*/
Destination createTemporaryQueue();
private:
BrokerSession(const BrokerSession &);
BrokerSession& operator=(const BrokerSession &);
std::auto_ptr<BrokerSessionImpl> impl_;
};
};
#endif // ACTIVEMQ_BROKERSESSION_H

View File

@ -0,0 +1,285 @@
/*
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 <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <assert.h>
#include <pthread.h>
#include <sys/poll.h>
#include <memory>
#include <map>
#include <string>
#include <utility>
#include <iostream>
#include "BrokerSessionImpl_.h"
#include "amq_corelib/BlockingMessageConsumer.h"
#include "amq_corelib/NonBlockingMessageConsumer.h"
#include "amq_corelib/BlockingMessageConsumerRef.h"
#include "amq_corelib/NonBlockingMessageConsumerRef.h"
#include "amq_corelib/Buffer.h"
#include "amq_corelib/Lock.h"
#include "amq_corelib/CoreLib.h"
#include "amq_corelib/RCSID.h"
#include "amq_transport/TCPTransport.h"
#include "amq_transport/TransportFactory.h"
using namespace ActiveMQ;
using namespace std;
RCSID(BrokerSessionImpl, "$Id$");
#define READ_BUFFER_SIZE 4096
void *
BrokerSessionImpl::backgroundThreadTask_(void *arg) {
// If we're passed a bad argument there's nothing we can do -
// we're in a separate thread and can't get at the brokersession's
// exception callback
assert(arg != NULL);
BrokerSessionImpl *bsi(static_cast<BrokerSessionImpl *>(arg));
int listenfd = bsi->transport_->getFD();
unsigned char readbuf[READ_BUFFER_SIZE];
// The background thread just waits for data in the transport's
// socket, then hands it to the core library.
while (1) {
struct pollfd pfd;
pfd.fd = listenfd;
pfd.events = POLLIN;
int rc = poll(&pfd,1,-1);
if (rc == 1) {
try {
int numread = bsi->transport_->recv(readbuf, READ_BUFFER_SIZE);
if (numread == 0)
return NULL;
Buffer b;
bsi->corelib_.handleData(readbuf, numread, b);
if (!b.empty())
bsi->transport_->send(b);
} catch (const Exception& e) {
(bsi->getExceptionCallback())(e);
{
Lock l(&bsi->brokersessionMutex_);
bsi->connected_ = false;
}
return NULL;
}
}
else if (rc == -1 && errno != EINTR)
{
(bsi->getExceptionCallback())(Exception(errno >= sys_nerr
? "Unknown error" :
sys_errlist[errno]));
return NULL;
}
}
return NULL;
}
static
void
defaultErrorHandler_(const Exception& msg) {
cerr << "Exception: " << msg.what() << endl;
}
BrokerSessionImpl::BrokerSessionImpl(const string& uri,
const string& user,
const string& password)
: corelib_(user, password),
transport_(TransportFactory::instance().getFromURI(uri)),
connected_(false),
exceptionCB_(defaultErrorHandler_)
{
pthread_mutex_init(&brokersessionMutex_,NULL);
}
void
BrokerSessionImpl::disconnect() {
Lock l(&brokersessionMutex_);
if (connected_) {
l.unlock();
connected_ = false;
Buffer b;
corelib_.disconnect(b);
transport_->send(b);
pthread_join(backgroundThread_, NULL);
}
}
BrokerSessionImpl::~BrokerSessionImpl() {
try {
disconnect();
pthread_mutex_destroy(&brokersessionMutex_);
}
catch (...) {}
}
void
BrokerSessionImpl::connect() {
Lock l(&brokersessionMutex_);
if (!connected_) {
Buffer b;
transport_->connect();
corelib_.initialize(b);
transport_->send(b);
connected_ = true;
pthread_create(&backgroundThread_,
NULL,
BrokerSessionImpl::backgroundThreadTask_, this);
}
}
bool
BrokerSessionImpl::isConnected() const {
Lock l(&brokersessionMutex_);
return connected_;
}
void
BrokerSessionImpl::publish(const Message& m) {
publish(m.getDestination(), m);
}
void
BrokerSessionImpl::publish(const Destination &dest,
const Message& m) {
Lock l(&brokersessionMutex_);
if (!connected_)
throw Exception("BrokerSession is not connected");
Buffer b;
corelib_.publish(dest, m, b);
transport_->send(b);
}
void
BrokerSessionImpl::subscribe(const Destination& dest,
MessageConsumerRef& q) {
Lock l(&brokersessionMutex_);
if (!connected_)
throw Exception("BrokerSession is not connected");
Buffer b;
corelib_.subscribe(dest, q, b);
transport_->send(b);
}
void
BrokerSessionImpl::unsubscribe(const Destination& dest) {
Lock l(&brokersessionMutex_);
if (!connected_)
throw Exception("BrokerSession is not connected");
Buffer b;
corelib_.unsubscribe(dest, b);
transport_->send(b);
}
BlockingMessageConsumerRef
BrokerSessionImpl::newBlockingMessageConsumer() {
Lock l(&brokersessionMutex_);
return corelib_.newBlockingMessageConsumer();
}
NonBlockingMessageConsumerRef
BrokerSessionImpl::newNonBlockingMessageConsumer() {
Lock l(&brokersessionMutex_);
return corelib_.newNonBlockingMessageConsumer();
}
ExceptionCallback
BrokerSessionImpl::setExceptionCallback(ExceptionCallback c) {
Lock l(&brokersessionMutex_);
ExceptionCallback old;
old = exceptionCB_;
exceptionCB_ = c;
return old;
}
ExceptionCallback&
BrokerSessionImpl::getExceptionCallback() {
Lock l(&brokersessionMutex_);
return exceptionCB_;
}
void
BrokerSessionImpl::setLogger(auto_ptr<Logger> lgr) {
Lock l(&brokersessionMutex_);
corelib_.setLogger(lgr);
}
void
BrokerSessionImpl::fatal_(const string& msg) {
Lock l(&brokersessionMutex_);
corelib_.getLogger().logFatal(msg);
}
void
BrokerSessionImpl::error_(const string& msg) {
Lock l(&brokersessionMutex_);
corelib_.getLogger().logError(msg);
}
void
BrokerSessionImpl::warning_(const string& msg) {
Lock l(&brokersessionMutex_);
corelib_.getLogger().logWarning(msg);
}
void
BrokerSessionImpl::inform_(const string& msg) {
Lock l(&brokersessionMutex_);
corelib_.getLogger().logInform(msg);
}
void
BrokerSessionImpl::debug_(const string& msg) {
Lock l(&brokersessionMutex_);
corelib_.getLogger().logDebug(msg);
}
Destination
BrokerSessionImpl::createTopic(const std::string& name) {
return corelib_.createTopic(name);
}
Destination
BrokerSessionImpl::createQueue(const std::string& name) {
return corelib_.createQueue(name);
}
Destination
BrokerSessionImpl::createTemporaryTopic() {
return corelib_.createTemporaryTopic();
}
Destination
BrokerSessionImpl::createTemporaryQueue() {
return corelib_.createTemporaryQueue();
}

View File

@ -0,0 +1,86 @@
/*
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.
*/
#ifndef ACTIVEMQ_BROKERSESSION_IMPL_H
#define ACTIVEMQ_BROKERSESSION_IMPL_H
#include <memory>
#include "amq_corelib/CoreLib.h"
#include "amq_corelib/ExceptionCallback.h"
#include "amq_corelib/Logger.h"
namespace ActiveMQ {
class BrokerSession;
class NonBlockingMessageConsumerRef;
class BlockingMessageConsumerRef;
class MessageConsumer;
class Transport;
class Destination;
class Message;
/// Private implementation class for BrokerSession.
class BrokerSessionImpl {
public:
virtual ~BrokerSessionImpl();
private:
friend class BrokerSession;
BrokerSessionImpl(const std::string& uri,
const std::string& user = "",
const std::string& password = "");
void connect();
bool isConnected() const;
void disconnect();
void publish(const Message& msg);
void publish(const Destination& dest, const Message& msg);
void subscribe(const Destination& dest, MessageConsumerRef& q);
void unsubscribe(const Destination& dest);
NonBlockingMessageConsumerRef newNonBlockingMessageConsumer();
BlockingMessageConsumerRef newBlockingMessageConsumer();
ExceptionCallback setExceptionCallback(ExceptionCallback c);
ExceptionCallback& getExceptionCallback();
void setLogger(std::auto_ptr<Logger> lgr);
Destination createTemporaryTopic();
Destination createTemporaryQueue();
Destination createTopic(const std::string& name);
Destination createQueue(const std::string& name);
CoreLib corelib_;
std::auto_ptr<Transport> transport_;
bool connected_;
pthread_t backgroundThread_;
mutable pthread_mutex_t brokersessionMutex_;
ExceptionCallback exceptionCB_;
static void *backgroundThreadTask_(void *arg);
void fatal_(const std::string& msg);
void error_(const std::string& msg);
void warning_(const std::string& msg);
void inform_(const std::string& msg);
void debug_(const std::string& msg);
BrokerSessionImpl(const BrokerSessionImpl &);
BrokerSession& operator=(const BrokerSession &);
};
};
#endif // ACTIVEMQ_BROKERSESSION_IMPL_H

View File

@ -0,0 +1,5 @@
INCLUDES = -I../
lib_LTLIBRARIES = libamq_brokersession.la
libamq_brokersession_la_SOURCES = BrokerSession.cpp BrokerSessionImpl.cpp
libamq_brokersession_la_LIBADD = -L../amq_corelib -lamq_corelib -L../amq_transport -lamq_transport -lpthread
include_HEADERS = BrokerSession.h BrokerSessionImpl_.h

View File

@ -0,0 +1,476 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = amq_brokersession
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libamq_brokersession_la_DEPENDENCIES =
am_libamq_brokersession_la_OBJECTS = BrokerSession.lo \
BrokerSessionImpl.lo
libamq_brokersession_la_OBJECTS = \
$(am_libamq_brokersession_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libamq_brokersession_la_SOURCES)
DIST_SOURCES = $(libamq_brokersession_la_SOURCES)
includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I../
lib_LTLIBRARIES = libamq_brokersession.la
libamq_brokersession_la_SOURCES = BrokerSession.cpp BrokerSessionImpl.cpp
libamq_brokersession_la_LIBADD = -L../amq_corelib -lamq_corelib -L../amq_transport -lamq_transport -lpthread
include_HEADERS = BrokerSession.h BrokerSessionImpl_.h
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_brokersession/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_brokersession/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libamq_brokersession.la: $(libamq_brokersession_la_OBJECTS) $(libamq_brokersession_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libamq_brokersession_la_LDFLAGS) $(libamq_brokersession_la_OBJECTS) $(libamq_brokersession_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BrokerSession.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BrokerSessionImpl.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
$(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
rm -f "$(DESTDIR)$(includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-includeHEADERS install-info \
install-info-am install-libLTLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,79 @@
/*
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 "RCSID.h"
#include "BlockingMessageConsumer.h"
#include "Message.h"
#include "Lock.h"
#include <algorithm>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
using namespace ActiveMQ;
using std::auto_ptr;
RCSID(BlockingMessageConsumer, "$Id$");
BlockingMessageConsumer::BlockingMessageConsumer() {
pthread_mutex_init(&messages_lock_, NULL);
}
void
BlockingMessageConsumer::enqueue(Message *msg) {
{
Lock l(&messages_lock_);
messages_.push_back(msg);
}
ready_.post();
}
unsigned int
BlockingMessageConsumer::getNumReadyMessages() const {
Lock l(&messages_lock_);
return messages_.size();
}
auto_ptr<Message>
BlockingMessageConsumer::receive() {
ready_.wait();
Message *ret;
{
Lock l(&messages_lock_);
assert(!messages_.empty());
ret = messages_.front();
messages_.pop_front();
}
return auto_ptr<Message>(ret);
}
BlockingMessageConsumer::~BlockingMessageConsumer() {
pthread_mutex_destroy(&messages_lock_);
}
void
BlockingMessageConsumer::removeQueued(const Destination &d) {
Lock l(&messages_lock_);
messages_.erase(std::remove_if(messages_.begin(),
messages_.end(),
HasDest(d)),
messages_.end());
}

View File

@ -0,0 +1,75 @@
/*
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.
*/
#ifndef ACTIVEMQ_BLOCKINGMSGCONSUMER_H
#define ACTIVEMQ_BLOCKINGMSGCONSUMER_H
#include <pthread.h>
#include <memory>
#include <deque>
#include "MessageConsumer.h"
#include "Sem.h"
extern const char* const BlockingMessageConsumer_RCSID;
namespace ActiveMQ {
class CoreLib;
/// Message vendor with blocking semantics. (private)
/**
This class holds messages that have been received by a
BrokerSession object but not delivered to the application. It
contains an internal queue and a semaphore.
When a Message is enqueued, it is stored internally and one of
the threads waiting on the blocking receive() call is woken
with the new message.
<b>The user of the API never actually owns one of these.</b>
The library vends instances of BlockingMessageConsumerRef.
The BlockingMessageConsumer object is destroyed when all of
its references have been destroyed.
See BlockingMessageConsumerRef for usage details.
@version $Id$
*/
class BlockingMessageConsumer : public MessageConsumer {
private:
std::deque<Message *> messages_;
Semaphore ready_;
mutable pthread_mutex_t messages_lock_;
BlockingMessageConsumer(const BlockingMessageConsumer& oth);
const BlockingMessageConsumer& operator=(const BlockingMessageConsumer& oth);
friend class CoreLibImpl;
BlockingMessageConsumer();
virtual ~BlockingMessageConsumer();
void enqueue(Message *msg);
void removeQueued(const Destination &d);
friend class BlockingMessageConsumerRef;
unsigned int getNumReadyMessages() const;
std::auto_ptr<Message> receive();
};
};
#endif // ACTIVEMQ_BLOCKINGMSGCONSUMER_H

View File

@ -0,0 +1,77 @@
/*
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 "RCSID.h"
#include "BlockingMessageConsumerRef.h"
#include "BlockingMessageConsumer.h"
#include "CoreLib.h"
#include "Exception.h"
using namespace ActiveMQ;
using std::auto_ptr;
RCSID(BlockingMessageConsumerRef, "$Id$");
BlockingMessageConsumerRef::BlockingMessageConsumerRef
(CoreLib *a, BlockingMessageConsumer *q) :
MessageConsumerRef(a), cons_(q) {
if (isValid())
owner_->registerRef(this);
}
BlockingMessageConsumerRef::BlockingMessageConsumerRef
(const BlockingMessageConsumerRef& oth)
: MessageConsumerRef(oth), cons_(oth.cons_)
{
if (isValid())
owner_->registerRef(this);
}
BlockingMessageConsumerRef &
BlockingMessageConsumerRef::operator=(const BlockingMessageConsumerRef& oth) {
if (this == &oth)
return *this;
cons_ = oth.cons_;
MessageConsumerRef::operator=(oth);
return *this;
}
BlockingMessageConsumerRef::~BlockingMessageConsumerRef() {
if (isValid())
owner_->deregisterRef(this);
}
int
BlockingMessageConsumerRef::getNumReadyMessages() const {
if (!isValid())
throw Exception("getNumReadyMessages called on invalid reference!");
return cons_->getNumReadyMessages();
}
auto_ptr<Message>
BlockingMessageConsumerRef::receive() {
if (!isValid())
throw Exception("receive called on invalid reference!");
return cons_->receive();
}
bool
BlockingMessageConsumerRef::isValid() const {
return owner_ != NULL && cons_ != NULL;
}

View File

@ -0,0 +1,102 @@
/*
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.
*/
#ifndef ACTIVEMQ_BLOCKINGMSGCONSUMER_REF_H
#define ACTIVEMQ_BLOCKINGMSGCONSUMER_REF_H
#include <semaphore.h>
#include <pthread.h>
#include <memory>
#include <deque>
#include "MessageConsumerRef.h"
#include "BlockingMessageConsumer.h"
namespace ActiveMQ {
class CoreLib;
/// handle on message vendor with blocking semantics.
/**
This class is a handle on a BlockingMessageConsumer, which is
an object that holds messages that have been received by a
BrokerSession object but not yet received by the application. It
contains an internal queue and a semaphore (this class is
thread safe).
When a Message is enqueued, it is stored internally and the
semaphore is posted.
The receive() call will block until a message is ready, then
return that message.
BlockingMessageConsumers are owned by the library, so this weak
reference class is provided to allow flexible sharing of the
handle (like a pointer) while at the same time providing
protection from pointer invalidation. When the owning library
is destructed, it will nullify existing weak reference objects
so that calls will throw instead of crashing.
@version $Id$
*/
class BlockingMessageConsumerRef : public MessageConsumerRef {
public:
BlockingMessageConsumerRef() : MessageConsumerRef(), cons_(NULL) {}
BlockingMessageConsumerRef(const BlockingMessageConsumerRef &);
BlockingMessageConsumerRef& operator=(const BlockingMessageConsumerRef& oth);
virtual ~BlockingMessageConsumerRef();
/// gets the number of messages that are ready
/**
@returns the number of waiting messages
*/
int getNumReadyMessages() const;
/// blocking receive
/**
Receives a Message. If none are ready, this will block
until one is. It is returned as a std::auto_ptr to make
the ownership policy clear.
Note that a variant of receive() that returns a regular
pointer is defined on ActiveMQ::MessageConsumerRef.
@returns the new Message
*/
std::auto_ptr<Message> receive();
/// checks validity
/**
Since this class is a weak reference, it could be
invalidated. If it's invalid, calling these functions will
throw.
@returns true if the reference is invalid
*/
virtual bool isValid() const;
private:
friend class CoreLibImpl;
BlockingMessageConsumerRef(CoreLib *a, BlockingMessageConsumer *q);
BlockingMessageConsumer *cons_;
MessageConsumer *getConsumer() const { return cons_; }
};
};
#endif // ACTIVEMQ_BLOCKINGMSGCONSUMER_REF_H

View File

@ -0,0 +1,37 @@
/*
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.
*/
#ifndef ACTIVEMQ_BUFFER_H
#define ACTIVEMQ_BUFFER_H
#include <inttypes.h>
#include <vector>
namespace ActiveMQ {
/// A buffer of data
/**
A Buffer is just a vector of bytes. A vector is used to
encapsulate length information.
@version $Id$
*/
typedef std::vector<uint8_t> Buffer;
};
#endif // ACTIVEMQ_BUFFER_H

View File

@ -0,0 +1,62 @@
/*
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.
*/
#ifndef ACTIVEMQ_BYTESMESSAGE_H
#define ACTIVEMQ_BYTESMESSAGE_H
#include <vector>
#include "Message.h"
namespace ActiveMQ {
class CoreLibImpl;
/// Message containing a byte buffer
/**
Represents an ActiveMQ Message containing an opaque byte array.
@version $Id$
*/
class BytesMessage : public Message {
public:
/// gets the type
/**
Gets the integer type of this message.
@returns the type
*/
int getType() const { return Command::Types::ACTIVEMQ_BYTES_MESSAGE; }
/// Constructs a new BytesMessage.
/**
Makes a new BytesMessage containing the given data.
*/
BytesMessage(const Buffer& data) : data_(data) {}
/// gets the data as a byte array
/*
@param buf the buffer to put the data into
*/
void marshall(Buffer& buf) const { buf = data_; }
private:
Buffer data_;
};
};
#endif // ACTIVEMQ_BYTESMESSAGE_H

View File

@ -0,0 +1,147 @@
/*
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 <string>
#include <memory>
#include "MessageConsumer.h"
#include "NonBlockingMessageConsumerRef.h"
#include "BlockingMessageConsumerRef.h"
#include "RCSID.h"
#include "CoreLib.h"
#include "CoreLibImpl_.h"
using namespace ActiveMQ;
using std::string;
using std::auto_ptr;
RCSID(CoreLib, "$Id$");
CoreLib::CoreLib(const string& user,
const string& password) :
pimpl_(new CoreLibImpl(this,user,password))
{}
void
CoreLib::initialize(Buffer& b) {
pimpl_->initialize(b);
}
void
CoreLib::publish(const Message& m, Buffer& b) {
pimpl_->publish(m,b);
}
void
CoreLib::publish(const Destination& d,
const Message& m,
Buffer& b) {
pimpl_->publish(d,m,b);
}
void
CoreLib::disconnect(Buffer& b) {
return pimpl_->disconnect(b);
}
void
CoreLib::subscribe(const Destination& d, MessageConsumerRef& q, Buffer& b) {
return pimpl_->subscribe(d,q,b);
}
void
CoreLib::unsubscribe(const Destination& d, Buffer& b) {
return pimpl_->unsubscribe(d,b);
}
void
CoreLib::handleData(const Buffer& incoming, Buffer& b) {
pimpl_->handleData(incoming, b);
}
void
CoreLib::handleData(const unsigned char *buf, size_t len, Buffer& b) {
pimpl_->handleData(buf,len, b);
}
BlockingMessageConsumerRef
CoreLib::newBlockingMessageConsumer(void) {
return pimpl_->newBlockingMessageConsumer();
}
NonBlockingMessageConsumerRef
CoreLib::newNonBlockingMessageConsumer(void) {
return pimpl_->newNonBlockingMessageConsumer();
}
void
CoreLib::registerRef(MessageConsumerRef *q) {
pimpl_->registerRef(q);
}
void
CoreLib::deregisterRef(MessageConsumerRef *q) {
pimpl_->deregisterRef(q);
}
void
CoreLib::setLogger(auto_ptr<Logger> lgr) {
pimpl_->setLogger(lgr);
}
void
CoreLib::setLogger(Logger *c) {
setLogger(auto_ptr<Logger>(c));
}
Logger&
CoreLib::getLogger() {
return pimpl_->getLogger();
}
Destination
CoreLib::createTemporaryTopic() {
return pimpl_->createTemporaryTopic();
}
Destination
CoreLib::createTemporaryQueue() {
return pimpl_->createTemporaryQueue();
}
Destination
CoreLib::createTopic(const string& name) {
return pimpl_->createTopic(name);
}
Destination
CoreLib::createQueue(const string& name) {
return pimpl_->createQueue(name);
}
void
CoreLib::registerDest(const Destination& d) {
pimpl_->registerDest(d);
}
void
CoreLib::unregisterDest(const Destination& d) {
pimpl_->unregisterDest(d);
}

View File

@ -0,0 +1,252 @@
/*
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.
*/
#ifndef ACTIVEMQ_CORELIB_H
#define ACTIVEMQ_CORELIB_H
#include <string>
#include <memory>
#include "Buffer.h"
#include "Logger.h"
#include "CoreLibImpl_.h"
namespace ActiveMQ {
class MessageConsumer;
class MessageConsumerRef;
class NonBlockingMessageConsumerRef;
class BlockingMessageConsumerRef;
class Destination;
class Message;
/// Low-level, single-threaded library for ActiveMQ messaging
/**
This class is a bare-bones container for ActiveMQ messaging
functionality. Use this library if your application:
- has a restricted number of threads
- needs a simple interface
- has nonstandard transport needs
This library works on a "data in, messages out" model. The
calling application is responsible for doing socket
communication (likely using a subclass of ActiveMQ::Transport)
and shuttling data in and out of this library. This is to make
the core library as small and portable as possible, as well as
guaranteeing that it will never block. Most API functions
either take a buffer that has been received or return a
marshalled buffer with outgoing data.
@version $Id$
*/
class CoreLib {
public:
/// Creates a new handle on an ActiveMQ broker.
/**
Creates a new handle and state associated
with a logical ActiveMQ broker.
@param user username to use for authentication
@param password password to use for authentication
*/
CoreLib(const std::string& user,
const std::string& password);
/// Initiates OpenWire communication
/**
Gets initialization data and enables the other commands.
@param toSend buffer to fill in with data to send to the broker
*/
void initialize(Buffer& toSend);
/// Disconnects from the broker
/**
Disconnects from the broker and disables the other commands.
@param toSend buffer to fill in with data to send to the broker
*/
void disconnect(Buffer& toSend);
/// Publishes a message
/**
Publishes a message. It extracts the Destination from the
message and calls publish(msg,dest).
@param msg message to send
@param toSend buffer to fill in with data to send to the broker
*/
void publish(const Message& msg, Buffer& toSend);
/// Publishes a message
/**
Publishes a message on a given Destination. This overrides
any destination set as part of the Message.
@param dest destination of the message
@param msg message to send
@param toSend buffer to fill in with data to send to the broker
*/
void publish(const Destination& dest,
const Message& msg,
Buffer& toSend);
/// Subscribes
/**
Subscribes this session to a particular Destination. When
data is received that forms a Message on this Destination,
it will be enqueued on the given MessageConsumer.
@param dest destination to receive messages on
@param q MessageConsumer to deliver message to
@param toSend buffer to fill in with data to send to the broker
*/
void subscribe(const Destination& dest,
MessageConsumerRef& q,
Buffer& toSend);
/// Unsubscribes
/**
Stops the receipt of further messages on the given
Destination. After this call no more messages will be
received from the MessageConsumer subscribed to this
Destination.
Throws ActiveMQ::Exception if this destination is not already subscribed.
@param dest the Destination to stop listening to
@param toSend buffer to fill in with data to send to the broker
*/
void unsubscribe(const Destination& dest,
Buffer& toSend);
/// Notifies the library of data
/**
When there is data from the broker, pass it to this
function. If the incoming data forms a message, it will be
delivered to the appropriate MessageConsumer.
@param incoming the data read from the broker
@param toSend buffer to fill in with data to send to the broker
*/
void handleData(const Buffer& incoming, Buffer& toSend);
/// Notifies the library of data
/**
When there is data from the broker, pass it to this
function. If the incoming data forms a message, it will be
delivered to the appropriate MessageConsumer.
@param buf the data read from the broker
@param len the number of bytes in buf
@param toSend buffer to fill in with data to send to the broker
*/
void handleData(const unsigned char *buf, size_t len, Buffer& toSend);
/// Creates a new NonBlockingMessageConsumer
/**
This creates a new MessageConsumer with its own event fd
and nonblocking semantics.
@returns a weak reference to the new object (which is owned by the library).
*/
NonBlockingMessageConsumerRef newNonBlockingMessageConsumer();
/// Creates a new BlockingMessageConsumer
/**
This creates a new MessageConsumer with blocking semantics.
@returns a weak reference to the new object (which is owned by the library).
*/
BlockingMessageConsumerRef newBlockingMessageConsumer();
/// Sets the handler for log events.
/**
Sets the handler for log events. This call will deallocate
any existing Logger set by a previous call.
Note this is passed in as an auto_ptr to demonstrate the
library's ownership of this memory. If this doesn't work
well with your application, there is a dumb pointer overload.
@param lgr the subclass instance of ActiveMQ::Logger to log with
*/
void setLogger(std::auto_ptr<Logger> lgr);
/// Sets the handler for log events.
/**
Sets the handler for log events. Any heap-allocated
pointer to an instance of a subclass of ActiveMQ::Logger
will be accepted. This call will deallocate any existing
Logger set by a previous call.
<b>The library will own this pointer and take care of freeing it.</b>
@param lgr the subclass instance of ActiveMQ::Logger to log with
*/
void setLogger(Logger *lgr);
/// Gets the handlers for log events
/**
@returns a reference to the handler for log events
*/
Logger& getLogger();
/// Creates a new topic
/**
@param name the name of the topic
@returns a new Topic
*/
Destination createTopic(const std::string& name);
/// Creates a new queue
/**
@param name the name of the queue
@returns a new Queue
*/
Destination createQueue(const std::string& name);
/// Creates a new temporary topic
/**
@returns a new Temporary Topic
*/
Destination createTemporaryTopic();
/// Creates a new temporary queue
/**
@returns a new Temporary Queue
*/
Destination createTemporaryQueue();
private:
std::auto_ptr<CoreLibImpl> pimpl_;
friend class BlockingMessageConsumerRef;
friend class NonBlockingMessageConsumerRef;
friend class MessageConsumerRef;
void registerRef(MessageConsumerRef *mc);
void deregisterRef(MessageConsumerRef *mc);
friend class Destination;
void registerDest(const Destination& d);
void unregisterDest(const Destination& d);
};
};
#endif // ACTIVEMQ_CORELIB_H

View File

@ -0,0 +1,780 @@
/*
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 <netinet/in.h>
#include <unistd.h>
#include "RCSID.h"
#include <algorithm>
#include <string>
#include <sstream>
#include <list>
#include <utility>
#include <iostream>
#include "TextMessage.h"
#include "BytesMessage.h"
#include "PrimitiveMap.h"
#include "MessageConsumer.h"
#include "NonBlockingMessageConsumer.h"
#include "BlockingMessageConsumer.h"
#include "NonBlockingMessageConsumerRef.h"
#include "BlockingMessageConsumerRef.h"
#include "Exception.h"
#include "Destination.h"
#include "CoreLibImpl_.h"
#include "StompMessage.h"
#include "NullLogger.h"
#include "command/CommandTypes.h"
#include "command/ConnectionInfo.h"
#include "command/SessionInfo.h"
#include "command/ConsumerInfo.h"
#include "command/WireFormatInfo.h"
#include "command/ProducerInfo.h"
#include "command/ShutdownInfo.h"
#include "command/ActiveMQTopic.h"
#include "command/ActiveMQTempTopic.h"
#include "command/ActiveMQTempQueue.h"
#include "command/ActiveMQQueue.h"
#include "command/ActiveMQTextMessage.h"
#include "command/ActiveMQBytesMessage.h"
#include "command/ActiveMQDestination.h"
#include "command/MessageDispatch.h"
#include "command/Response.h"
#include "command/BrokerInfo.h"
#include "command/RemoveInfo.h"
#include "command/DestinationInfo.h"
#include "command/MessageAck.h"
#include "marshal/BaseDataStreamMarshaller.h"
#include "marshal/ProtocolFormat.h"
#include "marshal/MarshallerFactory.h"
#include "marshal/BufferWriter.h"
#include "marshal/BufferReader.h"
using namespace ActiveMQ;
using namespace std;
using boost::shared_ptr;
RCSID(CoreLibImpl, "$Id$");
#define FATAL(msg) \
do { if (logger_.get() && logger_->isEnabled(LogLevel::Fatal)) \
logger_->logFatal(msg); } while(0)
#define ERROR(msg) \
do { if (logger_.get() && logger_->isEnabled(LogLevel::Error)) \
logger_->logError(msg); } while(0)
#define WARNING(msg) \
do { if (logger_.get() && logger_->isEnabled(LogLevel::Warning)) \
logger_->logWarning(msg); } while(0)
#define INFORM(msg) \
do { if (logger_.get() && logger_->isEnabled(LogLevel::Inform)) \
logger_->logInform(msg); } while(0)
#define DEBUG(msg) \
do { if (logger_.get() && logger_->isEnabled(LogLevel::Debug)) \
logger_->logDebug(msg); } while(0)
const static int OPENWIRE_VERSION = 1;
const static int PREFETCH_SIZE = 32766;
const static int SESSION_ID = 12345;
const static int STANDARD_ACK = 2;
const static int ADD_DEST = 0;
const static int REMOVE_DEST = 1;
const static UUIDGenerator uuidgen;
const static string activemq = "ActiveMQ";
CoreLibImpl::CoreLibImpl(CoreLib *parent,
const string& user,
const string& password) :
parent_(parent),
user_(user),
password_(password),
sizeBufPos_(0),
inMessage_(false),
yetToRecv_(0),
sessionId_(SESSION_ID),
nextCommandId_(0),
nextProducerId_(0),
nextConsumerId_(0),
nextTempDestId_(0),
logger_(new NullLogger()),
initialized_(false) {
Marshalling::MarshallerFactory::configure(pf_);
clientId_ = uuidgen.getGuid();
connectionId_ = uuidgen.getGuid();
}
void
CoreLibImpl::marshalPending_(Buffer& b) {
if (!(pendingBuffer_.empty())) {
b.insert(b.end(), pendingBuffer_.begin(), pendingBuffer_.end());
pendingBuffer_.resize(0);
}
}
void
CoreLibImpl::marshalCommand_(Command::BaseCommand& o, Buffer& b) {
o.setCommandId(nextCommandId_++);
marshalCommand_(static_cast<Command::AbstractCommand&>(o), b);
}
void loosemarshalcommand(Command::WireFormatInfo& wfi, Buffer& b) {
size_t length = htonl(100);
int openwire_version = htonl(OPENWIRE_VERSION);
// size
//b.insert(b.end(), (uint8_t *)(&length), (uint8_t *)(&length) + 4);
// type
b.push_back(1);
// magic
b.push_back('A');
b.push_back('c');
b.push_back('t');
b.push_back('i');
b.push_back('v');
b.push_back('e');
b.push_back('M');
b.push_back('Q');
// openwire version
b.insert(b.end(), (uint8_t *)(&openwire_version), (uint8_t *)(&openwire_version) + 4);
// marshalled properties
// true it's there
b.push_back(1);
size_t mplen = htonl(wfi.getMarshalledProperties().size());
// length
b.insert(b.end(), (uint8_t *)(&mplen), (uint8_t *)(&mplen) + 4);
// data
b.insert(b.end(), wfi.getMarshalledProperties().begin(), wfi.getMarshalledProperties().end());
length = htonl(1 + 8 + 4 + 1 + 4 + ntohl(mplen));
b.insert(b.begin(), (uint8_t *)(&length), (uint8_t *)(&length) + 4);
}
void
CoreLibImpl::marshalCommand_(Command::AbstractCommand& o, Buffer& b) {
IO::BooleanStream bs;
// get the marshaller
Marshalling::BaseDataStreamMarshaller* marshaller = pf_.getMarshaller(o.getCommandType());
if (marshaller == NULL) {
stringstream exmsg("Invalid command type (");
exmsg << o.getCommandType();
exmsg << ") passed to marshalCommand";
throw Exception(exmsg.str());
}
// first pass gets the size and writes the flags bitset
uint32_t size = marshaller->marshal1(pf_, o, bs);
size = htonl(size + bs.getMarshalledSize());
// first 4 bytes of a message are its size
b.insert(b.end(), (uint8_t *)(&size), (uint8_t *)(&size) + 4);
// then one byte that is the command type
b.push_back(o.getCommandType());
IO::BufferWriter bw(b);
// then the bitset
bs.marshal(bw);
// then the second marshalling pass which actually writes the data out
marshaller->marshal2(pf_, o, bw, bs);
}
void
CoreLibImpl::unmarshalCommand_(Command::AbstractCommand& o, const Buffer& b) {
IO::BufferReader br(b);
IO::BooleanStream bs(br);
Marshalling::BaseDataStreamMarshaller *marshaller = pf_.getMarshaller(o.getCommandType());
if (marshaller == NULL) {
stringstream exmsg("Invalid command type (");
exmsg << o.getCommandType();
exmsg << ") received from broker";
throw Exception(exmsg.str());
}
marshaller->unmarshal(pf_, o, br, bs);
}
void
CoreLibImpl::initialize(Buffer& b) {
// The first step is wire format negotiation - though it's not really -
// see https://issues.apache.org/activemq/browse/AMQ-681
// In any case, the first packet sent is a WireFormatInfo packet
Command::WireFormatInfo wfi;
// It has a magic string prefix
vector<uint8_t> magic(activemq.begin(), activemq.end());
wfi.setMagic(magic);
// OpenWire version
wfi.setVersion(OPENWIRE_VERSION);
// We want "tight" encoding, which is length-prefixed
PrimitiveMap optionMap;
optionMap.putBoolean("TightEncodingEnabled", true);
Buffer marshalledOptions;
optionMap.marshal(marshalledOptions);
wfi.setMarshalledProperties(marshalledOptions);
// marshalCommand_(wfi, b);
loosemarshalcommand(wfi, b);
// The next command sets up our JMS Connection
Command::ConnectionInfo cinfo;
cinfo.setUserName(user_);
cinfo.setPassword(password_);
cinfo.setClientId(clientId_);
shared_ptr<Command::ConnectionId> cid(new Command::ConnectionId());
cid->setValue(connectionId_);
cinfo.setConnectionId(cid);
marshalCommand_(cinfo, b);
// Now we set up the JMS Session
Command::SessionInfo sinfo;
shared_ptr<Command::SessionId> sid(new Command::SessionId());
sid->setConnectionId(connectionId_);
sid->setValue(sessionId_);
sinfo.setSessionId(sid);
marshalCommand_(sinfo, b);
initialized_ = true;
}
void
CoreLibImpl::publish(const Message& m, Buffer& b) {
publish(m.getDestination(), m, b);
}
void
CoreLibImpl::publish(const Destination& d,
const Message& m,
Buffer &b) {
// Offload any pending data now that we have the opportunity
marshalPending_(b);
shared_ptr<Command::ActiveMQDestination> dest(d.createCommandInstance().release());
// Create our producer if we haven't already
if (producerId_.get() == NULL) {
Command::ProducerInfo pi;
shared_ptr<Command::ProducerId> pid(new Command::ProducerId());
pid->setConnectionId(connectionId_);
pid->setSessionId(sessionId_);
pid->setValue(nextProducerId_++);
producerId_ = pid;
pi.setProducerId(producerId_);
marshalCommand_(pi, b);
}
auto_ptr<Command::Message> message;
if (m.getType() == Command::Types::ACTIVEMQ_TEXT_MESSAGE)
message.reset(new Command::ActiveMQTextMessage());
else if (m.getType() == Command::Types::ACTIVEMQ_BYTES_MESSAGE)
message.reset(new Command::ActiveMQBytesMessage());
message->setProducerId(producerId_);
message->setDestination(dest);
message->setPersistent(false);
if (!(m.getReplyTo().getName().empty())) {
shared_ptr<Command::ActiveMQDestination> replyTo(m.getReplyTo().createCommandInstance().release());
message->setReplyTo(replyTo);
}
shared_ptr<Command::MessageId> mid(new Command::MessageId());
mid->setProducerId(producerId_);
message->setMessageId(mid);
Buffer content;
// serialize the message into the buffer
m.marshall(content);
message->setContent(content);
marshalCommand_(*message, b);
}
void
CoreLibImpl::disconnect(Buffer& b) {
marshalPending_(b);
// remove the sessionid
Command::RemoveInfo r;
shared_ptr<Command::SessionId> sidptr(new Command::SessionId());
sidptr->setValue(sessionId_);
sidptr->setConnectionId(connectionId_);
r.setObjectId(sidptr);
marshalCommand_(r, b);
// remove the connectionid
Command::RemoveInfo r2;
shared_ptr<Command::ConnectionId> cidptr(new Command::ConnectionId());
cidptr->setValue(connectionId_);
r2.setObjectId(cidptr);
marshalCommand_(r2, b);
// send shutdowninfo
Command::ShutdownInfo si;
marshalCommand_(si, b);
initialized_ = false;
}
CoreLibImpl::~CoreLibImpl() {
for (list<MessageConsumerRef *>::iterator i = consumerRefs_.begin();
i != consumerRefs_.end(); ++i) {
(*i)->invalidate();
deregisterRef(*i);
}
for (list<const Destination *>::iterator i = allRegisteredDestinations_.begin();
i != allRegisteredDestinations_.end(); ++i) {
const_cast<Destination*>(*i)->invalidate();
}
}
void
CoreLibImpl::subscribe(const Destination& d, MessageConsumerRef& q, Buffer& b) {
marshalPending_(b);
MessageConsumer *mcptr = q.getConsumer();
destinationMaps_.insert(pair<Destination, MessageConsumer *>(d, mcptr));
if (consumerIds_.count(d) == 0) {
// make a new consumer id if there isn't one for this destination
shared_ptr<Command::ConsumerId> cid(new Command::ConsumerId());
cid->setConnectionId(connectionId_);
cid->setSessionId(sessionId_);
cid->setValue(nextConsumerId_++);
consumerIds_[d] = cid;
}
Command::ConsumerInfo si;
shared_ptr<Command::ActiveMQDestination> dest(d.createCommandInstance().release());
si.setConsumerId(consumerIds_[d]);
si.setDestination(dest);
si.setPrefetchSize(PREFETCH_SIZE);
si.setDispatchAsync(true);
marshalCommand_(si, b);
}
void
CoreLibImpl::unsubscribe(const Destination& d, Buffer& b) {
marshalPending_(b);
map<Destination, MessageConsumer*>::iterator i = destinationMaps_.find(d);
if (i == destinationMaps_.end())
throw Exception("Not subscribed to destination " + d.getName());
i->second->removeQueued(d);
if (consumerIds_.count(d) != 0) {
// Remove the consumer for this destination
map<Destination, shared_ptr<Command::ConsumerId> >::iterator di = consumerIds_.find(d);
shared_ptr<Command::IDataStructure> ourcid(di->second);
Command::RemoveInfo ri;
ri.setObjectId(ourcid);
marshalCommand_(ri, b);
consumerIds_.erase(di);
}
}
void
CoreLibImpl::handleData(const Buffer& incoming, Buffer& b) {
handleData(&(incoming.operator[](0)), incoming.size(), b);
}
void
CoreLibImpl::unmarshalBuffer(vector<uint8_t>& buf, Buffer& b) {
int type = buf[0];
buf.erase(buf.begin());
switch (type) {
case Command::Types::BROKER_INFO: {
// BrokerInfo
// Ignore it, nothing to really do with it
}
break;
case Command::Types::SHUTDOWN_INFO: {
// ShutdownInfo, broker is exiting
Command::ShutdownInfo s;
unmarshalCommand_(s, buf);
INFORM("Got ShutdownInfo, shutting down");
disconnect(b);
}
break;
case Command::Types::MESSAGE_DISPATCH: {
// MessageDispatch, new message arriving
Command::MessageDispatch md;
unmarshalCommand_(md, buf);
shared_ptr<const Command::Message> m = md.getMessage();
if (m.get() != NULL) {
shared_ptr<const Command::ActiveMQDestination> dest = m->getDestination();
if (dest.get() != NULL) {
// Ack the message
Command::MessageAck ack;
auto_ptr<Command::ActiveMQDestination> destToAck;
Destination myd;
switch(dest->getCommandType()) {
case Command::Types::ACTIVEMQ_TOPIC:
destToAck.reset(new Command::ActiveMQTopic());
myd = Destination(parent_, dest->getPhysicalName(), false /* isTemp */, true /* isTopic */);
break;
case Command::Types::ACTIVEMQ_QUEUE:
destToAck.reset(new Command::ActiveMQQueue());
myd = Destination(parent_, dest->getPhysicalName(), false /* isTemp */, false /* isTopic */);
break;
case Command::Types::ACTIVEMQ_TEMP_TOPIC:
destToAck.reset(new Command::ActiveMQTempTopic());
myd = Destination(parent_, dest->getPhysicalName(), true /* isTemp */, true /* isTopic */);
break;
case Command::Types::ACTIVEMQ_TEMP_QUEUE:
destToAck.reset(new Command::ActiveMQTempQueue());
myd = Destination(parent_, dest->getPhysicalName(), true /* isTemp */, false /* isTopic */);
break;
};
destToAck->setPhysicalName(dest->getPhysicalName());
shared_ptr<Command::ConsumerId> cidToAck(consumerIds_[myd]);
ack.setConsumerId(cidToAck);
ack.setDestination(shared_ptr<Command::ActiveMQDestination>(destToAck));
ack.setAckType(STANDARD_ACK); // tells broker to discard the message
ack.setMessageCount(1);
marshalCommand_(ack, b);
const string& ourdestname(dest->getPhysicalName());
map<Destination, MessageConsumer *>::iterator i = destinationMaps_.find(myd);
if (i == destinationMaps_.end())
WARNING("No MessageConsumer registered for received message on destination " + ourdestname);
else {
int mtype = m->getCommandType();
auto_ptr<Message> toenqueue;
switch (mtype) {
case Command::Types::ACTIVEMQ_TEXT_MESSAGE:
toenqueue.reset(new TextMessage(m->getContent()));
break;
case Command::Types::ACTIVEMQ_BYTES_MESSAGE:
toenqueue.reset(new BytesMessage(m->getContent()));
break;
default:
WARNING("Unknown/unimplemented message command type");
return;
};
toenqueue->setDestination(myd);
if (m->getReplyTo() != NULL) {
const bool rtoIsTemp = m->getReplyTo()->getCommandType() == Command::Types::ACTIVEMQ_TEMP_QUEUE ||
m->getReplyTo()->getCommandType() == Command::Types::ACTIVEMQ_TEMP_TOPIC;
const bool rtoIsTopic = m->getReplyTo()->getCommandType() == Command::Types::ACTIVEMQ_TEMP_TOPIC ||
m->getReplyTo()->getCommandType() == Command::Types::ACTIVEMQ_TOPIC;
Destination rto(parent_, m->getReplyTo()->getPhysicalName(), rtoIsTemp, rtoIsTopic);
toenqueue->setReplyTo(rto);
}
i->second->enqueue(toenqueue.release());
}
}
}
}
break;
}
}
void
CoreLibImpl::handleData(const uint8_t *buf, size_t len, Buffer& b) {
if (!inMessage_) {
uint32_t msgsize = 0;
if (sizeBufPos_ == 0) {
if (len >= 4) {
msgsize = ntohl(*(uint32_t*)(buf));
buf += 4;
len -= 4;
}
else {
memcpy(sizeBuf_, buf, len);
sizeBufPos_ += len;
return;
}
}
else {
if (len + sizeBufPos_ >= 4) {
memcpy(sizeBuf_ + sizeBufPos_, buf, 4 - sizeBufPos_);
msgsize = ntohl(*(uint32_t*)(sizeBuf_));
buf += (4 - sizeBufPos_);
len -= (4 - sizeBufPos_);
}
else {
memcpy(sizeBuf_ + sizeBufPos_, buf, len);
sizeBufPos_ += len;
return;
}
}
if (msgsize == 0)
throw Exception("Zero-length message - corrupt data stream");
unmarshalBuffer_.resize(0);
unmarshalBuffer_.reserve(msgsize);
yetToRecv_ = msgsize;
inMessage_ = true;
sizeBufPos_ = 0;
}
// does this incoming message fill or exceed the buffer?
if (len == yetToRecv_) { // exact match
inMessage_ = false;
unmarshalBuffer_.insert(unmarshalBuffer_.end(), buf, buf + len);
unmarshalBuffer(unmarshalBuffer_, b);
}
else if (len < yetToRecv_) { // not yet
unmarshalBuffer_.insert(unmarshalBuffer_.end(), buf, buf + len);
yetToRecv_ -= len;
}
else if (len > yetToRecv_) { // too much
inMessage_ = false;
size_t excess = len - yetToRecv_; // number of excess bytes past the current message
size_t thismsg = len - excess; // number of bytes of this buffer that are the current message
unmarshalBuffer_.insert(unmarshalBuffer_.end(), buf, buf + thismsg);
unmarshalBuffer(unmarshalBuffer_, b);
handleData(buf + thismsg, excess, b);
}
}
BlockingMessageConsumerRef
CoreLibImpl::newBlockingMessageConsumer(void) {
BlockingMessageConsumer *q = new BlockingMessageConsumer();
consumers_.push_back(q);
refCounts_[q] = 0;
return BlockingMessageConsumerRef(parent_, q);
}
NonBlockingMessageConsumerRef
CoreLibImpl::newNonBlockingMessageConsumer(void) {
NonBlockingMessageConsumer *q = new NonBlockingMessageConsumer();
consumers_.push_back(q);
refCounts_[q] = 0;
return NonBlockingMessageConsumerRef(parent_, q);
}
void
CoreLibImpl::registerRef(MessageConsumerRef *q) {
if (NULL == q)
return;
MessageConsumer *mq = q->getConsumer();
consumerRefs_.push_back(q);
++refCounts_[mq];
}
void
CoreLibImpl::deregisterRef(MessageConsumerRef *q) {
if (NULL == q)
return;
MessageConsumer *mq = q->getConsumer();
int count = --refCounts_[mq];
if (count == 0) {
refCounts_.erase(mq);
// delete all references to the consumer
for(map<Destination, MessageConsumer *>::iterator i = destinationMaps_.begin();
i != destinationMaps_.end();) {
if (i->second == mq)
destinationMaps_.erase(i++);
else
++i;
}
consumers_.remove(mq);
// delete the consumer
delete mq;
}
consumerRefs_.remove(q);
}
void
CoreLibImpl::setLogger(auto_ptr<Logger> lgr) {
logger_ = lgr;
}
Logger&
CoreLibImpl::getLogger() {
return *logger_;
}
void
CoreLibImpl::registerDest(const Destination& d) {
map<string, int>::iterator i = destRefCounts_.find(d.toString());
if (i == destRefCounts_.end())
destRefCounts_.insert(pair<string,int>(d.toString(), 1));
else
i->second++;
allRegisteredDestinations_.push_back(&d);
}
void
CoreLibImpl::unregisterDest(const Destination& d) {
map<std::string, int>::iterator i = destRefCounts_.find(d.toString());
if (i == destRefCounts_.end())
return;
allRegisteredDestinations_.remove(&d);
if (i->second == 1) {
// This is the last reference to this destination
map<Destination, shared_ptr<Command::ConsumerId> >::iterator cii = consumerIds_.find(d);
// delete the relevant consumer, if there is one
if (cii != consumerIds_.end()) {
shared_ptr<Command::IDataStructure> ci(cii->second);
Command::RemoveInfo r;
r.setObjectId(ci);
marshalCommand_(r, pendingBuffer_);
consumerIds_.erase(cii);
}
// delete the destination, if it's our responsibility
// we know we created a temporary destination if our connection ID is in it
if (d.isTemporary() && d.getName().find(connectionId_) != string::npos) {
Command::DestinationInfo di;
shared_ptr<Command::ConnectionId> cid(new Command::ConnectionId());
cid->setValue(connectionId_);
shared_ptr<Command::ActiveMQDestination> dest(d.createCommandInstance().release());
di.setDestination(dest);
di.setOperationType(REMOVE_DEST);
di.setConnectionId(cid);
marshalCommand_(di, pendingBuffer_);
}
destRefCounts_.erase(i);
}
else
i->second--;
}
Destination
CoreLibImpl::createTemporaryTopic() {
stringstream str;
str << connectionId_ << ":" << nextTempDestId_++;
Destination ret(parent_, str.str(), true /* isTemp */, true /* isTopic */);
Command::DestinationInfo di;
shared_ptr<Command::ConnectionId> cid(new Command::ConnectionId());
cid->setValue(connectionId_);
shared_ptr<Command::ActiveMQDestination> dest(new Command::ActiveMQTempTopic());
dest->setPhysicalName(ret.getName());
di.setDestination(dest);
di.setOperationType(ADD_DEST);
di.setConnectionId(cid);
marshalCommand_(di, pendingBuffer_);
return ret;
}
Destination
CoreLibImpl::createTemporaryQueue() {
stringstream str;
str << connectionId_ << ":" << nextTempDestId_++;
Destination ret(parent_, str.str(), true /* isTemp */, false /* isTopic */);
Command::DestinationInfo di;
shared_ptr<Command::ConnectionId> cid(new Command::ConnectionId());
cid->setValue(connectionId_);
shared_ptr<Command::ActiveMQDestination> dest(new Command::ActiveMQTempQueue());
dest->setPhysicalName(ret.getName());
di.setDestination(dest);
di.setOperationType(ADD_DEST);
di.setConnectionId(cid);
marshalCommand_(di, pendingBuffer_);
return ret;
}
Destination
CoreLibImpl::createTopic(const std::string& name) {
return Destination(parent_, name, false /* isTemp */, true /* isTopic */);
}
Destination
CoreLibImpl::createQueue(const std::string& name) {
return Destination(parent_, name, false /* isTemp */, false /* isTopic */);
}

View File

@ -0,0 +1,150 @@
/*
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.
*/
#ifndef ACTIVEMQ_CORELIB_IMPL_H
#define ACTIVEMQ_CORELIB_IMPL_H
#include <string>
#include <map>
#include <list>
#include <memory>
#include <boost/shared_ptr.hpp>
#include "Destination.h"
#include "Message.h"
#include "Buffer.h"
#include "BlockingMessageConsumerRef.h"
#include "NonBlockingMessageConsumerRef.h"
#include "Logger.h"
#include "UUIDGenerator.h"
#include "marshal/ProtocolFormat.h"
namespace ActiveMQ {
namespace Command {
class BaseCommand;
class AbstractCommand;
class ProducerId;
class ConsumerId;
};
class CoreLib;
/// Private implementation class for CoreLib
class CoreLibImpl {
public:
virtual ~CoreLibImpl();
private:
friend class CoreLib;
CoreLibImpl(CoreLib *parent,
const std::string& user,
const std::string& password);
void initialize(Buffer& b);
void disconnect(Buffer& b);
void publish(const Message& msg, Buffer& b);
void publish(const Destination& dest,
const Message& msg,
Buffer& b);
void subscribe(const Destination& dest,
MessageConsumerRef& q,
Buffer& b);
void unsubscribe(const Destination& dest,
Buffer& b);
void handleData(const Buffer& incoming, Buffer& b);
void handleData(const uint8_t *buf, size_t len, Buffer& b);
NonBlockingMessageConsumerRef newNonBlockingMessageConsumer();
BlockingMessageConsumerRef newBlockingMessageConsumer();
void setLogger(std::auto_ptr<Logger> lgr);
Logger& getLogger();
Destination createTemporaryTopic();
Destination createTemporaryQueue();
Destination createTopic(const std::string& name);
Destination createQueue(const std::string& name);
void registerDest(const Destination& d);
void unregisterDest(const Destination& d);
CoreLibImpl(const CoreLibImpl &);
CoreLibImpl& operator=(const CoreLibImpl &);
CoreLib *parent_; // for passing to new MessageConsumerRef objects and destinations
const std::string user_;
const std::string password_;
std::map<Destination, MessageConsumer *> destinationMaps_;
std::list<MessageConsumer *> consumers_;
std::list<MessageConsumerRef *> consumerRefs_;
std::map<MessageConsumer *, int> refCounts_;
// Destinations are reference-counted
std::map<std::string, int> destRefCounts_;
std::list<const Destination*> allRegisteredDestinations_;
// State of asynchronous message unmarshalling
std::vector<uint8_t> unmarshalBuffer_;
uint8_t sizeBuf_[4];
uint8_t sizeBufPos_;
// Operations that don't have a way to pass up outgoing data
// can use the pending buffer.
std::vector<uint8_t> pendingBuffer_;
void marshalPending_(Buffer& b);
// Unmarshals a full buffer containing one message
void unmarshalBuffer(std::vector<uint8_t>& buf, Buffer& b);
// internal data used to track message unmarshalling state
bool inMessage_;
size_t yetToRecv_;
Marshalling::ProtocolFormat pf_;
// We only keep one connection / session open for the entire time
int64_t sessionId_;
std::string clientId_;
std::string connectionId_;
// Only one JMS producer is used for all outgoing messages
boost::shared_ptr<Command::ProducerId> producerId_;
// subject -> consumer id mapping
std::map<Destination, boost::shared_ptr<Command::ConsumerId> > consumerIds_;
// keep track of ids to use in allocation of new objects
int nextCommandId_;
int nextProducerId_;
int nextConsumerId_;
int nextTempDestId_;
// Marshal a command into a buffer
void marshalCommand_(Command::AbstractCommand& o, Buffer& b);
void marshalCommand_(Command::BaseCommand& o, Buffer& b);
// Unmarshal a command from a buffer
void unmarshalCommand_(Command::AbstractCommand& o, const Buffer& b);
std::auto_ptr<Logger> logger_;
void registerRef(MessageConsumerRef *mc);
void deregisterRef(MessageConsumerRef *mc);
bool initialized_;
};
};
#endif // ACTIVEMQ_CORELIB_IMPL_H

View File

@ -0,0 +1,120 @@
/*
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 <assert.h>
#include "Destination.h"
#include "CoreLib.h"
#include "command/ActiveMQTempTopic.h"
#include "command/ActiveMQTempQueue.h"
#include "command/ActiveMQQueue.h"
#include "command/ActiveMQTopic.h"
#include <iostream>
#include <sstream>
using namespace ActiveMQ;
using namespace std;
Destination::Destination() :
name_(""),
cl_(NULL),
temporary_(false),
isTopic_(false)
{}
Destination::Destination(CoreLib *corelib, const std::string& name, bool isTemp, bool isTopic) :
name_(name),
cl_(corelib),
temporary_(isTemp),
isTopic_(isTopic) {
stringstream str;
str << name_;
str << ":isTemporary=" << temporary_;
str << ":isTopic=" << isTopic_;
string_.assign(str.str());
assert(cl_ != NULL);
cl_->registerDest(*this);
}
Destination::Destination(const Destination& oth) :
name_(oth.name_),
cl_(oth.cl_),
temporary_(oth.temporary_),
isTopic_(oth.isTopic_),
string_(oth.string_)
{
if (cl_ != NULL) {
cl_->registerDest(*this);
}
}
Destination&
Destination::operator=(const Destination& oth) {
if (&oth != this) {
if (cl_ != NULL) {
cl_->unregisterDest(*this);
}
cl_ = oth.cl_;
name_ = oth.name_;
temporary_ = oth.temporary_;
isTopic_ = oth.isTopic_;
string_.assign(oth.string_);
if (cl_ != NULL) {
cl_->registerDest(*this);
}
}
return *this;
}
void
Destination::invalidate() {
cl_ = NULL;
}
Destination::~Destination() {
if (cl_ != NULL) {
cl_->unregisterDest(*this);
}
}
auto_ptr<Command::ActiveMQDestination>
Destination::createCommandInstance() const {
auto_ptr<Command::ActiveMQDestination> ret;
if (isTemporary()) {
if (isTopic())
ret.reset(new Command::ActiveMQTempTopic());
else
ret.reset(new Command::ActiveMQTempQueue());
}
else {
if (isTopic())
ret.reset(new Command::ActiveMQTopic());
else
ret.reset(new Command::ActiveMQQueue());
}
ret->setPhysicalName(name_);
return ret;
}

View File

@ -0,0 +1,81 @@
/*
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.
*/
#ifndef ACTIVEMQ_DESTINATION_H
#define ACTIVEMQ_DESTINATION_H
#include <string>
#include <memory>
#include "command/ActiveMQDestination.h"
namespace ActiveMQ {
class CoreLib;
class CoreLibImpl;
/// Message destination
/**
This class holds an ActiveMQ "destination." It can be either a
JMS Topic or Queue, or temporary versions of either of those.
Destinations are always constructed from the BrokerSession or
CoreLib objects, as there is broker communication involved in
setting up and tearing down destinations.
@version $Id$
*/
class Destination {
public:
/// Gets the name of the destination
const std::string& getName() const { return name_; }
/// Gets a normalized descriptive string of the destination
std::string toString() const { return string_; }
/// indicates whether or not the destination is temporary
bool isTemporary() const { return temporary_; }
/// indicates whether or not the destination is a topic
bool isTopic() const { return isTopic_; }
Destination();
virtual ~Destination();
Destination(const Destination& oth);
Destination& operator=(const Destination& oth);
bool operator<(const Destination& oth) const { return name_ < oth.name_; }
bool operator==(const Destination& oth) const { return name_ == oth.name_ && temporary_ == oth.temporary_ && isTopic_ == oth.isTopic_; }
bool operator!=(const Destination& oth) const { return !operator==(oth); }
private:
std::string name_;
CoreLib *cl_;
bool temporary_;
bool isTopic_;
std::string string_;
friend class CoreLibImpl;
Destination(CoreLib *corelib, const std::string& name, bool isTemp, bool isTopic);
std::auto_ptr<Command::ActiveMQDestination> createCommandInstance() const;
void invalidate();
};
};
#endif // ACTIVEMQ_DESTINATION_H

View File

@ -0,0 +1,50 @@
/*
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.
*/
#ifndef ACTIVEMQ_EXCEPTION_H
#define ACTIVEMQ_EXCEPTION_H
#include <exception>
#include <string>
namespace ActiveMQ {
/// Messaging library exception
/**
This class represents an error inside the messaging
library. This could be the result of bad function call
arguments, or a malformed/error message received back from
the broker.
@version $Id$
*/
class Exception : public std::exception {
public:
Exception(const std::string& desc) : desc_(desc) {}
Exception(const char *desc) throw() : desc_(desc) {}
Exception(const Exception& oth) : desc_(oth.desc_) {}
Exception& operator=(const Exception& oth) { desc_ = oth.desc_;
return *this; }
const char *what() const throw() {return desc_.c_str();}
virtual ~Exception() throw() {}
private:
std::string desc_;
};
};
#endif // ACTIVEMQ_EXCEPTION_H

View File

@ -0,0 +1,41 @@
/*
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 <iostream>
#include "RCSID.h"
#include "ExceptionCallback.h"
using namespace ActiveMQ;
using namespace std;
RCSID(ExceptionCallback, "$Id$");
void
ExceptionCallback::operator()(const Exception& e) const {
if (pimpl.get())
(*pimpl)(e);
}
ExceptionCallback::ExceptionCallback(const ExceptionCallback& oth) {
if (oth.pimpl.get())
pimpl.reset(oth.pimpl->clone());
else
pimpl.reset();
}

View File

@ -0,0 +1,70 @@
/*
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.
*/
#ifndef ACTIVEMQ_EXCEPTIONCALLBACK_H
#define ACTIVEMQ_EXCEPTIONCALLBACK_H
#include <memory>
#include "Exception.h"
namespace ActiveMQ {
/// Callback for BrokerSession exceptions.
/**
This class represents a function or function object that will
be called for exceptions raised in the BrokerSessions's
internal event thread. You shouldn't need to construct it
yourself - it will be implicitly constructed from any function
or function object that matches the void (*)(const Exception &)
signature.
@version $Id$
*/
class ExceptionCallback {
private:
struct Impl {
virtual void operator()(const Exception& msg) const = 0;
virtual Impl *clone() const = 0;
virtual ~Impl() {}
};
template<class T>
struct Wrapper : public Impl {
Wrapper(const T& callfunc) : f_(callfunc) {}
void operator()(const Exception& msg) const { f_(msg); }
Impl *clone() const { return new Wrapper<T>(f_); }
virtual ~Wrapper() {}
private:
const T f_;
};
std::auto_ptr<Impl> pimpl;
public:
ExceptionCallback() : pimpl(NULL) {}
ExceptionCallback(const ExceptionCallback& oth);
template<class T>
ExceptionCallback(T callfunc) : pimpl(new Wrapper<T>(callfunc)) {}
void operator()(const Exception& msg) const;
};
};
#endif // ACTIVEMQ_EXCEPTIONCALLBACK_H

View File

@ -0,0 +1,55 @@
/*
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 <errno.h>
#include <stdio.h>
#include "Lock.h"
#include "Exception.h"
#include "RCSID.h"
using ActiveMQ::Lock;
using ActiveMQ::Exception;
RCSID(Lock, "$Id$");
Lock::Lock(pthread_mutex_t *m)
: mutex_(m)
{
if (NULL == m)
throw Exception("NULL mutex passed to Lock");
int rc = pthread_mutex_lock(m);
if (rc != 0)
throw Exception(errno >= sys_nerr
? "Unknown error"
: sys_errlist[errno]);
locked_ = true;
}
void
Lock::unlock() {
if (locked_) {
pthread_mutex_unlock(mutex_);
locked_ = false;
}
}
Lock::~Lock() {
unlock();
}

47
amazon/amq_corelib/Lock.h Normal file
View File

@ -0,0 +1,47 @@
/*
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.
*/
#ifndef ACTIVEMQ_LOCK_H
#define ACTIVEMQ_LOCK_H
#include <pthread.h>
namespace ActiveMQ {
/// RAII lock class, used internally
/**
This class holds a lock for its lifetime. The constructor
acquires the lock, and the destructor releases it. This is to
allow exception-safe locking (the lock will be released during
stack unwind).
@version $Id$
*/
class Lock {
public:
Lock(pthread_mutex_t *m);
/// Explicit unlock for where implicit unlocking is inconvenient.
void unlock();
~Lock();
private:
pthread_mutex_t *mutex_;
bool locked_;
};
};
#endif // ACTIVEMQ_LOCK_H

View File

@ -0,0 +1,52 @@
/*
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 "LogLevel.h"
#include "RCSID.h"
using ActiveMQ::LogLevel;
RCSID(LogLevel, "$Id$");
static const char *loglevel_strings[] = {
"FATAL",
"ERROR",
"WARNING",
"INFORM",
"DEBUG"};
static const int loglevel_num = 5;
LogLevel::LogLevel(int n) {
if (n >= loglevel_num)
desc_ = "INVALID";
else
desc_ = loglevel_strings[n];
}
const char *
LogLevel::toString() const {
return desc_;
}
const LogLevel LogLevel::Fatal = LogLevel(0);
const LogLevel LogLevel::Error = LogLevel(1);
const LogLevel LogLevel::Warning = LogLevel(2);
const LogLevel LogLevel::Inform = LogLevel(3);
const LogLevel LogLevel::Debug = LogLevel(4);

View File

@ -0,0 +1,53 @@
/*
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.
*/
#ifndef ACTIVEMQ_LOGLEVEL_H
#define ACTIVEMQ_LOGLEVEL_H
namespace ActiveMQ {
/// Represents a (type-safe) level of logging information.
/**
@version $Id$
*/
class LogLevel {
public:
/// FATAL log level
static const LogLevel Fatal;
/// ERROR log level
static const LogLevel Error;
/// WARNING log level
static const LogLevel Warning;
/// INFORM log level
static const LogLevel Inform;
/// DEBUG log level
static const LogLevel Debug;
/// gets the descriptive string for a log level
const char *toString() const;
private:
LogLevel(int n);
const char *desc_;
};
};
#endif // ACTIVEMQ_LOGLEVEL_H

View File

@ -0,0 +1,55 @@
/*
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.
*/
#ifndef ACTIVEMQ_LOGGER_H
#define ACTIVEMQ_LOGGER_H
#include <string>
#include "LogLevel.h"
namespace ActiveMQ {
/// Log event handler interface
/**
This class represents a handler for log events. It is a way
for the library to access your local logging policy.
*/
class Logger {
public:
/// Test for a log level being enabled
virtual bool isEnabled(const LogLevel& level) = 0;
/// Log at FATAL
virtual void logFatal(const std::string& msg) = 0;
/// Log at ERROR
virtual void logError(const std::string& msg) = 0;
/// Log at WARNING
virtual void logWarning(const std::string& msg) = 0;
/// Log at INFORM
virtual void logInform(const std::string& msg) = 0;
/// Log at DEBUG
virtual void logDebug(const std::string& msg) = 0;
};
};
#endif // ACTIVEMQ_LOGGER_H

View File

@ -0,0 +1,6 @@
INCLUDES = -I../ -I../marshal
lib_LTLIBRARIES = libamq_corelib.la
libamq_corelib_la_SOURCES = BlockingMessageConsumer.cpp BlockingMessageConsumerRef.cpp CoreLib.cpp CoreLibImpl.cpp ExceptionCallback.cpp Lock.cpp LogLevel.cpp MessageConsumer.cpp MessageConsumerRef.cpp NonBlockingMessageConsumer.cpp NonBlockingMessageConsumerRef.cpp StompMessage.cpp TextMessage.cpp UUIDGenerator.cpp Destination.cpp PrimitiveMap.cpp Sem.cpp
libamq_corelib_la_LIBADD = -L../marshal -lamq_marshal -L../command -lamq_command
include_HEADERS = BlockingMessageConsumer.h BlockingMessageConsumerRef.h Buffer.h BytesMessage.h CoreLib.h CoreLibImpl_.h Destination.h ExceptionCallback.h Exception.h Lock.h Logger.h LogLevel.h MessageConsumer.h MessageConsumerRef.h Message.h NonBlockingMessageConsumer.h NonBlockingMessageConsumerRef.h NullLogger.h RCSID.h StompMessage.h TextMessage.h UUIDGenerator.h PrimitiveMap.h Sem.h

View File

@ -0,0 +1,495 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = amq_corelib
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libamq_corelib_la_DEPENDENCIES =
am_libamq_corelib_la_OBJECTS = BlockingMessageConsumer.lo \
BlockingMessageConsumerRef.lo CoreLib.lo CoreLibImpl.lo \
ExceptionCallback.lo Lock.lo LogLevel.lo MessageConsumer.lo \
MessageConsumerRef.lo NonBlockingMessageConsumer.lo \
NonBlockingMessageConsumerRef.lo StompMessage.lo \
TextMessage.lo UUIDGenerator.lo Destination.lo PrimitiveMap.lo \
Sem.lo
libamq_corelib_la_OBJECTS = $(am_libamq_corelib_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libamq_corelib_la_SOURCES)
DIST_SOURCES = $(libamq_corelib_la_SOURCES)
includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I../ -I../marshal
lib_LTLIBRARIES = libamq_corelib.la
libamq_corelib_la_SOURCES = BlockingMessageConsumer.cpp BlockingMessageConsumerRef.cpp CoreLib.cpp CoreLibImpl.cpp ExceptionCallback.cpp Lock.cpp LogLevel.cpp MessageConsumer.cpp MessageConsumerRef.cpp NonBlockingMessageConsumer.cpp NonBlockingMessageConsumerRef.cpp StompMessage.cpp TextMessage.cpp UUIDGenerator.cpp Destination.cpp PrimitiveMap.cpp Sem.cpp
libamq_corelib_la_LIBADD = -L../marshal -lamq_marshal -L../command -lamq_command
include_HEADERS = BlockingMessageConsumer.h BlockingMessageConsumerRef.h Buffer.h BytesMessage.h CoreLib.h CoreLibImpl_.h Destination.h ExceptionCallback.h Exception.h Lock.h Logger.h LogLevel.h MessageConsumer.h MessageConsumerRef.h Message.h NonBlockingMessageConsumer.h NonBlockingMessageConsumerRef.h NullLogger.h RCSID.h StompMessage.h TextMessage.h UUIDGenerator.h PrimitiveMap.h Sem.h
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_corelib/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_corelib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libamq_corelib.la: $(libamq_corelib_la_OBJECTS) $(libamq_corelib_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libamq_corelib_la_LDFLAGS) $(libamq_corelib_la_OBJECTS) $(libamq_corelib_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlockingMessageConsumer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlockingMessageConsumerRef.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoreLib.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoreLibImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Destination.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ExceptionCallback.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Lock.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogLevel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageConsumer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageConsumerRef.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NonBlockingMessageConsumer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NonBlockingMessageConsumerRef.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PrimitiveMap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StompMessage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TextMessage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UUIDGenerator.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
$(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
rm -f "$(DESTDIR)$(includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-includeHEADERS install-info \
install-info-am install-libLTLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,104 @@
/*
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.
*/
#ifndef ACTIVEMQ_MESSAGE_H
#define ACTIVEMQ_MESSAGE_H
#include <vector>
#include <time.h>
#include "Buffer.h"
#include "Destination.h"
#include "command/CommandTypes.h"
namespace ActiveMQ {
/// Represents an ActiveMQ message
/**
Contains an ActiveMQ message. The specific types
(ObjectMessage, BytesMessage, etc) are subclasses.
@version $Id$
*/
class Message {
protected:
Message() {}
public:
/// gets the type
/**
Gets the integer type of this message.
@returns the type
*/
virtual int getType() const = 0;
/// gets the destination
/**
Gets the Destination that this message was/will be sent to.
@returns destination of this message
*/
const Destination& getDestination() const { return destination_; }
/// sets the destination
void setDestination(const Destination& d) { destination_ = d; }
/// gets the reply-to destination
/**
Gets the "reply-to" Destination for this Message.
@returns the Destination for replies to this Message.
*/
const Destination& getReplyTo() const { return replyTo_; }
/// sets the reply-to destination
/**
Sets the "reply-to" Destination for this Message.
@param dest the destination to ask for replies to this message on
*/
void setReplyTo(const Destination& dest) { replyTo_ = dest; }
/// gets the time received
/**
Gets the time (in seconds since the epoch) that this
Message was received.
@returns time message was received
*/
time_t getTimestamp() const;
/// gets the underlying bytes
/**
Gets this Message's payload as an array of bytes.
@returns message data
*/
virtual void marshall(Buffer& fillIn) const = 0;
/// Destructor
virtual ~Message() {};
private:
Destination destination_;
Destination replyTo_;
};
};
#endif // ACTIVEMQ_MESSAGE_H

View File

@ -0,0 +1,38 @@
/*
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 <assert.h>
#include "MessageConsumer.h"
#include "Message.h"
#include "RCSID.h"
using namespace ActiveMQ;
RCSID(MessageConsumer, "$Id$");
MessageConsumer::HasDest::HasDest(const Destination& d)
: dest_(d)
{}
bool
MessageConsumer::HasDest::operator()(const Message *m) {
assert(m != NULL);
return m->getDestination() == dest_;
}

View File

@ -0,0 +1,84 @@
/*
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.
*/
#ifndef ACTIVEMQ_MSGCONSUMER_H
#define ACTIVEMQ_MSGCONSUMER_H
#include <memory>
namespace ActiveMQ {
class Message;
class CoreLib;
class Destination;
/// Base class for MessageConsumers
/**
This class provides the common interface for MessageConsumers,
which are objects that allow the application to receive
messages. See the documentation for
ActiveMQ::NonBlockingMessageConsumer and
ActiveMQ::BlockingMessageConsumer.
Note that the application never actually deals with one of
these directly - the application receives MessageConsumerRef
objects - weak, counted references to MessageConsumers.
@version $Id$
*/
class MessageConsumer {
public:
/// gets the number of messages that are ready
/**
Gets the number of waiting messages.
@returns the number
*/
virtual unsigned int getNumReadyMessages() const = 0;
/// receives a message
/**
Pulls a message from the internal queue. It is returned as
a std::auto_ptr to make the ownership policy clear.
@returns the new message
*/
virtual std::auto_ptr<Message> receive() = 0;
protected:
friend class CoreLibImpl;
MessageConsumer() {}
virtual ~MessageConsumer() {};
virtual void enqueue(Message *msg) = 0;
virtual void removeQueued(const Destination& dest) = 0;
class HasDest {
public:
HasDest(const Destination& d);
bool operator()(const Message *m);
private:
const Destination &dest_;
};
private:
MessageConsumer(const MessageConsumer& oth);
MessageConsumer &operator=(const MessageConsumer& oth);
};
};
#endif // ACTIVEMQ_MSGCONSUMER_H

View File

@ -0,0 +1,73 @@
/*
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 <stdlib.h>
#include "MessageConsumerRef.h"
#include "CoreLib.h"
#include "RCSID.h"
#include "Message.h"
using namespace ActiveMQ;
RCSID(MessageConsumerRef, "$Id$");
MessageConsumerRef::MessageConsumerRef()
: owner_(NULL)
{}
MessageConsumerRef::MessageConsumerRef(const MessageConsumerRef& oth)
: owner_(oth.owner_)
{}
MessageConsumerRef&
MessageConsumerRef::operator=(const MessageConsumerRef& oth) {
if (this == &oth)
return *this;
bool firstInit = (owner_ == NULL);
if (!firstInit)
owner_->deregisterRef(this);
owner_ = oth.owner_;
if (firstInit && owner_)
owner_->registerRef(this);
return *this;
}
MessageConsumerRef::MessageConsumerRef(CoreLib *owner) : owner_(owner) {
// leave it up to child classes to register
// Calling corelib->registerRef calls back to the pure virtual
// method getConsumer(), which when called from this constructor
// will call the actual pure virtual method (which calls
// std::terminate).
}
MessageConsumerRef::~MessageConsumerRef() {
}
void
MessageConsumerRef::invalidate() {
owner_ = NULL;
}
Message *
MessageConsumerRef::receivePtr() {
return receive().release();
}

View File

@ -0,0 +1,96 @@
/*
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.
*/
#ifndef ACTIVEMQ_MSGCONSUMER_REF_H
#define ACTIVEMQ_MSGCONSUMER_REF_H
#include <memory>
namespace ActiveMQ {
class Message;
class CoreLib;
class MessageConsumer;
/// Base class for MessageConsumerRefs
/**
This class provides the common interface for
MessageConsumerRefs, which are handles on objects allow the
application to receive Messages. They are weak references, so
they can be invalid, but you are free to copy them around. See
the documentation for ActiveMQ::NonBlockingMessageConsumerRef
and ActiveMQ::BlockingMessageConsumerRef.
@version $Id$
*/
class MessageConsumerRef {
public:
/// gets the number of messages that are ready
/**
Gets the number of waiting messages.
@returns the number
*/
virtual int getNumReadyMessages() const = 0;
/// receives a message
/**
Pulls a message from the internal queue. It is returned as
a std::auto_ptr to make the ownership policy clear.
@returns the new message
*/
virtual std::auto_ptr<Message> receive() = 0;
/// receives a dumb pointer to a message
/**
Just like receive(), but not in auto_ptr form. <b>Note:
the caller still owns this memory, but it's just not
enforced by the compiler.</b> The caller is responsible for
freeing this memory (using delete);
@returns a dumb pointer to the message
*/
Message *receivePtr();
/// checks validity
/**
Since this class is a weak reference, it could be
invalidated. If it's invalid, calling any function other
than isValid() will throw.
@returns true if the reference is invalid
*/
virtual bool isValid() const = 0;
protected:
MessageConsumerRef();
MessageConsumerRef(const MessageConsumerRef &);
MessageConsumerRef& operator=(const MessageConsumerRef &);
virtual ~MessageConsumerRef();
friend class CoreLibImpl;
MessageConsumerRef(CoreLib *parent);
CoreLib *owner_;
virtual MessageConsumer *getConsumer() const = 0;
private:
void invalidate();
};
};
#endif // ACTIVEMQ_MSGCONSUMER_REF_H

View File

@ -0,0 +1,73 @@
/*
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 "NonBlockingMessageConsumer.h"
#include "RCSID.h"
#include "Message.h"
#include <algorithm>
#include <unistd.h>
using namespace ActiveMQ;
using std::auto_ptr;
RCSID(NonBlockingMessageConsumer, "$Id$")
NonBlockingMessageConsumer::NonBlockingMessageConsumer() {
pipe(eventpipe_);
}
NonBlockingMessageConsumer::~NonBlockingMessageConsumer() {
close(eventpipe_[0]);
close(eventpipe_[1]);
}
void
NonBlockingMessageConsumer::enqueue(Message *msg) {
messages_.push_back(msg);
if (messages_.size() == 1)
write(eventpipe_[1], "0", 1);
}
auto_ptr<Message>
NonBlockingMessageConsumer::receive() {
if (messages_.empty())
return auto_ptr<Message>(NULL);
Message *ret = messages_.front();
messages_.pop_front();
if (messages_.empty()) {
unsigned char buf;
read(eventpipe_[0], &buf, 1);
}
return auto_ptr<Message>(ret);
}
unsigned int
NonBlockingMessageConsumer::getNumReadyMessages() const {
return messages_.size();
}
void
NonBlockingMessageConsumer::removeQueued(const Destination &d) {
messages_.erase(std::remove_if(messages_.begin(),
messages_.end(),
HasDest(d)),
messages_.end());
}

View File

@ -0,0 +1,77 @@
/*
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.
*/
#ifndef ACTIVEMQ_NONBLOCKINGMSGCONSUMER_H
#define ACTIVEMQ_NONBLOCKINGMSGCONSUMER_H
#include <deque>
#include <memory>
#include "MessageConsumer.h"
namespace ActiveMQ {
class CoreLib;
/// Message vendor with nonblocking semantics. (private)
/**
This class holds messages that have been received by a
BrokerSession object but not delivered to the application. It
contains an internal queue and an event file descriptor.
When a Message is enqueued, it is stored internally and the
event file descriptor is made read active. The receive() call
will return NULL if no message is ready. If a message is
ready, it will return the message (the fd will remain read
active as long as there are messages ready).
<b>The user of the API never actually owns one of these.</b>
The library vends instances of NonBlockingMessageConsumerRef.
The NonBlockingMessageConsumer object is destroyed when all of
its references have been destroyed.
See NonBlockingMessageConsumerRef for usage details.
<b>Unlike the BlockingMessageConsumer, this class does not do
thread synchronization for you.</b> This is to allow use of a
MessageConsumer without requiring that pthreads be compiled in.
@version $Id$
*/
class NonBlockingMessageConsumer : public MessageConsumer {
private:
int eventpipe_[2];
std::deque<Message *> messages_;
NonBlockingMessageConsumer(const NonBlockingMessageConsumer& oth);
const NonBlockingMessageConsumer& operator=(const NonBlockingMessageConsumer& oth);
friend class CoreLibImpl;
NonBlockingMessageConsumer();
virtual ~NonBlockingMessageConsumer();
void enqueue(Message *msg);
void removeQueued(const Destination &d);
friend class NonBlockingMessageConsumerRef;
int getEventFD() const { return eventpipe_[0]; }
unsigned int getNumReadyMessages() const;
std::auto_ptr<Message> receive();
};
};
#endif // ACTIVEMQ_NONBLOCKINGMSGCONSUMER_H

View File

@ -0,0 +1,95 @@
/*
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 "NonBlockingMessageConsumerRef.h"
#include "NonBlockingMessageConsumer.h"
#include "CoreLib.h"
#include "Exception.h"
#include "RCSID.h"
using namespace ActiveMQ;
using std::auto_ptr;
RCSID(NonBlockingMessageConsumerRef, "$Id$");
NonBlockingMessageConsumerRef::NonBlockingMessageConsumerRef()
: MessageConsumerRef(),
cons_(NULL)
{}
NonBlockingMessageConsumerRef::NonBlockingMessageConsumerRef
(CoreLib *a, NonBlockingMessageConsumer *q) :
MessageConsumerRef(a), cons_(q) {
if (isValid())
owner_->registerRef(this);
}
NonBlockingMessageConsumerRef::NonBlockingMessageConsumerRef
(const NonBlockingMessageConsumerRef& oth)
: MessageConsumerRef(oth), cons_(oth.cons_)
{
if (isValid())
owner_->registerRef(this);
}
NonBlockingMessageConsumerRef &
NonBlockingMessageConsumerRef::operator=
(const NonBlockingMessageConsumerRef& oth) {
if (this == &oth)
return *this;
cons_ = oth.cons_;
MessageConsumerRef::operator=(oth);
return *this;
}
NonBlockingMessageConsumerRef::~NonBlockingMessageConsumerRef() {
if (isValid())
owner_->deregisterRef(this);
}
int
NonBlockingMessageConsumerRef::getNumReadyMessages() const {
if (!isValid())
throw Exception("getNumReadyMessages called on invalid reference!");
return cons_->getNumReadyMessages();
}
auto_ptr<Message>
NonBlockingMessageConsumerRef::receive() {
if (!isValid())
throw Exception("receive called on invalid reference!");
return cons_->receive();
}
int
NonBlockingMessageConsumerRef::getEventFD() const {
if (!isValid())
throw Exception("getEventFD called on invalid reference!");
return cons_->getEventFD();
}
bool
NonBlockingMessageConsumerRef::isValid() const {
return owner_ != NULL && cons_ != NULL;
}
MessageConsumer *
NonBlockingMessageConsumerRef::getConsumer() const {
return cons_;
}

View File

@ -0,0 +1,111 @@
/*
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.
*/
#ifndef ACTIVEMQ_NONBLOCKINGMSGCONSUMER_REF_H
#define ACTIVEMQ_NONBLOCKINGMSGCONSUMER_REF_H
#include "MessageConsumerRef.h"
namespace ActiveMQ {
class CoreLib;
class NonBlockingMessageConsumer;
/// handle on message vendor with nonblocking semantics.
/**
This class is a handle on a NonBlockingMessageConsumer, which
is an object that holds messages that have been received by a
BrokerSession object but not delivered to the application. It
contains an internal queue and an event file descriptor.
When a Message is enqueued, it is stored internally and the
event file descriptor will become read active. When there are
no messages ready, it will be read unactive. <b>Do not read
data from this file descriptor</b> - no more than one byte is
ever actually on it.
The receive() call will return NULL if no message is ready. If
a message is ready, it will return the message.
NonBlockingMessageConsumers are owned by the library, so this
weak reference class is provided to allow flexible sharing of
the handle (like a pointer) while at the same time providing
protection from pointer invalidation. When the owning library
is destructed, it will nullify existing weak reference objects
so that calls will throw instead of crashing.
@version $Id$
*/
class NonBlockingMessageConsumerRef : public MessageConsumerRef {
public:
NonBlockingMessageConsumerRef();
NonBlockingMessageConsumerRef(const NonBlockingMessageConsumerRef &);
NonBlockingMessageConsumerRef& operator=(const NonBlockingMessageConsumerRef &);
virtual ~NonBlockingMessageConsumerRef();
/// gets the event file descriptor
/**
Gets the file descriptor that will have data on it when a
message is ready.
@returns the event file descriptor
*/
int getEventFD() const;
/// gets the number of messages that are ready
/**
Gets the number of waiting messages.
@returns the number
*/
int getNumReadyMessages() const;
/// nonblocking receive
/**
Receives a Message. If none are ready, this will return
NULL (specifically, an auto_ptr pointing to NULL).
If the queue is emptied as a result of this call, the event
file descriptor will become non-readable.
Note that a variant of receive() that returns a regular
pointer is defined on ActiveMQ::MessageConsumerRef.
@returns the new Message
*/
std::auto_ptr<Message> receive();
/// checks validity
/**
Since this class is a weak reference, it could be
invalidated. If it's invalid, calling these functions will
throw.
@returns true if the reference is invalid
*/
virtual bool isValid() const;
private:
friend class CoreLibImpl;
NonBlockingMessageConsumerRef(CoreLib *a, NonBlockingMessageConsumer *q);
NonBlockingMessageConsumer *cons_;
MessageConsumer *getConsumer() const;
};
};
#endif // ACTIVEMQ_NONBLOCKINGMSGCONSUMER_REF_H

View File

@ -0,0 +1,43 @@
/*
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.
*/
#ifndef ACTIVEMQ_NULLLOGGER_H
#define ACTIVEMQ_NULLLOGGER_H
#include "Logger.h"
namespace ActiveMQ {
/// default, "null" logger
/**
An instance of this class is used as the logger before one is
set explicitly. It reports all logging levels as disabled and
all log operations are no-ops.
*/
class NullLogger : public Logger {
public:
bool isEnabled(const LogLevel& l) { return false; }
void logFatal(const std::string& msg) {}
void logError(const std::string& msg) {}
void logWarning(const std::string& msg) {}
void logInform(const std::string& msg) {}
void logDebug(const std::string& msg) {}
};
};
#endif // ACTIVEMQ_NULLLOGGER_H

View File

@ -0,0 +1,131 @@
/*
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 <utility>
#include "PrimitiveMap.h"
#include "netinet/in.h"
using namespace std;
using ActiveMQ::PrimitiveMap;
using ActiveMQ::Buffer;
static const unsigned char NULL_TYPE = 0;
static const unsigned char BOOLEAN_TYPE = 1;
static const unsigned char BYTE_TYPE = 2;
static const unsigned char CHAR_TYPE = 3;
static const unsigned char SHORT_TYPE = 4;
static const unsigned char INTEGER_TYPE = 5;
static const unsigned char LONG_TYPE = 6;
static const unsigned char DOUBLE_TYPE = 7;
static const unsigned char FLOAT_TYPE = 8;
static const unsigned char STRING_TYPE = 9;
static const unsigned char BYTE_ARRAY_TYPE = 10;
PrimitiveMap::PrimitiveMap()
{}
PrimitiveMap::PrimitiveMap(const Buffer& b) {
// unmarshal from given buffer
const unsigned char *buf = &(b[0]);
int32_t count = ntohl(*((const int32_t*)buf));
buf += 4;
for (int i = 0; i < count; i++) {
// get the size of the key string
int16_t keysize = ntohs(*((const int16_t*)buf));
buf += 2;
// get the key string
std::string key((const char *)(buf), keysize);
buf += keysize;
// get the type
unsigned char type = *buf;
++buf;
bool val;
int bytearraylen;
short strsize;
switch (type) {
case BOOLEAN_TYPE:
val = (bool)(*buf);
++buf;
booleanMap_.insert(pair<string, bool>(key, val));
break;
// ignore the other types for now
case BYTE_TYPE:
++buf;
break;
case CHAR_TYPE:
++buf;
break;
case SHORT_TYPE:
buf += 2;
break;
case INTEGER_TYPE:
buf += 4;
break;
case LONG_TYPE:
buf += 8;
break;
case FLOAT_TYPE:
buf += 4;
break;
case DOUBLE_TYPE:
buf += 8;
break;
case BYTE_ARRAY_TYPE:
bytearraylen = ntohl(*(const int32_t*)buf);
buf += 4;
buf += bytearraylen;
break;
case STRING_TYPE:
strsize = ntohs(*(const int16_t*)buf);
buf += strsize;
break;
}
}
}
void
PrimitiveMap::marshal(Buffer& b) const {
// write the size
int32_t size = htonl(booleanMap_.size());
b.insert(b.end(), (unsigned char *)&size, ((unsigned char *)(&size)) + 4);
// write each key/val pair
for (map<string, bool>::const_iterator i = booleanMap_.begin();
i != booleanMap_.end(); ++i) {
// write the key size
int16_t keysize = htons(i->first.size());
b.insert(b.end(), (unsigned char *)&keysize, ((unsigned char *)(&keysize)) + 2);
// write the key
b.insert(b.end(), (unsigned char *)i->first.c_str(), ((unsigned char *)i->first.c_str()) + ntohs(keysize));
// write the value type
b.push_back(BOOLEAN_TYPE);
// write the value
b.push_back((unsigned char)i->second);
}
}

View File

@ -0,0 +1,44 @@
/*
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.
*/
#ifndef ACTIVEMQ_PRIMITIVEMAP_H
#define ACTIVEMQ_PRIMITIVEMAP_H
#include <string>
#include <map>
#include "Buffer.h"
namespace ActiveMQ {
class PrimitiveMap {
public:
PrimitiveMap();
PrimitiveMap(const Buffer& b);
void putBoolean(const std::string& key, bool val) { booleanMap_[key] = val; }
bool getBoolean(const std::string& key) const { return booleanMap_.find(key)->second; }
void marshal(Buffer& b) const;
private:
std::map<std::string, bool> booleanMap_;
};
};
#endif // ACTIVEMQ_PRIMITIVEMAP_H

View File

@ -0,0 +1,22 @@
/*
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.
*/
#define RCSID(name, id) \
static const char* _ ## name ## _rcs = #name " " id; \
static const void* const use_rcsid = (void *)(& _ ## name ## _rcs);

View File

@ -0,0 +1,69 @@
/*
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 <sys/types.h>
#include <unistd.h>
#include <sstream>
#include "Sem.h"
using ActiveMQ::Semaphore;
using std::string;
using std::stringstream;
Semaphore::Semaphore(unsigned int defvalue) {
#ifdef __APPLE__
sem_ = sem_open(getName_().c_str(), O_CREAT | O_EXCL, 700, defvalue);
#else
sem_ = new sem_t();
sem_init(sem_, 0, defvalue);
#endif
}
void
Semaphore::post() {
sem_post(sem_);
}
void
Semaphore::wait() {
sem_wait(sem_);
}
/* static */
string
Semaphore::getName_() {
stringstream ss;
ss << getpid() << ":" << ++counter_;
return ss.str();
}
/* static */
int
Semaphore::counter_ = 0;
Semaphore::~Semaphore() {
#ifdef __APPLE__
sem_close(sem_);
#else
sem_destroy(sem_);
delete sem_;
#endif
}

55
amazon/amq_corelib/Sem.h Normal file
View File

@ -0,0 +1,55 @@
/*
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.
*/
#ifndef ACTIVEMQ_SEMAPHORE_H
#define ACTIVEMQ_SEMAPHORE_H
#include <semaphore.h>
#include <string>
namespace ActiveMQ {
/// Abstraction class for Semaphores
/**
This class holds a logical semaphore. Since semaphores don't
have exactly the same API across platforms, this class is
provided to keep preprocessor statements out of the rest of the
code.
*/
class Semaphore {
public:
/// Constructs a new semaphore
explicit Semaphore(unsigned int defvalue = 0);
/// Posts on the semaphore, waking a blocked thread
void post();
/// Waits for another thread to post
void wait();
~Semaphore();
private:
sem_t *sem_;
static std::string getName_();
static int counter_;
};
};
#endif // ACTIVEMQ_SEMAPHORE_H

View File

@ -0,0 +1,58 @@
/*
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 "StompMessage.h"
#include "Exception.h"
#include "RCSID.h"
using namespace std;
using ActiveMQ::Exception;
using ActiveMQ::StompMessage;
RCSID(StompMessage, "$Id$");
StompMessage::StompMessage(const string& buf)
{
string::size_type newline = buf.find("\n", 0);
if (newline == string::npos)
throw Exception(string("Invalid message: ") + buf);
if (newline == 0) {
newline = buf.find("\n", 1);
if (newline == string::npos)
throw Exception(string("Invalid message: ") + buf);
type_ = string(buf, 1, newline - 1);
}
else
type_ = string(buf, 0, newline);
if (buf.find("\n", newline + 1) == newline + 1) // no headers
msg_ = string(buf, newline + 1, buf.size() - newline);
else {
do {
string::size_type colon_pos = buf.find(":", newline + 1);
if (colon_pos == string::npos)
throw Exception(string("Invalid message: ") + buf);
string key = string(buf, newline + 1, colon_pos - newline - 1);
newline = buf.find("\n", colon_pos);
if (newline == string::npos)
throw Exception(string("Invalid message: ") + buf);
headers_[key] = string(buf, colon_pos + 1, newline - colon_pos - 1);
} while (buf[newline + 1] != '\n');
msg_ = string(buf, newline + 2, buf.size() - newline - 2);
}
}

View File

@ -0,0 +1,44 @@
/*
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.
*/
#ifndef STOMP_MESSAGE_H
#define STOMP_MESSAGE_H
#include <string>
#include <map>
namespace ActiveMQ {
class StompMessage {
public:
typedef std::map<std::string, std::string> HeaderMap;
StompMessage(const std::string& buf);
StompMessage() {}
const std::string &getType() const { return type_; }
const std::string &getMsg() const { return msg_; }
const std::map<std::string, std::string> &getHeaders() const { return headers_; }
private:
std::string type_;
std::string msg_;
HeaderMap headers_;
};
};
#endif // STOMP_MESSAGE_H

View File

@ -0,0 +1,43 @@
/*
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 <algorithm>
#include <netinet/in.h>
#include "TextMessage.h"
#include "Buffer.h"
#include "RCSID.h"
using namespace ActiveMQ;
using std::copy;
using std::vector;
RCSID(TextMessage, "$Id$");
TextMessage::TextMessage(const vector<unsigned char>& serializeFrom) {
text_.assign(serializeFrom.begin() + 4, serializeFrom.end());
}
void
TextMessage::marshall(Buffer& buf) const {
buf.resize(text_.size() + sizeof(int));
int size = htonl(text_.size());
copy((unsigned char *)(&size), ((unsigned char *)(&size)) + sizeof(int), buf.begin());
copy(text_.begin(), text_.end(), buf.begin()+sizeof(int));
}

View File

@ -0,0 +1,75 @@
/*
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.
*/
#ifndef ACTIVEMQ_TEXTMESSAGE_H
#define ACTIVEMQ_TEXTMESSAGE_H
#include <string>
#include <vector>
#include "Message.h"
namespace ActiveMQ {
class CoreLibImpl;
/// Message containing a text string
/**
@version $Id$
*/
class TextMessage : public Message {
public:
/// gets the type
/**
Gets the integer type of this message.
@returns the type
*/
int getType() const { return Command::Types::ACTIVEMQ_TEXT_MESSAGE; }
/// Constructs a new TextMessage.
/**
Makes a new TextMessage containing the given string.
*/
TextMessage(const std::string& data) : text_(data) {}
/// gets the string data
/**
Gets the string this TextMessage represents.
@returns message contents
*/
const std::string& getText() const { return text_; }
/// gets the data as a byte array
/**
Gets the string data as an opaque byte array.
@param buf the buffer the put the data in
*/
void marshall(Buffer& buf) const;
private:
std::string text_;
friend class CoreLibImpl;
TextMessage(const Buffer& deserializeFrom);
};
};
#endif // ACTIVEMQ_TEXTMESSAGE_H

View File

@ -0,0 +1,64 @@
/*
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 <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <sstream>
#include "UUIDGenerator.h"
using ActiveMQ::UUIDGenerator;
using namespace std;
UUIDGenerator::UUIDGenerator() {
char localHostName[64];
gethostname(localHostName, sizeof(localHostName));
hostname_.assign(localHostName);
srand(time(NULL));
}
string
UUIDGenerator::getGuid() const {
string ret(hostname_);
ret += ":";
ret += timestamp();
ret += ":";
ret += rand();
return ret;
}
string
UUIDGenerator::timestamp() const {
struct timeval tv;
gettimeofday(&tv, NULL);
stringstream ret;
ret << tv.tv_sec;
ret << ".";
ret << tv.tv_usec;
return ret.str();
}
string
UUIDGenerator::rand() const {
stringstream ret;
ret << ::rand();
return ret.str();
}

View File

@ -0,0 +1,38 @@
/*
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.
*/
#ifndef ACTIVEMQ_UUID_GENERATOR_H
#define ACTIVEMQ_UUID_GENERATOR_H
#include <string>
namespace ActiveMQ {
class UUIDGenerator {
public:
UUIDGenerator();
std::string getGuid() const;
private:
std::string timestamp() const;
std::string rand() const;
std::string hostname_;
};
};
#endif // ACTIVEMQ_UUID_GENERATOR_H

View File

@ -0,0 +1 @@
SUBDIRS = bs_async_recv bs_send bs_sync_recv cl_send

View File

@ -0,0 +1,465 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = amq_examples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = bs_async_recv bs_send bs_sync_recv cl_send
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_examples/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_examples/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
clean clean-generic clean-libtool clean-recursive ctags \
ctags-recursive distclean distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-libtool \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,4 @@
INCLUDES = -I../../
bin_PROGRAMS = brokersession_example_receiver_async
brokersession_example_receiver_async_SOURCES = brokersession_example_receiver_async.cpp
brokersession_example_receiver_async_LDADD = -L../../amq_brokersession -lamq_brokersession

View File

@ -0,0 +1,445 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = brokersession_example_receiver_async$(EXEEXT)
subdir = amq_examples/bs_async_recv
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_brokersession_example_receiver_async_OBJECTS = \
brokersession_example_receiver_async.$(OBJEXT)
brokersession_example_receiver_async_OBJECTS = \
$(am_brokersession_example_receiver_async_OBJECTS)
brokersession_example_receiver_async_DEPENDENCIES =
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(brokersession_example_receiver_async_SOURCES)
DIST_SOURCES = $(brokersession_example_receiver_async_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I../../
brokersession_example_receiver_async_SOURCES = brokersession_example_receiver_async.cpp
brokersession_example_receiver_async_LDADD = -L../../amq_brokersession -lamq_brokersession
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_examples/bs_async_recv/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_examples/bs_async_recv/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
brokersession_example_receiver_async$(EXEEXT): $(brokersession_example_receiver_async_OBJECTS) $(brokersession_example_receiver_async_DEPENDENCIES)
@rm -f brokersession_example_receiver_async$(EXEEXT)
$(CXXLINK) $(brokersession_example_receiver_async_LDFLAGS) $(brokersession_example_receiver_async_OBJECTS) $(brokersession_example_receiver_async_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brokersession_example_receiver_async.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,82 @@
/*
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 <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <iostream>
#include <memory>
#include "amq_brokersession/BrokerSession.h"
#include "amq_corelib/NonBlockingMessageConsumerRef.h"
#include "amq_corelib/TextMessage.h"
using namespace std;
using namespace ActiveMQ;
void callback(auto_ptr<Message> msg) {
cout << "Received message: " << static_cast<TextMessage *>(msg.get())->getText() << endl;
}
int main(int argc, char **argv) {
if (argc < 2) {
cerr << "Usage: brokersession_example_receiver_async <broker_uri>" << endl;
return 1;
}
try {
BrokerSession bs(argv[1]);
bs.connect();
NonBlockingMessageConsumerRef smc;
smc = bs.newNonBlockingMessageConsumer();
smc.getEventFD();
Destination d = bs.createTopic("test");
bs.subscribe(d, smc);
sleep(2);
fd_set fds;
FD_ZERO(&fds);
while (1) {
FD_SET(smc.getEventFD(),&fds);
int rc = select(smc.getEventFD()+1,&fds,NULL,NULL,NULL);
if (rc == 1) {
auto_ptr<Message> m = smc.receive();
callback(m);
}
else if (rc == -1 && errno != EINTR) {
perror("select");
return 1;
}
}
} catch (const Exception &e) {
cerr << "Exception: " << e.what() << endl;
return 1;
} catch (...) {
cerr << "Some random exception!" << endl;
}
return 0;
}

View File

@ -0,0 +1,4 @@
INCLUDES = -I../../
bin_PROGRAMS = brokersession_example_sender
brokersession_example_sender_SOURCES = brokersession_example_sender.cpp
brokersession_example_sender_LDADD = -L../../amq_brokersession -lamq_brokersession

View File

@ -0,0 +1,445 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = brokersession_example_sender$(EXEEXT)
subdir = amq_examples/bs_send
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_brokersession_example_sender_OBJECTS = \
brokersession_example_sender.$(OBJEXT)
brokersession_example_sender_OBJECTS = \
$(am_brokersession_example_sender_OBJECTS)
brokersession_example_sender_DEPENDENCIES =
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(brokersession_example_sender_SOURCES)
DIST_SOURCES = $(brokersession_example_sender_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I../../
brokersession_example_sender_SOURCES = brokersession_example_sender.cpp
brokersession_example_sender_LDADD = -L../../amq_brokersession -lamq_brokersession
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_examples/bs_send/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_examples/bs_send/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
brokersession_example_sender$(EXEEXT): $(brokersession_example_sender_OBJECTS) $(brokersession_example_sender_DEPENDENCIES)
@rm -f brokersession_example_sender$(EXEEXT)
$(CXXLINK) $(brokersession_example_sender_LDFLAGS) $(brokersession_example_sender_OBJECTS) $(brokersession_example_sender_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brokersession_example_sender.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,98 @@
/*
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 <unistd.h>
#include <iostream>
#include <string>
#include "amq_brokersession/BrokerSession.h"
#include "amq_corelib/TextMessage.h"
#include "amq_corelib/LogLevel.h"
#include "amq_corelib/Logger.h"
using namespace std;
using namespace ActiveMQ;
class MyLogger : public Logger {
public:
bool isEnabled(const LogLevel& ll) { return true; }
void logFatal(const string& msg);
void logError(const string& msg);
void logWarning(const string& msg);
void logInform(const string& msg);
void logDebug(const string& msg);
};
void
MyLogger::logFatal(const string& msg) {
cerr << "FATAL " << msg << endl;
}
void
MyLogger::logError(const string& msg) {
cerr << "ERROR " << msg << endl;
}
void
MyLogger::logWarning(const string& msg) {
cerr << "WARNING " << msg << endl;
}
void
MyLogger::logInform(const string& msg) {
cerr << "INFORM " << msg << endl;
}
void
MyLogger::logDebug(const string& msg) {
cerr << "DEBUG " << msg << endl;
}
void except(const Exception& e) {
cout << "myexcept" << endl;
cout << e.what() << endl;
}
int main(int argc, char **argv) {
if (argc < 3) {
cerr << "Usage: brokersession_example_sender <broker_uri> <num_to_send>" << endl;
return 1;
}
try {
BrokerSession bs(argv[1]);
bs.setLogger(new MyLogger());
bs.setExceptionCallback(except);
bs.connect();
Destination d = bs.createTopic("test");
for (int i = 0; i < atoi(argv[2]); i++) {
cout << "Sending message.." << endl;
bs.publish(d, TextMessage("test message"));
//sleep(2);
}
cout << "Done with loop..." << endl;
} catch (const std::exception &e) {
cerr << "Exception: " << e.what() << endl;
return 1;
}
cout << "Exiting..." << endl;
return 0;
}

View File

@ -0,0 +1,4 @@
INCLUDES = -I../../
bin_PROGRAMS = brokersession_example_receiver_sync
brokersession_example_receiver_sync_SOURCES = brokersession_example_receiver_sync.cpp
brokersession_example_receiver_sync_LDADD = -L../../amq_brokersession -lamq_brokersession

View File

@ -0,0 +1,445 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = brokersession_example_receiver_sync$(EXEEXT)
subdir = amq_examples/bs_sync_recv
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_brokersession_example_receiver_sync_OBJECTS = \
brokersession_example_receiver_sync.$(OBJEXT)
brokersession_example_receiver_sync_OBJECTS = \
$(am_brokersession_example_receiver_sync_OBJECTS)
brokersession_example_receiver_sync_DEPENDENCIES =
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(brokersession_example_receiver_sync_SOURCES)
DIST_SOURCES = $(brokersession_example_receiver_sync_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I../../
brokersession_example_receiver_sync_SOURCES = brokersession_example_receiver_sync.cpp
brokersession_example_receiver_sync_LDADD = -L../../amq_brokersession -lamq_brokersession
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_examples/bs_sync_recv/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_examples/bs_sync_recv/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
brokersession_example_receiver_sync$(EXEEXT): $(brokersession_example_receiver_sync_OBJECTS) $(brokersession_example_receiver_sync_DEPENDENCIES)
@rm -f brokersession_example_receiver_sync$(EXEEXT)
$(CXXLINK) $(brokersession_example_receiver_sync_LDFLAGS) $(brokersession_example_receiver_sync_OBJECTS) $(brokersession_example_receiver_sync_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brokersession_example_receiver_sync.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,84 @@
/*
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 <unistd.h>
#include <memory>
#include <iostream>
#include "amq_brokersession/BrokerSession.h"
#include "amq_corelib/BlockingMessageConsumerRef.h"
#include "amq_corelib/TextMessage.h"
using namespace ActiveMQ;
using std::cerr;
using std::cout;
using std::endl;
using std::auto_ptr;
int msgcount = 0;
void handleException(const Exception& e) {
cerr << "handleException: " << e.what() << endl;
}
void callback(auto_ptr<Message> msg) {
msgcount++;
cout << "Received message: " << msgcount << endl;
}
int main(int argc, char **argv) {
if (argc < 2) {
cerr << "Usage: brokersession_example_receiver <broker_uri>" << endl;
return 1;
}
try {
BrokerSession bs(argv[1]);
// bs.setExceptionCallback(handleException);
bs.connect();
BlockingMessageConsumerRef smc = bs.newBlockingMessageConsumer();
BlockingMessageConsumerRef a, b, c, d, e;
a = b;
a = a;
a = smc;
c = a;
c = c;
a = a;
BlockingMessageConsumerRef f = a;
BlockingMessageConsumerRef g = f;
Destination dest = bs.createTopic("test");
bs.subscribe(dest, smc);
// sleep(20);
while (1)
callback(smc.receive());
} catch (const std::exception& e) {
cout << "exception: " << e.what() << endl;
}
return 0;
}

View File

@ -0,0 +1,4 @@
INCLUDES = -I../../
bin_PROGRAMS = corelib_example_sender
corelib_example_sender_SOURCES = corelib_example_sender.cpp
corelib_example_sender_LDADD = -L../../amq_transport -L../../amq_corelib -lamq_transport -lamq_corelib -lpthread

View File

@ -0,0 +1,443 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = corelib_example_sender$(EXEEXT)
subdir = amq_examples/cl_send
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_corelib_example_sender_OBJECTS = corelib_example_sender.$(OBJEXT)
corelib_example_sender_OBJECTS = $(am_corelib_example_sender_OBJECTS)
corelib_example_sender_DEPENDENCIES =
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(corelib_example_sender_SOURCES)
DIST_SOURCES = $(corelib_example_sender_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I../../
corelib_example_sender_SOURCES = corelib_example_sender.cpp
corelib_example_sender_LDADD = -L../../amq_transport -L../../amq_corelib -lamq_transport -lamq_corelib -lpthread
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_examples/cl_send/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_examples/cl_send/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
corelib_example_sender$(EXEEXT): $(corelib_example_sender_OBJECTS) $(corelib_example_sender_DEPENDENCIES)
@rm -f corelib_example_sender$(EXEEXT)
$(CXXLINK) $(corelib_example_sender_LDFLAGS) $(corelib_example_sender_OBJECTS) $(corelib_example_sender_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corelib_example_sender.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,54 @@
/*
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 <unistd.h>
#include <iostream>
#include <memory>
#include "amq_corelib/CoreLib.h"
#include "amq_corelib/TextMessage.h"
#include "amq_transport/Transport.h"
#include "amq_transport/TransportFactory.h"
using namespace std;
using namespace ActiveMQ;
int main(int argc, char **argv) {
if (argc < 3) {
cerr << "Usage: corelib_example_sender <broker_uri> <num_to_send>" << endl;
return 1;
}
CoreLib cl("","");
Transport *t = TransportFactory::instance().getPtrFromURI(argv[1]);
t->connect();
Buffer conn;
cl.initialize(conn);
t->send(conn);
Destination d = cl.createTopic("test");
for (int i = 0; i < atoi(argv[2]); i++) {
Buffer msg;
cl.publish(d,TextMessage("test message"),msg);
t->send(msg);
sleep(2);
}
delete t;
return 0;
}

View File

@ -0,0 +1,4 @@
INCLUDES = -I../
lib_LTLIBRARIES = libamq_transport.la
libamq_transport_la_SOURCES = TCPTransport.cpp Transport.cpp TransportFactory.cpp TransportInitializer.cpp
include_HEADERS = TCPTransport.h TransportFactory.h Transport.h TransportInitializer.h

View File

@ -0,0 +1,476 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = amq_transport
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libamq_transport_la_LIBADD =
am_libamq_transport_la_OBJECTS = TCPTransport.lo Transport.lo \
TransportFactory.lo TransportInitializer.lo
libamq_transport_la_OBJECTS = $(am_libamq_transport_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libamq_transport_la_SOURCES)
DIST_SOURCES = $(libamq_transport_la_SOURCES)
includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = -I../
lib_LTLIBRARIES = libamq_transport.la
libamq_transport_la_SOURCES = TCPTransport.cpp Transport.cpp TransportFactory.cpp TransportInitializer.cpp
include_HEADERS = TCPTransport.h TransportFactory.h Transport.h TransportInitializer.h
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amq_transport/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign amq_transport/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libamq_transport.la: $(libamq_transport_la_OBJECTS) $(libamq_transport_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libamq_transport_la_LDFLAGS) $(libamq_transport_la_OBJECTS) $(libamq_transport_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TCPTransport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Transport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransportFactory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransportInitializer.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
$(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
rm -f "$(DESTDIR)$(includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-includeHEADERS install-info \
install-info-am install-libLTLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,164 @@
/*
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 <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string>
#include "TransportFactory.h"
#include "TransportInitializer.h"
#include "TCPTransport.h"
#include "amq_corelib/Exception.h"
#include "amq_corelib/RCSID.h"
using ActiveMQ::TCPTransport;
using ActiveMQ::Transport;
using ActiveMQ::TransportInitializer;
using ActiveMQ::Exception;
using std::string;
using std::auto_ptr;
RCSID(TCPTransport, "$Id$");
void
TCPTransport::connect() {
if (!connected_) {
struct addrinfo hints, *res;
memset(&hints, '\0', sizeof(struct addrinfo));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
int rc = getaddrinfo(host_.c_str(), port_.c_str(), &hints, &res);
if (rc != 0)
throw Exception(gai_strerror(rc));
rc = ::connect(fd_, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
if (rc == -1)
throw Exception(errno >= sys_nerr
? "Unknown error"
: sys_errlist[errno]);
connected_ = true;
}
}
TCPTransport::TCPTransport(const string& host, const string& port) :
host_(host), port_(port), connected_(false) {
fd_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd_ == -1)
throw Exception(errno >= sys_nerr
? "Unknown error"
: sys_errlist[errno]);
}
int
TCPTransport::send(const unsigned char *buf, size_t count) {
if (!connected_)
throw Exception("send called on unconnected transport");
if (buf == NULL)
throw Exception("NULL buffer passed to send");
int rc = ::send(fd_, (void *)buf, count, 0);
if (rc == -1) {
connected_ = false;
throw Exception(errno >= sys_nerr
? "Unknown error"
: sys_errlist[errno]);
}
return rc;
}
int
TCPTransport::recv(unsigned char *buf, size_t count) {
if (!connected_)
throw Exception("recv called on unconnected transport");
if (buf == NULL)
throw Exception("NULL buffer passed to recv");
int rc = ::recv(fd_, (void *)buf, count, 0);
if (rc == -1) {
connected_ = false;
throw Exception(errno >= sys_nerr
? "Unknown error"
: sys_errlist[errno]);
}
return rc;
}
void
TCPTransport::disconnect() {
if (connected_) {
connected_ = false;
int rc = ::close(fd_);
if (rc == -1)
throw Exception(errno >= sys_nerr
? "Unknown error"
: sys_errlist[errno]);
}
}
TCPTransport::~TCPTransport() {
try {
disconnect();
} catch (...) {}
}
bool
TCPTransport::isConnected() const {
return connected_;
}
TCPTransport::TCPTransport(const string& uri)
: connected_(false)
{
string::size_type colpos = uri.find(":");
string hostport(uri, colpos + 3, uri.size() - colpos - 3);
host_.assign(hostport, 0, hostport.find(":"));
port_.assign(hostport, hostport.find(":") + 1,
hostport.size() - hostport.find(":"));
fd_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd_ == -1)
throw Exception(errno >= sys_nerr
? "Unknown error"
: sys_errlist[errno]);
}
auto_ptr<Transport>
initFromURI_(const string& uri) {
return auto_ptr<Transport>(new TCPTransport(uri));
}
int
TCPTransport::dummy() {
return 1;
}
static TransportInitializer init =
TransportInitializer("tcp", initFromURI_);

View File

@ -0,0 +1,68 @@
/*
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.
*/
#ifndef ACTIVEMQ_TCP_TRANSPORT_H
#define ACTIVEMQ_TCP_TRANSPORT_H
#include <string>
#include <memory>
#include "Transport.h"
namespace ActiveMQ {
/// Represents a transport over a TCP connection.
/**
A TCP transport. See the documentation for ActiveMQ::Transport.
@version $Id$
*/
class TCPTransport : public Transport {
public:
/// Constructs a new TCP transport
TCPTransport(const std::string& host, const std::string& port);
/// Constructs a new TCP transport
TCPTransport(const std::string& uri);
virtual ~TCPTransport();
/// Connects to the host/port given in the constructor
void connect();
/// Sends data
int send(const unsigned char *buf, size_t count);
/// Receives data
int recv(unsigned char *buf, size_t count);
/// Disconnects
void disconnect();
/// Checks connectivity on transport
bool isConnected() const;
/// Gets the underlying socket
int getFD() const { return fd_; }
/// dummy function to get static linkers to reference TCPTransport.o
static int dummy();
private:
int fd_;
std::string host_;
std::string port_;
bool connected_;
TCPTransport(const TCPTransport &);
TCPTransport& operator=(const TCPTransport &);
};
};
#endif // ACTIVEMQ_TCP_TRANSPORT_H

View File

@ -0,0 +1,28 @@
/*
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 "Transport.h"
#include "amq_corelib/RCSID.h"
using ActiveMQ::Transport;
RCSID(Transport, "$Id$");
Transport::~Transport()
{}

View File

@ -0,0 +1,99 @@
/*
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.
*/
#ifndef ACTIVEMQ_TRANSPORT_H
#define ACTIVEMQ_TRANSPORT_H
#include <memory>
#include "amq_corelib/Buffer.h"
namespace ActiveMQ {
/// Interface defining a transport layer
/**
This class represents the fundamental operations on a logical
transport layer. Implementations are TCP, UDP, etc.
@version $Id$
*/
class Transport {
public:
/// Connects the transport
/**
Connects the fd. Will throw ActiveMQ::Exception on error.
*/
virtual void connect() = 0;
/// Checks connectivity on transport
/**
@returns true if the transport is connected
*/
virtual bool isConnected() const = 0;
/// Sends data on the transport
/**
Sends data. Will throw ActiveMQ::Exception on error.
@param buf the data to send
@param count the number of bytes to read from buf
@returns the number of bytes sent
*/
virtual int send(const unsigned char *buf, size_t count) = 0;
/// Sends data on the transport
/**
Sends data. Will throw ActiveMQ::Exception on error.
@param buf the data to send
@returns the number of bytes sent
*/
int send(const Buffer& buf) { return send(&(buf.front()), buf.size()); }
/// Reads ready data from the transport
/**
Receives data. Will only block if no data is ready.
Will throw Activemq::Exception on error.
@param buf the buffer to write into
@param count the maximum amount to read
@returns the number of bytes read
*/
virtual int recv(unsigned char *buf, size_t count) = 0;
/// Closes the transport
/**
Explicitly closes the transport.
Will throw ActiveMQ::Exception on error.
*/
virtual void disconnect() = 0;
/// Gets the file descriptor
/**
@returns the underlying file descriptor
*/
virtual int getFD() const = 0;
virtual ~Transport() = 0;
};
};
#endif // ACTIVEMQ_TRANSPORT_H

View File

@ -0,0 +1,57 @@
/*
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 <utility>
#include "TransportFactory.h"
#include "amq_corelib/Exception.h"
#include "amq_corelib/RCSID.h"
using namespace ActiveMQ;
using std::string;
using std::pair;
using std::map;
using std::auto_ptr;
RCSID(TransportFactory, "$Id$");
TransportFactory&
TransportFactory::instance() {
static TransportFactory instance_;
return instance_;
}
void
TransportFactory::registerTransport(const string& protocol,
const TransportInit& initFromURI) {
inits_.insert(pair<string, TransportInit>(protocol, initFromURI));
}
auto_ptr<Transport>
TransportFactory::getFromURI(const string& uri) {
// get the protocol out
string protocol(uri, 0, uri.find(":"));
map<string, TransportInit>::iterator i = inits_.find(protocol);
if (i == inits_.end())
throw Exception("No transport registered for " + protocol);
return (i->second)(uri);
}

View File

@ -0,0 +1,110 @@
/*
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.
*/
#ifndef ACTIVEMQ_TRANSPORTFACTORY_H
#define ACTIVEMQ_TRANSPORTFACTORY_H
#include <string>
#include <memory>
#include <map>
#include "Transport.h"
namespace ActiveMQ {
class Transport;
/// Constructs a new transport from a URI.
/**
This class keeps track of the mapping between transport names
and representative classes.
See ActiveMQ::TransportInitializer for a convenience class that can
register your transport at static initialization time.
@version $Id$
*/
class TransportFactory {
public:
typedef std::auto_ptr<Transport> (*TransportInit)(const std::string &);
/// Gets a singleton instance
/**
This function returns the global TransportFactory object that the below operations can be called on.
@returns the TransportFactory instance
*/
static TransportFactory& instance();
/// Registers a transport
/**
This function defines a mapping between a protocol name
("tcp", "http") in a URI and an initializer that can take
an appropriate URI and construct a Transport instance.
This overwrites any transport class already registered for
a particular protocol name.
These URIs are ActiveMQ URIs. See the ActiveMQ
documentation for details:
http://www.activemq.org/Configuring+Transports
@param protocol the "protocol" portion of the URIs this transport represents
@param initFromURI a function that can take an appropriate URI and build a transport instance (to be owned by the caller)
*/
void registerTransport(const std::string& protocol,
const TransportInit& initFromURI);
/// Constructs a transport from a URI
/**
Constructs a transport by consulting the internal map of
protocols to transports (which have registered with
registerTransport above) and building the transport from
the given uri.
This returns an auto_ptr, but if that doesn't work well in
your application, there is a dumb pointer overload.
Throws ActiveMQ::Exception when the transport is not
registered.
@param uri the uri representing the connection
@returns a new instance of the transport, owned by the caller
*/
std::auto_ptr<Transport> getFromURI(const std::string& uri);
/// Constructs a transport from a URI
/**
Like above, but returns a dumb pointer. <b>It is still the
caller's responsibility to release this memory by calling
delete</b>.
Throws ActiveMQ::Exception when the transport is not
registered.
@param uri the uri representing the connection
@returns a new instance of the transport, owned by the caller
*/
Transport *getPtrFromURI(const std::string& uri) { return getFromURI(uri).release(); }
private:
std::map<std::string, TransportInit> inits_;
TransportFactory() {}
};
};
#endif // ACTIVEMQ_TRANSPORTFACTORY_H

View File

@ -0,0 +1,35 @@
/*
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 "TransportInitializer.h"
#include "TransportFactory.h"
#include "amq_corelib/RCSID.h"
#include <iostream>
using namespace ActiveMQ;
using namespace std;
RCSID(TransportInitializer, "$Id$");
TransportInitializer::TransportInitializer(const string &protocol,
const TransportFactory::TransportInit& func)
{
TransportFactory::instance().registerTransport(protocol, func);
}

View File

@ -0,0 +1,44 @@
/*
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.
*/
#ifndef ACTIVEMQ_TRANSPORT_INITIALIZER_H
#define ACTIVEMQ_TRANSPORT_INITIALIZER_H
#include <string>
#include "TransportFactory.h"
namespace ActiveMQ {
/// Convenience class for static registration of Transport subclasses.
/**
This class is useful as a static member of your
ActiveMQ::Transport subclass. The constructor will be called
at static initialization time. See the ActiveMQ::TCPTransport
code for an example of this.
@version $Id$
*/
class TransportInitializer {
public:
TransportInitializer(const std::string& protocol,
const TransportFactory::TransportInit& func);
};
};
#endif // ACTIVEMQ_TRANSPORT_INITIALIZER_H

View File

@ -0,0 +1,43 @@
/*
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.
*/
#ifndef AbstractCommand_hpp_
#define AbstractCommand_hpp_
#include <string>
#include "command/ICommand.h"
namespace ActiveMQ {
namespace Command {
class AbstractCommand : public ICommand
{
protected:
AbstractCommand() {};
public:
virtual ~AbstractCommand() {};
virtual int getCommandType() const = 0;
static const std::string& getCommandTypeAsString(int type);
};
}
}
#endif /*AbstractCommand_hpp_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQBytesMessage.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQBytesMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQBytesMessage::isMarshalAware() const
{
return true;
}
ActiveMQBytesMessage::ActiveMQBytesMessage()
{
}
int
ActiveMQBytesMessage::getCommandType() const
{
return TYPE;
}
ActiveMQBytesMessage::~ActiveMQBytesMessage()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQBytesMessage_h_
#define ActiveMQBytesMessage_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQMessage.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQBytesMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQBytesMessage : public ActiveMQMessage
{
private:
public:
const static int TYPE = 24;
public:
ActiveMQBytesMessage();
virtual ~ActiveMQBytesMessage();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQBytesMessage_h_*/

View File

@ -0,0 +1,63 @@
/*
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 "command/ActiveMQDestination.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQDestination
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQDestination::isMarshalAware() const
{
return false;
}
ActiveMQDestination::ActiveMQDestination()
{
physicalName_ = "";
}
int
ActiveMQDestination::getCommandType() const
{
return TYPE;
}
ActiveMQDestination::~ActiveMQDestination()
{
}
const std::string& ActiveMQDestination::getPhysicalName() const
{
return physicalName_;
}
void ActiveMQDestination::setPhysicalName(const std::string& physicalName)
{
physicalName_ = physicalName;
}

View File

@ -0,0 +1,65 @@
/*
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.
*/
#ifndef ActiveMQDestination_h_
#define ActiveMQDestination_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/IDataStructure.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQDestination
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQDestination : public IDataStructure
{
private:
std::string physicalName_;
public:
const static int TYPE = 0;
public:
ActiveMQDestination();
virtual ~ActiveMQDestination();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
virtual const std::string& getPhysicalName() const;
virtual void setPhysicalName(const std::string& physicalName);
};
}
}
#endif /*ActiveMQDestination_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQMapMessage.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQMapMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQMapMessage::isMarshalAware() const
{
return true;
}
ActiveMQMapMessage::ActiveMQMapMessage()
{
}
int
ActiveMQMapMessage::getCommandType() const
{
return TYPE;
}
ActiveMQMapMessage::~ActiveMQMapMessage()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQMapMessage_h_
#define ActiveMQMapMessage_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQMessage.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQMapMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQMapMessage : public ActiveMQMessage
{
private:
public:
const static int TYPE = 25;
public:
ActiveMQMapMessage();
virtual ~ActiveMQMapMessage();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQMapMessage_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQMessage.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQMessage::isMarshalAware() const
{
return true;
}
ActiveMQMessage::ActiveMQMessage()
{
}
int
ActiveMQMessage::getCommandType() const
{
return TYPE;
}
ActiveMQMessage::~ActiveMQMessage()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQMessage_h_
#define ActiveMQMessage_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/Message.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQMessage : public Message
{
private:
public:
const static int TYPE = 23;
public:
ActiveMQMessage();
virtual ~ActiveMQMessage();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQMessage_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQObjectMessage.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQObjectMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQObjectMessage::isMarshalAware() const
{
return true;
}
ActiveMQObjectMessage::ActiveMQObjectMessage()
{
}
int
ActiveMQObjectMessage::getCommandType() const
{
return TYPE;
}
ActiveMQObjectMessage::~ActiveMQObjectMessage()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQObjectMessage_h_
#define ActiveMQObjectMessage_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQMessage.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQObjectMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQObjectMessage : public ActiveMQMessage
{
private:
public:
const static int TYPE = 26;
public:
ActiveMQObjectMessage();
virtual ~ActiveMQObjectMessage();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQObjectMessage_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQQueue.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQQueue
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQQueue::isMarshalAware() const
{
return false;
}
ActiveMQQueue::ActiveMQQueue()
{
}
int
ActiveMQQueue::getCommandType() const
{
return TYPE;
}
ActiveMQQueue::~ActiveMQQueue()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQQueue_h_
#define ActiveMQQueue_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQDestination.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQQueue
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQQueue : public ActiveMQDestination
{
private:
public:
const static int TYPE = 100;
public:
ActiveMQQueue();
virtual ~ActiveMQQueue();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQQueue_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQStreamMessage.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQStreamMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQStreamMessage::isMarshalAware() const
{
return true;
}
ActiveMQStreamMessage::ActiveMQStreamMessage()
{
}
int
ActiveMQStreamMessage::getCommandType() const
{
return TYPE;
}
ActiveMQStreamMessage::~ActiveMQStreamMessage()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQStreamMessage_h_
#define ActiveMQStreamMessage_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQMessage.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQStreamMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQStreamMessage : public ActiveMQMessage
{
private:
public:
const static int TYPE = 27;
public:
ActiveMQStreamMessage();
virtual ~ActiveMQStreamMessage();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQStreamMessage_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQTempDestination.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQTempDestination
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQTempDestination::isMarshalAware() const
{
return false;
}
ActiveMQTempDestination::ActiveMQTempDestination()
{
}
int
ActiveMQTempDestination::getCommandType() const
{
return TYPE;
}
ActiveMQTempDestination::~ActiveMQTempDestination()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQTempDestination_h_
#define ActiveMQTempDestination_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQDestination.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQTempDestination
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQTempDestination : public ActiveMQDestination
{
private:
public:
const static int TYPE = 0;
public:
ActiveMQTempDestination();
virtual ~ActiveMQTempDestination();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQTempDestination_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQTempQueue.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQTempQueue
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQTempQueue::isMarshalAware() const
{
return false;
}
ActiveMQTempQueue::ActiveMQTempQueue()
{
}
int
ActiveMQTempQueue::getCommandType() const
{
return TYPE;
}
ActiveMQTempQueue::~ActiveMQTempQueue()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQTempQueue_h_
#define ActiveMQTempQueue_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQTempDestination.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQTempQueue
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQTempQueue : public ActiveMQTempDestination
{
private:
public:
const static int TYPE = 102;
public:
ActiveMQTempQueue();
virtual ~ActiveMQTempQueue();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQTempQueue_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQTempTopic.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQTempTopic
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQTempTopic::isMarshalAware() const
{
return false;
}
ActiveMQTempTopic::ActiveMQTempTopic()
{
}
int
ActiveMQTempTopic::getCommandType() const
{
return TYPE;
}
ActiveMQTempTopic::~ActiveMQTempTopic()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQTempTopic_h_
#define ActiveMQTempTopic_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQTempDestination.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQTempTopic
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQTempTopic : public ActiveMQTempDestination
{
private:
public:
const static int TYPE = 103;
public:
ActiveMQTempTopic();
virtual ~ActiveMQTempTopic();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQTempTopic_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQTextMessage.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQTextMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQTextMessage::isMarshalAware() const
{
return true;
}
ActiveMQTextMessage::ActiveMQTextMessage()
{
}
int
ActiveMQTextMessage::getCommandType() const
{
return TYPE;
}
ActiveMQTextMessage::~ActiveMQTextMessage()
{
}

View File

@ -0,0 +1,61 @@
/*
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.
*/
#ifndef ActiveMQTextMessage_h_
#define ActiveMQTextMessage_h_
#include <string>
#include <vector>
#include <exception>
#include <inttypes.h>
#include <boost/shared_ptr.hpp>
#include "command/ActiveMQMessage.h"
namespace ActiveMQ {
namespace Command {
/*
*
* Marshalling code for Open Wire Format for ActiveMQTextMessage
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
class ActiveMQTextMessage : public ActiveMQMessage
{
private:
public:
const static int TYPE = 28;
public:
ActiveMQTextMessage();
virtual ~ActiveMQTextMessage();
virtual bool isMarshalAware() const;
virtual int getCommandType() const;
};
}
}
#endif /*ActiveMQTextMessage_h_*/

View File

@ -0,0 +1,52 @@
/*
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 "command/ActiveMQTopic.h"
using namespace ActiveMQ::Command;
/*
*
* Marshalling code for Open Wire Format for ActiveMQTopic
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Groovy scripts in the
* activemq-core module
*
*/
bool
ActiveMQTopic::isMarshalAware() const
{
return false;
}
ActiveMQTopic::ActiveMQTopic()
{
}
int
ActiveMQTopic::getCommandType() const
{
return TYPE;
}
ActiveMQTopic::~ActiveMQTopic()
{
}

Some files were not shown because too many files have changed in this diff Show More