Title: BP0370: PUBLISH or Perish
1BP0370 PUBLISH or Perish
- Breathing New Life into Old Applications
Glen West (gwest_at_techsmiths.com) President,
TechSmiths, Inc.
2Agenda
- Why do I want to know this stuff? Whats in it
for ME? - Parameter models
- If I dont PUBLISH, will I really perish?
- Lets see what trouble we can get ourselves into
with Pub/Sub - What Pub/Sub is NOT
- Related topics, tips, tricks, and resources
3Agenda
- Why do I want to know this stuff? Whats in it
for ME? - Parameter models
- If I dont PUBLISH, will I really perish?
- Lets see what trouble we can get ourselves into
with Pub/Sub - What Pub/Sub is NOT
- Related topics, tips, tricks, and resources
4Whats in it for ME?
- We all have an old skeleton in the closet.
- Old applications/new functionality
- How to migrate to the future without burning
bridges to the past? - Parameters
- Dynamic Query/Find
- Publish/Subscribe
5Agenda
- Why do I want to know this stuff? Whats in it
for ME? - Parameter models
- If I dont PUBLISH, will I really perish?
- Lets see what trouble we can get ourselves into
with Pub/Sub - What Pub/Sub is NOT
- Related topics, tips, tricks, and resources
6Parameter Models
- Classic A series of single-record tables. The
tables usually represent applications/modules,
one field per parameter. - Generic single table, one record per parameter
- Tree Structure nested parameters in a tree
- Hybrid Classic moving toward tree.
7Hybrid Parameter Tree
8Hybrid Parameter Tree
Create a dynamic widget Combo Box
9Hybrid Parameter Tree
Widget Validation Build combo box from this data
10Hybrid Parameter Tree
Dynamic Query Get the data from/put the data
back into this field
11Key Dynamic Queries
- Building the Query (simple)
- Define Variable l-hQuery as handle
no-undo. - Define Variable l-hBuffer as handle
no-undo. - Define Variable l-query as char
no-undo. - create buffer l-hBuffer for table i-table.
- Create query l-hQuery.
- l-hQueryset-buffers(l-hBuffer).
- Assign l-query 'for each ' i-table.
- l-hQueryquery-prepare(l-query).
- l-hQueryquery-open.
- NOTE Look at get-list-value-pairs procedure in
the code samples (list-value.p)
12Dynamic Parameters
- So, now we can dynamically find parameter values.
- How do we access them in the application?
- How do we stop using the old parameters?
- How do we know when we can get rid of the old
parameter file completely?
13Agenda
- Why do I want to know this stuff? Whats in it
for ME? - Parameter models
- If I dont PUBLISH, will I really perish?
- Lets see what trouble we can get ourselves into
with Pub/Sub - What Pub/Sub is NOT
- Related topics, tips, tricks, and resources
14PUB/SUB Basics
- Syntax
- Standards (i.e. event naming)
- Mechanics (how the components chat)
15SUBSCRIBE Syntax
- SUBSCRIBE
- PROCEDURE subscriber-handle
- TO event-name
- IN publisher-handle ANYWHERE
- RUN-PROCEDURE
- local-internal-procedure
- NO-ERROR
16PUBLISH Syntax
- PUBLISH event-name
- FROM publisher-handle
- ( parameter , parameter ... ) .
17Naming Standards
- Depends on application/toolset architecture.
- Will you be integrating with other vendors
products? - Might you be changing infrastructure?
- Prefixes. Options
- Who will be responding (APP-, UI-, TOOL-)
- Application or module (AP-, AR-)
- Global services (no prefix)
- Instance based (SCOP Subscribe SUBSCRIBE to
w-instance )
18The PUB/SUB Process
Named Event Table
Progress Session (Agent)
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
19The PUB/SUB Process
Named Event Table
Startup
Progress Session (Agent)
Launch Persistent
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
20The PUB/SUB Process
Named Event Table
Progress Session (Agent)
Subscribes
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
21The PUB/SUB Process
Named Event Table
Progress Session (Agent)
Run Proxy
Publish Get Preference
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
Publish Get-Preference (background color,
output w-bg-color, output w-success).
Publish
Run get-preference in hSessionSvc (background
color, output w-bg-color, output w-success).
Run Proxy
22The PUB/SUB Process
Named Event Table
Progress Session (Agent)
Subscribe Get-Parent
Subscribe Restrictions
Run
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
23The PUB/SUB Process
Named Event Table
Progress Session (Agent)
Run Proxy
Unsubscribe Get-Parent
Publish Get-Parent
Subscribe Results
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
Subscribe Procedure hParent to Results in
this-procedure.
24The PUB/SUB Process
Named Event Table
Progress Session (Agent)
Run proxy
Publish Restrictions
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
Publish Restrictions from hParent
(this-procedure, output w-restrictions).
25The PUB/SUB Process
Named Event Table
Progress Session (Agent)
Run Proxy
Publish Results
Program A (Session Svcs)
Program B (Entry)
Program C (Dialog Box)
26PUB/SUB Code Samples
- The conference CD, and our website, has all the
code samples from this presentation. - Sess-start.p is the startup procedure (-p)
- Sess-svc.p is the session services procedure used
so far in these examples - entryproc.p is the entry program
- Rep-db.p is the dialog box
- Now lets watch it in action (demo)
27Agenda
- Why do I want to know this stuff? Whats in it
for ME? - Parameter models
- If I dont PUBLISH, will I really perish?
- Lets see what trouble we can get ourselves into
with Pub/Sub - What Pub/Sub is NOT
- Related topics, tips, tricks, and resources
28Setting Up a PUB/SUB Architecture
- A Session Services procedure
- A UI Services procedure
- Instance Based management procedure
29Session Services
- Potential uses for session services procedures
- Manage parameters, preferences
- Sequence generation (Note using a Progress
AppServer to get outside the transaction) - Managing UI Instances
- Common math routines (eg currency exchange, UOM
conversion) - Manage context and record-currency between
programs
30UI Services
- Potential Uses of a UI Services procedure
- Manage screen placement of UI objects (obviously)
- Provide custom user interface experiences to
different users - Manage currency of data (what record are we
working on?) - Standardize inter-object communication
31Instance Management
- What can you do with an Instance Manager
- Maintain context between entry and lookup
- Ensure the lookup returns the data to the correct
parent. - Manage child UI objects (kill the child when the
parent dies) - Handle-independent communications
- PUBLISH/SUBSCRIBE event.
- GLOB Subscribe SUBSCRIBE TO w-instance
32Real-Life Pub/Sub Uses
- Inter-object Communication
- Process Messaging
- Utilities (date/time, foreign currency, math
functions) - Preferences, ini-files, registry settings,
parameters. - Performance timing routines (start/stop/hack)
- Other stuff?
33Agenda
- Why do I want to know this stuff? Whats in it
for ME? - Parameter models
- If I dont PUBLISH, will I really perish?
- Lets see what trouble we can get ourselves into
with Pub/Sub - What Pub/Sub is NOT
- Related topics, tips, tricks, and resources
34What PUB/SUB is NOT
- Inter-session communication. You cannot talk to
another user or another Progress session. - Ill read it when I want. If you dont consume
the message when issued, it goes away. - SonicMQ is a java messaging system (JMS) that
handles both of the above. - You can hear all about SonicMQ here except you
needed to do it BEFORE this session
35Agenda
- Why do I want to know this stuff? Whats in it
for ME? - Parameter models
- If I dont PUBLISH, will I really perish?
- Lets see what trouble we can get ourselves into
with Pub/Sub - What Pub/Sub is NOT
- Related topics, tips, tricks, and resources
36Related Topics
- Since this is the last session, you may have
missed them. - BP2110 Introduction to SonicMQ
- BP2160 Design Patterns for Messaging
- BP1790 Messaging with the Sonic-to-4GL adapter
- BP2170 Sonic in a J2EE Environment
- BP1310 Designing a Dynamics Application
37Tips, Tricks Resources
- Most likely bug Mismatch in signature
- Progress 9.1A REQUIRED an input parameter on a
publish IF there was an output parameter. - Dynamic event names
- The PEG on PUB/SUB Peter van Dam
http//www.v9stuff.com/publish.htm - Synchronous but semi-random
- Remember Publishing as someone else, Subscribing
someone else, subscribing to yourself.
38Conclusion
?
- You can use these new techniques to weave new
functionality into your existing applications. - Questions? Answers? Rotten tomatoes to throw at
speaker? - The answer is, of course 42