A serialized connection object contains all the connection information required by a client to connect to a SonicMQ Broker, including userid and password. A SonicMQ administrator creates the serialized connection object as a file using the Sonic Management Console and provides the serialized connection object to the OpenEdge client. The OpenEdge client uses the setConnectionFile procedure with the file containing the serialized connection object when creating the messaging session.

The serialized connection object file is used when connecting to a SonicMQ Broker. The following example shows how to use the serialized connection object file MyConnectionObject.sjo:

RUN jms/jmssession.p PERSISTENT SET hSession ("-SMQConnect").
RUN setConnectionFile IN hSession ("MyConnectionObject.sjo").
RUN beginSession IN hSession.

To create a serialized connection object file, follow these steps:

  1. Ensure the Domain Manager for SonicMQ is running.
  2. Ensure the Sonic Management Console is started and connected to the Domain Manager.
  3. On the Sonic Management Console menu bar, select Tools and then JMS Administered objects.
  4. Select the File System and navigate to the Directory you want the serialized connection object file to reside, as shown:
  5. Select the Connect button.
  6. In the left pane, select the Object Store directory that you created and then select the Connection Factories tab, as shown:
  7. Select the New button and enter the required connection information for Lookup Name (name of serialized connection object file), Connection URL(s), Default User Name, Default Password, and Confirm Password, as shown:
    Note: All other information is optional for the connection object.
  8. Select Update. The serialized connection object appears an entry, as shown:

The serialized connection object file MyConnectionObject.sjo exists in the Object Stores specified directory. An OpenEdge client uses the file MyConnectionObject.sjo to connect to the SonicMQ Broker.

You can access the MyConnectionObject.sjo file in an a procedure:
define variable sessionHandler as handle.
define variable messageHandler as handle.

/* Set up connect procedure persistantly on the JMS adapter */ 
/* BrokerConnect connection string: */
/* run jms/jmssession.p persistent set sessionHandler("-H localhost -S 3620 -DirectConnect"). */
/* ClientConnect connection string: */ 
RUN jms/jmssession.p persistent set sessionHandler("-SMQConnect").

/* connect using Serialized Connection Object: */
RUN setConnectionFile IN sessionHandler("C:\OpenEdgeWRK_Sonic\MyConnectionObject.sjo").

RUN beginSession in sessionHandler.
MESSAGE "Connected to Sonic" VIEW-AS ALERT-BOX.

/* start using ABL JMS APIs */
/* Create a message */
RUN createTextMessage in sessionHandler(output messageHandler).
RUN setText in messageHandler("A message from the man himself. I am the best.").

/* Send the message to the "queue" using jmssession or ptp, pubsub is only topics */
/* Ensure the queue name exists as a destination */ 
RUN sendToQueue in sessionHandler("SampleQ1", messageHandler, 0, 0, "PERSISTENT").
MESSAGE "Message Sent to Sonic" VIEW-AS ALERT-BOX.

/* Delete message and session */
RUN deleteMessage in messageHandler.
RUN deleteSession in sessionHandler.