public int subscribe_event(DeviceProxy device,
                               String attribute,
                               int event,
                               CallBack callback,
                               int max_size,
                               String[] filters,
                               boolean stateless) throws DevFailed {
        ApiUtil.printTrace("trying to subscribe_event to " + device.name() + "/" + attribute);
        int id;
        //  If already connected, subscribe directly on same channel
        EventConsumer   consumer = isChannelAlreadyConnected(device);
        if (consumer!=null) {
            id = consumer.subscribe_event(device,
                    attribute, event, callback, max_size, filters, stateless);
        }
        else
        if (isZmqLoadable()) {
            try {
                //  If ZMQ jni library can be loaded, try to connect on ZMQ event system
                id = ZmqEventConsumer.getInstance().subscribe_event(device,
                        attribute, event, callback, max_size, filters, stateless);
            }
            catch (DevFailed e) {
                ApiUtil.printTrace(e.errors[0].desc);
                if (e.errors[0].desc.equals(ZMQutils.SUBSCRIBE_COMMAND_NOT_FOUND)) {
                    //  If not a ZMQ server, try on notifd system.
                    id = subscribeEventWithNotifd(device, attribute,
                            event, callback, max_size, filters,stateless);
                }
                else
                    throw e;
            }
        }
        else {
            //  If there is no ZMQ jni library loadable, try on notifd system.
            id = subscribeEventWithNotifd(device, attribute,
                    event, callback, max_size, filters,stateless);
        }

        return id;
    }
public int subscribe_event ( DeviceProxy device , String attribute , int event , CallBack callback , int max_size , String [ ] filters , boolean stateless ) throws DevFailed { ApiUtil . printTrace ( "trying to subscribe_event to " + device . name ( ) + "/" + attribute ) ; int id ; EventConsumer consumer = isChannelAlreadyConnected ( device ) ; if ( consumer != null ) { id = consumer . subscribe_event ( device , attribute , event , callback , max_size , filters , stateless ) ; } else if ( isZmqLoadable ( ) ) { try { id = ZmqEventConsumer . getInstance ( ) . subscribe_event ( device , attribute , event , callback , max_size , filters , stateless ) ; } catch ( DevFailed e ) { ApiUtil . printTrace ( e . errors [ 0 ] . desc ) ; if ( e . errors [ 0 ] . desc . equals ( ZMQutils . SUBSCRIBE_COMMAND_NOT_FOUND ) ) { id = subscribeEventWithNotifd ( device , attribute , event , callback , max_size , filters , stateless ) ; } else throw e ; } } else { id = subscribeEventWithNotifd ( device , attribute , event , callback , max_size , filters , stateless ) ; } return id ; }
===============================================================