How to destroy the life cycle of an Application Designer adapter from a Natural program?

At the “Application Designer” documentation overview:
Chapters: Special Development Topics → Details on Session Management → How Things End
Topic: “End of an Application Designer Adapter”

We can see that:
Adapters typically stay alive until the subsession ends in which they are living. There is also an API available to directly end adapters:
• Method Adapter.markThisAdapterForDestroy().
• Via the interface IInteractionProcess which you receive inside an adapter via this.m_interactionProcess.

Question:
Is it possible to destroy the life cycle of an Application Designer adapter from a Natural program?

Questions:

1.) Why would you need to do this ?

2.) Are you really talking about an Application Designer Adapter or a Natural Adapter ?

Hi Wolfgang,

First of all, let me thank you for your attention and answer your questions…

i Why would you need to do this ?[/i]
Answer: I need to exchange context data in an Application Server environment (in a Natural for AJAX workplace corporate portal) between: [1] a Natural for AJAX page and [2] a Natural map in a 3270 terminal emulation into this portal.

i Are you really talking about an Application Designer Adapter or a Natural Adapter ?[/i]
Answer: I’m talking about a Natural Adapter which seems to stay alive until the subsession ends in which they are living, in a way similar as occurs with Application Designer adapters.

I can keep this context data exchanging working as intended with one exception: I always can “put” the context data from the Natural program (3270), but I just can “get” the context data to the Natural program 3270 only at the first time my program interacts with the context information and I think it is happening because the life cycle of the adapter instance…

You can see listed below an example of the Natural 3270 program and the Natural for AJAX page this program is calling…

NATURAL 3270 PROGRAM:
[size=9]DEFINE DATA LOCAL
/* [ADAPTER] Adapter variables
1 CONTEXT
2 PARM (A) DYNAMIC
1 XCITRIGGEREVENT (A) DYNAMIC
/* [MAP] 3270 interface variables
1 #MAP
2 #FIELD1 (A30)
2 #FIELD2 (A30)
2 #MESSAGE (A70)
END-DEFINE

  • [KEY] PF-KEYS assignment
    FORMAT KD=ON
    SET KEY PF3 NAMED ‘Quit’
    SET KEY PF10 NAMED ‘C->M’
    SET KEY PF11 NAMED ‘M->C’
  • [3270] User interface
    REPEAT
    INPUT WITH TEXT #MESSAGE
    ‘C O N T E X T T E S T’ ///
    ‘Context parameter:’ #FIELD1 (AD=MILT’‘) /
    ‘Map parameter…:’ #FIELD2 (AD=MILT’
    ')
    DECIDE ON FIRST VALUE OF PF-KEY
    VALUE ‘PF3’
    ESCAPE MODULE
    VALUE ‘PF10’
    /
    [AJAX] Interacts with Natural for AJAX page to get the context information
    MOVE ‘nat:page.end’ TO XCITRIGGEREVENT
    PROCESS PAGE USING “EXPAGE1”
    /* [3270] Move the context information to the 3270 map
    MOVE CONTEXT.PARM TO #MAP.#FIELD1
    RESET #MAP.#FIELD2
    /* [MSG] Set the message
    MOVE ‘Moved: from CONTEXT to MAP’ TO #MAP.#MESSAGE
    VALUE ‘PF11’
    /* [3270] Move the 3270 map information to the context
    MOVE #MAP.#FIELD2 TO CONTEXT.PARM
    /* [AJAX] Interacts with Natural for AJAX page to put the context information
    MOVE ‘nat:page.end’ TO XCITRIGGEREVENT
    PROCESS PAGE USING “EXPAGE1”
    /* [MSG] Set the message
    MOVE ‘Moved: from MAP to CONTEXT’ TO #MAP.#MESSAGE
    /* [3270] Adjusts the context information at the map
    MOVE CONTEXT.PARM TO #MAP.#FIELD1
    NONE
    MOVE ‘Invalid key’ TO #MAP.#MESSAGE
    END-DECIDE
    END-REPEAT

END[/size]

NATURAL FOR AJAX PAGE
<?xml version="1.0" encoding="UTF-8"?>

njx:triggerevent
</njx:triggerevent>




Best regards,
Orlando.

Ok, so this question and the other one from Euler Nieto are actually the same issue, right ?

I’m still greatly confused about how 3270 comes into play here - when you are talking about 3270 and subsessions, are you talking about WebIO running as one session within your portal, or as a subpage within a page within your portal ?

You can consider that Euler is working with me in this issue, but our questions are not exactly the same.

Let me try to explain the relation between 3270 and subsessions. The whole problem is about context data, which can be implemented with the “xcicontext” and “xcicontextparameter” controls in an application designer Natpages…

Our corporate portal have an architecture similar as that used at the Application Designer workplace and was implemented from the workplace examples we can see at the “njxdemos” project. This portal have a lot of menu options, mostly pointing to Natural for AJAX applications, but some to Natural CUI (character user interface) programs. We need to exchange context data between these different applications.

Therefore, the challenge is to exchange this “context data” between different subsessions of Natural for AJAX pages (which is working fine) and some subsessions of Natural 3270 terminal emulations we can have running in parallel under the same session of this portal.

These emulations are using the “natlegacy” page from the “cisnatural” project at the Application Designer. So, I’m talking about Natural for AJAX sessions (started with StartCISPage) which deals with CUI objects: programs with Natural maps displayed with the INPUT [USING MAP ‘MAP_NAME’] statement, but started with the StartCISPage servlet.

As you can see at the Natural program attached above, we included, in this CUI program, two pf-keys:
PF10 – Which we use to “get” the session’s context area.
PF11 – Which we use to “put” the program’s local data to the context area.

We can implement these facilities with a “dummy” page (which was attached above as well): we just have to start it as a “blink” (a triggerevent + a PROCESS PAGE statement) to interact with the portal’s current context area. It is working: always to the “put” operation; but only for the first time, to the “get” operation.

I think the problem is occurring because the “get” operation only works with brand new adapter instances. This is the reason of my question: I want to destroy the adapter instance after the “blink” triggered with the PF10 key.