Progress
External Program
Interfaces
Gateway Sample Application
The gateway sample application demonstrates a framework for integrating the native 4GL publish and subscribe mechanism (named events) with the 4GL–JMS API. (See the "Integrating With the Native 4GL Publish-and-Subscribe Mechanism" section in Accessing SonicMQ Messaging From the Progress 4GL.")
Application Files
The sample application manages a set of customer records loaded from the sports.customer table. For each country, there is one instance of the application that manages the subset of customers from that country. The country is specified as an application startup parameter.
The gateway sample application files are in:
The gateway sample application consists of these three files:
- appDriver.p
— Drives the publish and subscribe gateway example
- JMSgateway.p (1 of 2) — Establishes a gateway between local and remote publish and subscribe events
- customers.p — Updates customer records from a specified country while keeping the other records identical to the master copy
The main loop of the application is in appDriver.p:
- The user specifies the Customer.Cust–num value.
- The application finds the customer and allows the user to update the record if the Customer.Country field matches the startup country.
- If the Customer.Country field does not match the startup country, the user can only view the customer record.
Several applications, each managing one country, run concurrently. Each application is connected to a JMS server through a local JMSgateway object. The goal is to keep the records identical across the different locations.
- When an application modifies a customer record, it publishes the new record through a 4GL PUBLISH CustUpdate call.
The local JMSgateway object subscribes to the CustUpdate event. It packs the published parameters in a JMS MapMessage and publishes it to the JMS CustUpdate topic.
- The other JMSgateway objects subscribe to the JMS CustUpdate topic. They receive the JMS MapMessage, unpack the parameters, and publish the updated record locally through a 4GL PUBLISH CustUpdate call.
- The application picks up the updated record and updates the local copy.
The file, appDriver.p
,
drives the publish and subscribe gateway example.
The file, JMSgateway.p (1 of 2)
,
establishes a gateway between local and remote publish and subscribe events.
The file, customers.p
,
updates customer records from a specified country while keeping the other records identical to the master copy.
Running the Sample Application
Follow these steps to run the sample application:
- Start the JMS server and the SonicMQ Adapter.
- Start two or more 4GL clients. Each 4GL client calls:
- Update a customer record with one client and watch the others display an ALERT–BOX with the cust–num of the modified customer.
- Display the modified customer record at each application instance. All the copies are identical.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |