Category: JMS options
Q
What's the configuration for OpenJMS from C++?
A
When configuring the runtime for use with OpenJMS, we have successfully used the configuration information below. We used OpenJMS 0.7.6 and OpenJMS 0.7.7-alpha, but this information hopefully won't change significantly between releases.
Check out the OpenJMS online documentation for more details. If you're running with the default setup, you can use the following lookup names:
| Item | Lookup name |
|---|---|
| Queue connection factory | ConnectionFactory |
| Queue for testing | queue1 |
| Topic connection factory | ConnectionFactory |
| Topic for testing | topic1 |
The following sections provide example snippets for configuring the runtime for OpenJMS as a JMS provider.
Explicit
xmog_jvm_loader & loader = xmog_jvm_loader::get_jvm_loader(); // ------------------------------------------------------------------ // you have to add one jar file to the classpath loader.appendToClassPath( "<FQN of openjms-0.7.6.jar>" ); // ------------------------------------------------------------------ // you have configure the JNDI setup loader.setDashDOption( "java.naming.factory.initial", "org.exolab.jms.jndi.InitialContextFactory" ); // this assumes OpenJMS default setup running on localhost loader.setDashDOption( "java.naming.provider.url", "tcp://localhost:3035" );
Configuration File
<configuration>
<Codemesh>
<Runtime>
<Loader name="Default" />
<Default.JvmSettings>
<!-- set the classpath so it's right for the JMS provider -->
<!-- make sure that the fileseparator is correct for your platform -->
<add key="ClassPath" value="c:\openjms-0.7.6\lib\openjms-0.7.6.jar" />
</Default.JvmSettings>
<Default.Options>
<!-- here we configure the JNDI options for our JMS vendor -->
<add key="java.naming.factory.initial"
value="org.exolab.jms.jndi.InitialContextFactory" />
<add key="java.naming.provider.url" value="tcp://localhost:3035" />
</Default.Options>
</Runtime>
</Codemesh>
</configuration>
