[
https://issues.jboss.org/browse/RF-12219?page=com.atlassian.jira.plugin.s...
]
Milo van der Zee edited comment on RF-12219 at 5/14/12 7:40 AM:
----------------------------------------------------------------
The PushTriggerJob is called by my scheduling system. This job just sends some push events
with the configured names. One name is set to 'notificationIconsPush' and updates
some notification icons on the client side. I could use a poller for that but a poller
generates more view exceptions. In production the PushTriggerJob is triggered every
minute. Mind the sleep(1000) because pushing too rapidly results in other problems. You
need to give the client time to handle the previous event before sending the next one...
But that is not this issue this case is about.
In my testcase I changed the interval to every seconds and I configured just one topic
address. After logging into the system I start jvisualvm to monitor the memory. There I
see that the MessageData objects are never killed during the lifetime of the session. I
noticed that after I came back from lunch and all sessions were gone there also was no
MessageData object left.
{code:title=PushTriggerJob.java}
/**
* 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);
}
}
}
}
{code}
{code}
<h:form id="notificationIconsUpdateForm">
<a4j:push id="notificationIconsPush"
address="notificationIconsPush"
ondataavailable="renderNotificationIcons();"/>
<a4j:jsFunction id="renderNotificationIcons"
name="renderNotificationIcons" render="notificationIcons"
limitRender="true"/>
</h:form>
{code}
was (Author: MilovdZee):
{code:title=PushTriggerJob.java}
/**
* 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);
}
}
}
}
{code}
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