Search in sources :

Example 1 with ErlEvent

use of org.erlide.runtime.events.ErlEvent in project erlide_eclipse by erlang.

the class OtpNodeProxy method receiveEventMessage.

private void receiveEventMessage(final OtpMbox eventBox) throws OtpErlangExit {
    OtpErlangObject msg = null;
    try {
        msg = eventBox.receive(OtpNodeProxy.POLL_INTERVAL);
        final ErlEvent busEvent = eventHelper.parse(msg, this);
        if (busEvent != null) {
            if (OtpNodeProxy.DEBUG) {
                ErlLogger.debug("MSG: %s", "[" + busEvent.getSender() + "::" + busEvent.getTopic() + ": " + busEvent.getEvent() + "]");
            }
            eventBus.post(busEvent);
        }
    } catch (final OtpErlangExit e) {
        ErlLogger.error(e);
        throw e;
    } catch (final OtpErlangDecodeException e) {
        ErlLogger.error(e);
    }
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpErlangDecodeException(com.ericsson.otp.erlang.OtpErlangDecodeException) OtpErlangExit(com.ericsson.otp.erlang.OtpErlangExit) ErlEvent(org.erlide.runtime.events.ErlEvent)

Example 2 with ErlEvent

use of org.erlide.runtime.events.ErlEvent in project erlide_eclipse by erlang.

the class EventParser method parse.

public ErlEvent parse(final OtpErlangObject msg, final IOtpNodeProxy runtime) {
    if (msg == null) {
        return null;
    }
    final String topic = getEventTopic(msg);
    if (topic == null) {
        return null;
    }
    final OtpErlangObject event = getEventData(msg);
    final OtpErlangPid sender = getEventSender(msg);
    return new ErlEvent(topic, runtime, event, sender);
}
Also used : OtpErlangPid(com.ericsson.otp.erlang.OtpErlangPid) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) ErlEvent(org.erlide.runtime.events.ErlEvent)

Aggregations

OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)2 ErlEvent (org.erlide.runtime.events.ErlEvent)2 OtpErlangDecodeException (com.ericsson.otp.erlang.OtpErlangDecodeException)1 OtpErlangExit (com.ericsson.otp.erlang.OtpErlangExit)1 OtpErlangPid (com.ericsson.otp.erlang.OtpErlangPid)1