Thursday 3 February 2011

Creating ADF Poll

Creating ADF poll is one of the easiest thing in ADF.
Here you have to just mention the poll interval just and it will call the poll in that interval continuously.

To create ADF Poll (af:poll) just create one Fusion Web Application and Create one Fusion Web Project. 

In that project create one managed bean to create the poll listener method.
For me it is CallPollBean.java.



Now create one Poll Listener method,

For me it is :

    public void callPoll(PollEvent pollEvent) {
        // Add event code here...
        System.out.println("Poll Called");
        DateFormat formatter = new SimpleDateFormat("dd/MM/yy HH:mm:SS");
        System.out.println(formatter.format(new Date()));
    }


Now create one JSF page. 

Create af:poll component in the page. 

For me the component is like below:

 <af:poll id="p1" interval="60000" pollListener="#{callPoll.callPoll}" 
                     immediate="true" rendered="true"/>

Now if you run the page you will see that the callPoll method is being called at an interval of 1 minute.

The interval is in milli second format.

In 11.1.1.4 (JDev 11g PS3) release there is one extra property timeout which is set to default 10minutes (timeout="600000 "),


you can change the timeout as per needed for infinite poll use timeout="-1"




No comments:

Post a Comment