activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From artnaseef <>
Subject Re: ActiveMQ : Integration of C.
Date Mon, 28 Mar 2016 00:20:13 GMT
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:
Sent from the ActiveMQ - Dev mailing list archive at

View raw message