Search in sources :

Example 1 with ConsumerInfoNotifyManager

use of com.sun.messaging.jmq.jmsserver.service.ConsumerInfoNotifyManager in project openmq by eclipse-ee4j.

the class InfoRequestHandler method handle.

/**
 * Method to handle INFO_REQUEST messages
 */
@Override
public boolean handle(IMQConnection con, Packet msg) throws BrokerException {
    Hashtable pktprops = null;
    try {
        pktprops = msg.getProperties();
    } catch (Exception ex) {
        logger.logStack(Logger.WARNING, "INFO-REQUEST Packet.getProperties()", ex);
        pktprops = new Hashtable();
    }
    Integer level = (Integer) pktprops.get("JMQRequestType");
    if (level == null) {
        logger.log(logger.INFO, "No JMQRequestType set ");
        // pick and invalid value
        level = Integer.valueOf(-1);
    }
    if (level.intValue() == REQUEST_CONSUMER_INFO) {
        String destName = (String) pktprops.get("JMQDestination");
        int destType = ((Integer) pktprops.get("JMQDestType")).intValue();
        Boolean offb = (Boolean) pktprops.get("JMQRequestOff");
        boolean off = (offb != null && offb.booleanValue());
        DestinationUID duid = DestinationUID.getUID(destName, destType);
        if (off) {
            con.removeConsumerInfoRequest(duid);
        } else {
            con.addConsumerInfoRequest(duid);
        }
        ConsumerInfoNotifyManager cm = Globals.getConnectionManager().getConsumerInfoNotifyManager();
        cm.consumerInfoRequested(con, duid, destType);
        return true;
    }
    sendInfoPacket(level.intValue(), con, msg.getConsumerID());
    return true;
}
Also used : DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) ConsumerInfoNotifyManager(com.sun.messaging.jmq.jmsserver.service.ConsumerInfoNotifyManager)

Aggregations

DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)1 ConsumerInfoNotifyManager (com.sun.messaging.jmq.jmsserver.service.ConsumerInfoNotifyManager)1 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)1