Please follow these steps:
- Download ActiveMQ from https://activemq.apache.org/components/classic/download/
- Unzip the apache-activemq-[ver]-bin.zip archive.
- Edit %DLC%\properties\jmsProvider.properties and add the following section if it is missing:
[ActiveMQ]
javax.jms.ConnectionFactory=org.apache.activemq.ActiveMQConnectionFactory
javax.jms.QueueConnectionFactory=org.apache.activemq.ActiveMQConnectionFactory
javax.jms.TopicConnectionFactory=org.apache.activemq.ActiveMQConnectionFactory
- (OpenEgde 11.7) Edit %DLC%\properties\AdminServerPlugins.properties with your preferred editor and locate the [PluginPolicy.Progress.SonicMQ] section. Using the # sign, comment out the lines where the pluginclasspath and classpath properties are defined. Then add the following:
pluginclasspath=[amq-home]\activemq-all-[ver].jar,[amq-home]\lib\optional\log4j-api-[ver].jar,[amq-home]\lib\optional\log4j-core-[ver].jar,[dlc]\java\progress.jar
classpath=[amq-home]\activemq-all-[ver].jar,[amq-home]\lib\optional\log4j-api-[ver].jar,[amq-home]\lib\optional\log4j-core-[ver].jar,[dlc]\java\progress.jar
jvmargs=-DsonicMQExtensions=false -DjmsProvider=ActiveMQ
- (OpenEdge 12.2 and later) Edit %DLC%\properties\JavaTools.properties with your preferred editor and locate the [PluginPolicy.Progress.SonicMQ] section. Using the # sign, comment out the lines where the classpath and jvmargs properties are defined. Then add the following:
classpath=[amq-home]\activemq-all-[ver].jar,[amq-home]\lib\optional\log4j-api-[ver].jar,[amq-home]\lib\optional\log4j-core-[ver].jar,[dlc]\java\progress.jar
jvmargs=-DsonicMQExtensions=false -DjmsProvider=ActiveMQ
- For testing purposes increase the ClientConnect logging for the Generic JMS adapter. Open the %DLC%\properties\JavaTools.properties file and locate the [Adapter.CC.cc1] section. Increase the logging levels to 4 as follows:
brkrLoggingLevel=4
srvrLoggingLevel=4
Note: 0 is disabled, 1 - 4 is enabled with 4 being the most verbose option.
- Open the Procedure Editor and run the following code (change URL, port number, username and password if needed):
DEFINE VARIABLE jmssession AS HANDLE.
DEFINE VARIABLE messageH AS HANDLE.
DEFINE VARIABLE lDebug AS LOGICAL.
DEFINE VARIABLE cdate AS CHARACTER NO-UNDO FORMAT "x(16)".
DEFINE VARIABLE ddate AS DATE NO-UNDO.
/* Creates a session object. */
RUN jms/jmssession.p PERSISTENT SET jmssession ("-SMQConnect").
/* Set user credentials. */
RUN setBrokerURL IN jmssession (INPUT "tcp://amq-hostname:61616").
/* Obs: the format for broker URL with ActiveMQ is tcp://hostname:port. */
/* Default port is 61616 */
/* If the broker URL is not in the correct format you might see the following message in the cc.server.log */
/* java.lang.Exception: org.apache.activemq.ActiveMQConnectionFactory class file not mentioned correctly: java.lang.reflect.InvocationTargetException
at com.progress.messaging.jms.jms.createQueueFactory(jms.java:220) */
RUN setUser IN jmssession (INPUT "admin").
RUN setPassword IN jmssession (INPUT "password").
/* Connect to the broker. */
RUN beginSession IN jmssession.
/* Create a text message */
RUN createTextMessage IN jmssession (OUTPUT messageH).
ddate = DATE(cdate).
RUN setText IN messageH ("This is test message sent.").
/* Send the message to the "MyQueue1" queue */
RUN sendToQueue IN jmssession ("MyQueue1", messageH, ?, ?, ?).
RUN deleteMessage IN messageH.
RUN deleteSession IN jmssession.
Message "Sent".
Review the %WRKDIR]%\cc.server.log and %WRKDIR%\cc.broker.log files in case of any errors.