Hi,

I have this simple site :

<site>
    <arrival destid="Start"/>
    
    <element id="Start" url="/start" implementation="com.test.Start">           
     
        <exit name="started" />
        <flowlink srcexit="started" destid="Second">
                <datalink srcoutput="counter" destinput="counter"/>
        </flowlink>
        <datalink srcoutput="counter" destinput="counter" destid="Second" />   
    </element>
    
    <element id="Second" url="/second" implementation="com.test.Second">
        <input name="counter" />
        <submission name="increase">
                <param name="increment" />                              
        </submission>                           
    </element>
      
</site>

And this is the implementation of the element Start:

public class Start extends Element {
        
        public void initialize() {
                System.out.println("Start.initialize");
        }
        
        public int getCounter() {
                System.out.println("Start.getCounter() = 3");
                return 3;
        }
        
        public void processElement() {
                System.out.println("Start.processElement()");
                exit("started");
        }
}

The output trace is:
Start.initialize
Start.processElement()
Start.getCounter() = 3
Start.getCounter() = 3
Start.getCounter() = 3
Guess.setCounter(3)
Guess.processElement()

Could you explain why getCounter() is called three times?

Also, what I am trying to do is having this element Start initializing and
transmitting a value to element Second.
For the time being it'a a simple integer but it will be eventually a bean.

Then, the subsequent requests will be processed by element Second. At each
request, the value originally initialized by the element Start will evolve,
so It will use a datalink from element Second to itself to keep the state
like you suggested in the example : statefull components.

But the problem is :

Apparently, each time the element Second is processed (and not only the
first time) the method getCounter of element Start is called and the value
is set into element Second. 

I can understand why but how can we accomplish this simple behavior :

Element second is initialized with a value from Element Start. But after
that, the value is modified iteratively in element Second by the very
process of subsequent requests, without the value being reinitialized each
time by the element Start?

I can imagine two datalinks with two distincts variables. Then element
Second has to decide that the second variable (the one coming from himself)
has precedence over the one coming from element Start. But it looks
unnatural.

Can you help?

Tks
-- 
View this message in context: 
http://www.nabble.com/Datalink-semantics-tf2965628.html#a8297299
Sent from the RIFE - users mailing list archive at Nabble.com.

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to