Publish/subscribe

lemara

New Member
Hello folks,

I am trying to understand who does publish and subscribe work in ADM2.

I created an SDO,viewer and placed the SDO on window, then viewer and smartpanel. Now all the links are established.

I have written an internal procedure in SDO (For data validation). How do I call this ? If SDO publishes the procedure and how to subscribe for this ?

V9.1D on win2k and sports2000.db

TIA.
Le
 
As you are probably aware, syntax for Subscribe is:

SUBSCRIBE [ PROCEDURE subscriber-handle ]
[ TO ] event-name
{ IN publisher-handle | ANYWHERE }
[ RUN-PROCEDURE local-internal-procedure ]
[ NO-ERROR ]

eg. SUBSCRIBE TO 'publishedEventName' IN whatever.


You need to be aware that this mechanism will not work across a session boundary, which means your SDO 'publish' procedure must have DB-REQUIRED unticked (ie. the procedure requires no access to the database), unless you will always be running locally.

You can override one of your client-side events and call the SDO procedure directly, eg.

RUN ipName IN SDOHandle.

This syntax needs changing slighlty if you are deploying on Appserver.


See the following KB entries:

P20232
Title: "PUBLISH and SUBSCRIBE with ADM2"

http://tinyurl.com/8qyhd


P19431
Title: "PUBLISH and SUBSCRIBE does not work through the AppServer"

http://tinyurl.com/7ec3t


18563
Title: "Running SmartDataObject Internal Procedures on AppServer"

http://tinyurl.com/9njht
 

John Nebi

Member
"publishedEventName" needs to be the name an internal procedure in the container that is subscribing to the event of the same name. In your case, it's the data validation procedure you mentioned. Or, you can use the "run-procedure" option if you don't want to default the procedure name to the named event name.

I'm wondering why you are choosing p/s for your validation ....
 

lord_icon

Member
Greetings,

If all you are trying to do is simply execute a procedure why are you using the Pub/Sub mecanism??
The Pub/Sub mecanism enables more generic code to be used for a number of SO's. When there is a generic EVENT to be used.
To execute a block of code, simply put that code in an internal procedure in a SO, that has database access to interigate the db.
Use something like;

RUN ipProName IN soHdl.

In the SO have;
Internal Procedure ipProName

Just because the mecanism is there, you DO NOT have to use it. It is also a rather dirty method. Especially if you do not have the handle to the SO, that will force ProWin 32, to query EVERY SO, if it has subscribed to that event. Where as if you RUN prName IN soHdl, it is efficent, more direct. Only that SO is used - not checking EVERY SO for the Subscribed events.
 

lord_icon

Member
Adm???

I created an SDO,viewer and placed the SDO on window, then viewer and smartpanel. Now all the links are established.

RE:
That is RATHER old ADM(1) mecanism. Smart Panel, is ADM(1), WHILST USING V9+, and ADM2, you should be aiming to use the SmartToolbar. The ADM(1) approach will fall down, which is why PSC abandoned it and introduced the stable ADM2. There will be upgrade problems later, especially since the DataDynamics acquision. The AppBuilder has now been binned, there is to be a new ADE in the next release of Progress OpenEdge.
 
Lee Curzon said:
You can override one of your client-side events and call the SDO procedure directly, eg.

RUN ipName IN SDOHandle.
This may have been a bit confusing if you don't know what I mean by overriding client-side events.

You can intercept an event in any SmartObject by selecting an appropriate override procedure (tick override button in drop-down procedure list in Appbuilder), eg. AddRecord in your SDV procedure list.

You can then call your validation routine from there - Progress will take care of this automatically - all you are doing here is intercepting an event, and redirecting some of the sequence.

Lee
 
lord_icon said:
That is RATHER old ADM(1) mecanism. Smart Panel, is ADM(1), WHILST USING V9+, and ADM2, you should be aiming to use the SmartToolbar.


SmartPanel fulfills panel-type functionality (functions associated with a particular part of the Window). Perfectly ok in ADM2.

SmartToolbar fulfills Toolbar functionality (main Window level functions only).


lord_icon said:
The ADM(1) approach will fall down, which is why PSC abandoned it and introduced the stable ADM2.

True. You should never use ADM1.


lord_icon said:
There will be upgrade problems later, especially since the DataDynamics acquision.

Sigh. He means (I think) Dynamics framework is based on ADM2.


lord_icon said:
The AppBuilder has now been binned,

Deprecated (allegedly). You are perfectly ok to continue developing with Appbuilder, but look into bigger players for Front End stuff for major new development.


lord_icon said:
there is to be a new ADE in the next release of Progress OpenEdge.

Progress has joined the Eclipse consortium, so integration with Eclipse development will be the major Progress Front End push (along with .NET compliance) in the future.

Lee
 

TomBascom

Curmudgeon
lord_icon said:
Just because the mecanism is there, you DO NOT have to use it. It is also a rather dirty method. Especially if you do not have the handle to the SO, that will force ProWin 32, to query EVERY SO, if it has subscribed to that event. Where as if you RUN prName IN soHdl, it is efficent, more direct. Only that SO is used - not checking EVERY SO for the Subscribed events.

This is not true. PUB/SUB is not at all "dirty". It uses an internal data structure that knows what procedures have subscribed to which events. It does not have to check every SO or procedure. It is just as fast as RUN and has additional advantages such as 1) not needing to know the handle and 2) being able to run multiple procedures in a single call.

True, it isn't right for everything. But PUB/SUB is a very powerful and efficient feature.
 
Top