You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by vikd <de...@gmail.com> on 2016/03/25 06:46:20 UTC

ActiveMQ : Integration of C.

Hi , 

I am new to use this forum .
I have some queries , please find below details 

we have to listen a message from AMQ broker and then pass to c function and
responded/processed message from c function again send back to AMQ broker
using getJMSReplyTo and getJMSCorrelationID.

so please guide me on below.
We have implemented two approaches to call our legacy c code (function)

A) ActiveMQ-CPP (CMS) library and call c code (function).
B) Java (JMS API) and using JNI called c code (function).

however I am interested to know on below points 
1) which will be the best option to call c functions and why?
2) if we go above 2nd (B) point Java & C using JNI then will any performance
issue or concurrency issue to call shared c library (.so library) from Java?



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: ActiveMQ : Integration of C.

Posted by vikd <de...@gmail.com>.
Thank you for your reply !


just discussed with linux administrator to install APR 1.3 or higher , but
he is saying APR1.3 and higher version is not supporting to  linux 5.9 (Red
Hat Enterprise Linux Server release 5.9 (Tikanga)) and as per our internal
policy/dependency, now we can not upgrade on linux 6.x (Red Hat Enterprise
Linux Server release 6.x (Santiago))  .

so please guide us any links / steps to install 1.3 or higher version on
linux 5.9 machine (Red Hat Enterprise Linux Server release 5.9 (Tikanga)) so
I will again discuss with our linux administrator regarding installation of
APR1.3 and higher version.

or 

if any other alternative to compile ActiveMQ CPP library .











--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951p4711135.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: ActiveMQ : Integration of C.

Posted by Timothy Bish <ta...@gmail.com>.
You need a version of APR at v1.3 or higher, 1.2 versions won't work.

On 04/23/2016 10:59 AM, vikd wrote:
> Hi Artnaseef,
>
> Please find details of the problems.
>
> I am getting below error and could not link the .o file against the CMS
> library aftre execution of below command
> g++ -L  $CMS_HOME/src/main/.libs -g -o apex/ticket/TicketReplier
> apex/ticket/TicketReplier.o -lactivemq-cpp -lssl
>
> Error :
> $<HOME_DIR>/activemq-cpp-library-3.8.2/src/main/.libs/libactivemq-cpp.so:
> undefined reference to `apr_pool_create_unmanaged_ex'
> $<HOME_DIR>/activemq-cpp-library-3.8.2/src/main/.libs/libactivemq-cpp.so:
> undefined reference to `apr_sockaddr_ip_getbuf'
>
> Please guide us why .o file is not getting link against the CMS library.
>
> For more details please find my server machine details
> Tools 		Version Installed
> Linux  :    Red Hat Enterprise Linux Server release 5.9 (Tikanga)
> APR : 		apr-1.2.7-11.el5_6.5
> OpenSSL : 	OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
> autoconf : 	autoconf (GNU Autoconf) 2.69
> automake : 	automake (GNU automake) 1.9.6
> libtool : 	ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
>
> Thanks in advanced !
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951p4711124.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>


-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: ActiveMQ : Integration of C.

Posted by vikd <de...@gmail.com>.
Hi Artnaseef,

Please find details of the problems.

I am getting below error and could not link the .o file against the CMS
library aftre execution of below command
g++ -L  $CMS_HOME/src/main/.libs -g -o apex/ticket/TicketReplier
apex/ticket/TicketReplier.o -lactivemq-cpp -lssl

Error : 
$<HOME_DIR>/activemq-cpp-library-3.8.2/src/main/.libs/libactivemq-cpp.so:
undefined reference to `apr_pool_create_unmanaged_ex'
$<HOME_DIR>/activemq-cpp-library-3.8.2/src/main/.libs/libactivemq-cpp.so:
undefined reference to `apr_sockaddr_ip_getbuf'

Please guide us why .o file is not getting link against the CMS library.

For more details please find my server machine details 
Tools 		Version Installed 
Linux  :    Red Hat Enterprise Linux Server release 5.9 (Tikanga)
APR : 		apr-1.2.7-11.el5_6.5
OpenSSL : 	OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
autoconf : 	autoconf (GNU Autoconf) 2.69
automake : 	automake (GNU automake) 1.9.6
libtool : 	ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06) 

Thanks in advanced !





--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951p4711124.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: ActiveMQ : Integration of C.

Posted by artnaseef <ar...@amlinv.com>.
Can you provide details of the problems seen?  I haven't used ActiveMQ-CPP
myself in a while, but I would expect building it from sources on any modern
Linux system to work.



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951p4710530.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: ActiveMQ : Integration of C.

Posted by vikd <de...@gmail.com>.
Dear Artnaseef

I glad to tell you ,
we had a decision first continue with ActiveMQ CPP (CMS) library... 

now I have some query on the same to building the ActiveMQ CMS library.

I have checked with activemq-cpp-library-3.9.1-src.tar.gz and some lower
version (till activemq-cpp-library-3.8.2-src.tar.gz) but it is not getting
build / compile and remaining lower versions are not getting downloads from
below URL.

URL : http://activemq.apache.org/cms/download.html

Followed steps are 
1) cd activemq-cpp-library-3.8.2-src
2)./configure
3) make

Please guide , which is compatible ActiveMQ-CPP (CMS) library for below
mentioned linux server and installed tools?


same above steps are working fine and could build/compile on below linux
configuration and installed tools

Linux : Red Hat Enterprise Linux Server release 6.6
APR : apr-1.3.9-5.el6_2.x86_64
OpenSSL : OpenSSL 1.0.1e-fips 11 Feb 2013
autoconf : autoconf (GNU Autoconf) 2.63
automake : automake (GNU automake) 1.11.1
libtool : ltmain.sh (GNU libtool) 2.2.6b


I am not able to download some lower than
activemq-cpp-library-3.8.2-src.tar.gz version from below URL to check.
 http://activemq.apache.org/cms/download.html

any other URL so that I can download and check whether CMS libraries are
compatible with linux (Red Hat Enterprise Linux Server release 5.9
(Tikanga)) or not ?

Please guide ..

Thanks in advance !! 



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951p4710413.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: ActiveMQ : Integration of C.

Posted by vikd <de...@gmail.com>.
thank your for your reply !



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951p4710046.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: ActiveMQ : Integration of C.

Posted by artnaseef <ar...@artnaseef.com>.
This is an uncommon situation.  Here's my thoughts (note that I was a "Unix
and C" developer for many years before moving over to Java):

1. Either approach can work
2. Java runs within a virtual machine (the JVM) and is designed that way
    a. It is great for execution of java applications
    b. It kinda stinks for integration into native programs (like those
created by compiled "C") as the JVM is not light-weight (not even if you
wanted a the simplest library routine)
3. JNI is a good tool when it is absolutely necessary to make use of native
code from within the JVM
4. Because of 2b, though, JNI is not a great approach for using Java code
from native code

To clarify what I mean in 2b, here's just one potential concern: the JVM
uses garbage collection for its memory management while "C" programs use
application-managed memory (e.g. malloc and free); splitting memory between
the two approaches becomes a challenge for the application, and insight into
the handling and performance of JVM memory in the native program will be
challenging (JVM OutOfMemory condition is very different than a "C"
program's failed malloc call).

So, my personal recommendation: do not go the JNI route for a "C"
application unless you must.

On the other hand, if there is a strong desire to use native Java code to
interact with ActiveMQ via OpenWire, which is a good practice since it's the
primary client interface and is always guaranteed to be maintained ahead of
others,  then perhaps a split architecture of the application makes sense. 
The ActiveMQ client can be written in Java and use another IPC
(inter-process communication) to hand-off the message to the "C"
application, and get the results back.

Note that the ActiveMQ-CPP library is good solution in my experience, so
going with a native Java application may be overkill.

Hope this helps.



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Integration-of-C-tp4709951p4709976.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.