Salesforce

How to configure the Generic JMS Adapter for ActiveMQ using ClientConnect (-SMQConnect) ?

« Go Back

Information

 
TitleHow to configure the Generic JMS Adapter for ActiveMQ using ClientConnect (-SMQConnect) ?
URL NameABL-JMS-example-with-ActiveMQ
Article Number000204177
EnvironmentProduct: OpenEdge ABL
Version: 11.x 12.x
OS: All supported platforms
Other: Generic JMS Adapter
Question/Problem Description
How to configure the Generic JMS Adapter for ActiveMQ using ClientConnect (-SMQConnect) ?
How to connect to ActiveMQ using -SMQConnect from ABL? 
How to connect to ActiveMQ using the ClientConnect connection mode? 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution

Please follow these steps:

  1. Download ActiveMQ from https://activemq.apache.org/components/classic/download/
  2. Unzip the apache-activemq-[ver]-bin.zip archive.
  3. 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
  1. (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
  1. (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
  1. 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.

  1. 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.

Workaround
Notes
Keyword Phrase
Last Modified Date9/3/2024 1:14 PM

Powered by