[ 
https://issues.jboss.org/browse/RF-12219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12692599#comment-12692599
 ] 

Milo van der Zee edited comment on RF-12219 at 5/14/12 7:30 AM:
----------------------------------------------------------------

{{
/**
 * Send push events to configured topics.
 */
public class PushTriggerJob implements BatchJobInterface {
        private static final Logger LOGGER = 
Logger.getLogger(PushTriggerJob.class);

        @Override
        public void executeBatch(BatchJobContext context) {
                String[] pushKeys = context.getParameters().trim().split(",");
                TopicsContext topicsContext = TopicsContext.lookup();

                boolean first = true;
                for (String pushKey : pushKeys) {
                        if (!first) {
                                // delay 1 second for all except the first one
                                Utils.sleep(1000);
                        }
                        first = false;
                        try {
                                LOGGER.debug("triggerPush: pushing '" + pushKey 
+ "' topicsContext: " + topicsContext);
                                topicsContext.publish(new TopicKey(pushKey), 
null);
                        } catch (MessageException e) {
                                LOGGER.error("executeBatch, topicsContext: " + 
topicsContext, e);
                        }
                }
        }
}
}}

                
      was (Author: MilovdZee):
    {{monospaced}}
/**
 * Send push events to configured topics.
 */
public class PushTriggerJob implements BatchJobInterface {
        private static final Logger LOGGER = 
Logger.getLogger(PushTriggerJob.class);

        @Override
        public void executeBatch(BatchJobContext context) {
                String[] pushKeys = context.getParameters().trim().split(",");
                TopicsContext topicsContext = TopicsContext.lookup();

                boolean first = true;
                for (String pushKey : pushKeys) {
                        if (!first) {
                                // delay 1 second for all except the first one
                                Utils.sleep(1000);
                        }
                        first = false;
                        try {
                                LOGGER.debug("triggerPush: pushing '" + pushKey 
+ "' topicsContext: " + topicsContext);
                                topicsContext.publish(new TopicKey(pushKey), 
null);
                        } catch (MessageException e) {
                                LOGGER.error("executeBatch, topicsContext: " + 
topicsContext, e);
                        }
                }
        }
}
{{monospaced}}

                  
> Push: Test that messages do not become stale in a queue
> -------------------------------------------------------
>
>                 Key: RF-12219
>                 URL: https://issues.jboss.org/browse/RF-12219
>             Project: RichFaces
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>          Components: component-push/poll
>    Affects Versions: 4.2.1.Final
>            Reporter: Lukáš Fryč
>
> According to the [Forum reference],
> we can have problems with stale messages.
> I would suggest to write tests for following scenarios and check that queue 
> is destroyed properly:
> * view expires
> * client leaves the page with {{a4j:push}} without proper clean up
> * ...
> Let's brainstorm other scenarios.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to