Salesforce

How Do I Configure the JMS Component to Work with Apache ActiveMQ? (Magic xpi 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Configure the JMS Component to Work with Apache ActiveMQ? (Magic xpi 3.x)

Magic xpi’s JMS component can work alongside the Apache ActiveMQ Server using the JNDI API. To do so, you need to properly configure your project to read and write messages from ActiveMQ (version 5.5.1).

  1. In the example, the ActiveMQ has a single queue called QueTest.

  2. Add a folder called ActiveMQ under the Magic xpi root.

  3. From the \lib folder, copy the jar files to the \ActiveMQ\ folder.

  4. You now need to add the jars to the CLASSPATH section of the Magic.ini, to enable the server to load them.
    To save classpath size, the ActiveMQ folder has been added and the relative path is being used.

    The following is an example for the new classpath's jars:

CLASSPATH=ActiveMQ/activation-1.1.jar;ActiveMQ/activemq-camel-5.5.1.jar;Act+

iveMQ/activemq-console-5.5.1.jar;ActiveMQ/activemq-core-5.5.1.jar;ActiveMQ/+

activemq-jaas-5.5.1.jar;ActiveMQ/activemq-protobuf-1.1.jar;ActiveMQ/activem+

q-web-5.5.1.jar;ActiveMQ/camel-core-2.7.0.jar;ActiveMQ/camel-jetty-2.7.0.ja+

r;ActiveMQ/camel-jms-2.7.0.jar;ActiveMQ/camel-spring-2.7.0.jar;ActiveMQ/ger+

onimo-j2ee-management_1.1_spec-1.0.1.jar;ActiveMQ/geronimo-jms_1.1_spec-1.1+

.1.jar;ActiveMQ/geronimo-jta_1.0.1B_spec-1.0.1.jar;ActiveMQ/jaxb-api-2.1.ja+

r;ActiveMQ/jaxb-impl-2.1.6.jar;ActiveMQ/kahadb-5.5.1.jar;ActiveMQ/stax-1.2.+

0.jar;ActiveMQ/stax-api-1.0.1.jar;ActiveMQ/slf4j-log4j12-1.5.11.jar;ActiveM+

Q/log4j-1.2.14.jar;ActiveMQ/jcl-over-slf4j-1.5.11.jar;ActiveMQ/slf4j-api-1.+

5.11.jar;ActiveMQ/OR_JNDI.jar

  1. The last jar, called OR_JNDI.jar, is a jar that you need to create. This holds the jndi.properties file (which is required according to the ActiveMQ documentation). For example, the content of the OR_JNDI.jar file is as follows:

    java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory

# use the following property to configure the default connector

#java.naming.provider.url = vm://localhost

java.naming.provider.url = tcp://localhost:61616

# use the following property to specify the JNDI name the connection factory

# should appear as.

connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry

# register some queues in JNDI using the form

# queue.[jndiName] = [physicalName]

queue.QueTest = QueTest

# register some topics in JNDI using the form

# topic.[jndiName] = [physicalName]

topic.MyTopic = example.MyTopic

  1. In the JVM_ARGS section of the Magic.ini file, you need to add the following values:

    Djava.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitial+
    ContextFactory -Djava.naming.provider.url=tcp://localhost:61616

  1. Next, configure the Magic xpi resource. In the Magic xpi project, define a resource. The Connection Factory Name parameter should be set to queueConnectionFactory. (This corresponds to the value in the jndi.properties file.)

  2. Finally, you need to set the Queue Name parameter to QueTest.

References

Apache ActiveMQ: http://activemq.apache.org/

Downloading version 5.5.1 (used in this example):

http://archive.apache.org/dist/activemq/apache-activemq/5.5.1/apache-activemq-5.5.1-bin.zip

Reference
Attachment 
Attachment