use of org.bedework.sysevents.events.EntityQueuedEvent in project bw-calendar-engine by Bedework.
the class InoutSched method action.
@Override
public void action(final SysEvent ev) throws NotificationException {
if (ev == null) {
return;
}
try {
if (debug) {
debug("Received message" + ev);
}
if (ev instanceof EntityQueuedEvent) {
counts.total++;
final EntityQueuedEvent eqe = (EntityQueuedEvent) ev;
for (int ct = 1; ct <= retryLimit; ct++) {
if ((ct - 1) > counts.maxRetries) {
counts.maxRetries = ct - 1;
}
final ProcessMessageResult pmr = handler.processMessage(eqe);
if (pmr == ProcessMessageResult.PROCESSED) {
counts.processed++;
return;
}
if (pmr == ProcessMessageResult.NO_ACTION) {
counts.noaction++;
return;
}
if (pmr == ProcessMessageResult.STALE_STATE) {
counts.staleState++;
counts.retries++;
if (ct == 1) {
counts.retried++;
}
}
if (pmr == ProcessMessageResult.FAILED_NORETRIES) {
counts.failedNoRetries++;
return;
}
if (pmr == ProcessMessageResult.FAILED) {
counts.failed++;
counts.retries++;
if (ct == 1) {
counts.retried++;
}
}
}
/* Failed after retries */
counts.failedRetries++;
}
} catch (final Throwable t) {
error("Error processing message " + ev);
error(t);
}
}
use of org.bedework.sysevents.events.EntityQueuedEvent in project bw-calendar-engine by Bedework.
the class JmsNotificationsHandlerImpl method post.
@Override
public void post(final SysEventBase ev) throws NotificationException {
if (debug) {
debug(ev.toString());
}
long start = System.currentTimeMillis();
send: {
if (ev instanceof MillisecsEvent) {
monitor.post(ev);
if ((ev instanceof TimedEvent) || (ev instanceof HttpEvent)) {
break send;
}
}
syslog.post(ev);
boolean changeEvent = false;
for (final Attribute attr : ev.getMessageAttributes()) {
if (!"changeEvent".equals(attr.name)) {
continue;
}
changeEvent = Boolean.valueOf(attr.value);
break;
}
if (changeEvent) {
changes.post(ev);
}
if (ev instanceof EntityQueuedEvent) {
final EntityQueuedEvent eqe = (EntityQueuedEvent) ev;
if (((EntityQueuedEvent) ev).getInBox()) {
scheduleIn.post(ev);
} else {
scheduleOut.post(ev);
break send;
}
}
if (ev instanceof ScheduleUpdateEvent) {
scheduleIn.post(ev);
}
}
// send
sends++;
sendTime += System.currentTimeMillis() - start;
if ((sends % 100) == 0) {
debug("Sends: " + sends + " avg: " + sendTime / sends);
}
}
Aggregations