Search in sources :

Example 1 with Attribute

use of org.bedework.sysevents.events.SysEventBase.Attribute 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);
    }
}
Also used : EntityQueuedEvent(org.bedework.sysevents.events.EntityQueuedEvent) MillisecsEvent(org.bedework.sysevents.events.MillisecsEvent) Attribute(org.bedework.sysevents.events.SysEventBase.Attribute) TimedEvent(org.bedework.sysevents.events.TimedEvent) HttpEvent(org.bedework.sysevents.events.HttpEvent) ScheduleUpdateEvent(org.bedework.sysevents.events.ScheduleUpdateEvent)

Aggregations

EntityQueuedEvent (org.bedework.sysevents.events.EntityQueuedEvent)1 HttpEvent (org.bedework.sysevents.events.HttpEvent)1 MillisecsEvent (org.bedework.sysevents.events.MillisecsEvent)1 ScheduleUpdateEvent (org.bedework.sysevents.events.ScheduleUpdateEvent)1 Attribute (org.bedework.sysevents.events.SysEventBase.Attribute)1 TimedEvent (org.bedework.sysevents.events.TimedEvent)1