Search in sources :

Example 1 with MQException

use of com.generallycloud.baseio.container.jms.MQException in project baseio by generallycloud.

the class ConsumerOnFuture method onResponse.

@Override
public void onResponse(SocketSession session, Future future) {
    ParamedProtobaseFuture f = (ParamedProtobaseFuture) future;
    try {
        Message message = messageDecoder.decode(f);
        onMessage.onReceive(message);
    } catch (MQException e) {
        DebugUtil.debug(e);
    }
}
Also used : MQException(com.generallycloud.baseio.container.jms.MQException) OnMessage(com.generallycloud.baseio.container.jms.client.OnMessage) Message(com.generallycloud.baseio.container.jms.Message) ParamedProtobaseFuture(com.generallycloud.baseio.codec.protobase.future.ParamedProtobaseFuture)

Example 2 with MQException

use of com.generallycloud.baseio.container.jms.MQException in project baseio by generallycloud.

the class DefaultMessageBrowser method isOnline.

@Override
public boolean isOnline(String queueName) throws MQException {
    JSONObject param = new JSONObject();
    param.put("queueName", queueName);
    param.put("cmd", MQBrowserServlet.ONLINE);
    ProtobaseFuture future;
    try {
        future = session.request(SERVICE_NAME, param.toJSONString());
    } catch (IOException e) {
        throw new MQException(e.getMessage(), e);
    }
    return JmsUtil.isTrue(future);
}
Also used : ProtobaseFuture(com.generallycloud.baseio.codec.protobase.future.ProtobaseFuture) ParamedProtobaseFuture(com.generallycloud.baseio.codec.protobase.future.ParamedProtobaseFuture) MQException(com.generallycloud.baseio.container.jms.MQException) JSONObject(com.alibaba.fastjson.JSONObject) IOException(java.io.IOException)

Example 3 with MQException

use of com.generallycloud.baseio.container.jms.MQException in project baseio by generallycloud.

the class DefaultMessageBrowser method size.

@Override
public int size() throws MQException {
    String param = "{cmd:\"0\"}";
    ProtobaseFuture future;
    try {
        future = session.request(SERVICE_NAME, param);
    } catch (IOException e) {
        throw new MQException(e.getMessage(), e);
    }
    return Integer.parseInt(future.getReadText());
}
Also used : ProtobaseFuture(com.generallycloud.baseio.codec.protobase.future.ProtobaseFuture) ParamedProtobaseFuture(com.generallycloud.baseio.codec.protobase.future.ParamedProtobaseFuture) MQException(com.generallycloud.baseio.container.jms.MQException) IOException(java.io.IOException)

Example 4 with MQException

use of com.generallycloud.baseio.container.jms.MQException in project baseio by generallycloud.

the class DefaultMessageConsumer method sendReceiveCommandCallback.

private void sendReceiveCommandCallback(OnMessage onMessage) throws MQException {
    if (!needSendReceiveCommand) {
        return;
    }
    checkLoginState();
    try {
        session.listen("MQConsumerServlet", new ConsumerOnFuture(onMessage, messageDecoder));
        session.write("MQConsumerServlet", null);
        needSendReceiveCommand = false;
    } catch (IOException e) {
        throw new MQException(e);
    }
}
Also used : MQException(com.generallycloud.baseio.container.jms.MQException) IOException(java.io.IOException)

Example 5 with MQException

use of com.generallycloud.baseio.container.jms.MQException in project baseio by generallycloud.

the class DefaultMessageConsumer method sendSubscribeCommandCallback.

private void sendSubscribeCommandCallback(OnMessage onMessage) throws MQException {
    if (!needSendSubscribeCommand) {
        return;
    }
    checkLoginState();
    try {
        session.listen("MQSubscribeServlet", new ConsumerOnFuture(onMessage, messageDecoder));
        session.write("MQSubscribeServlet", null);
        needSendSubscribeCommand = false;
    } catch (IOException e) {
        throw new MQException(e);
    }
}
Also used : MQException(com.generallycloud.baseio.container.jms.MQException) IOException(java.io.IOException)

Aggregations

MQException (com.generallycloud.baseio.container.jms.MQException)11 IOException (java.io.IOException)7 ParamedProtobaseFuture (com.generallycloud.baseio.codec.protobase.future.ParamedProtobaseFuture)4 ProtobaseFuture (com.generallycloud.baseio.codec.protobase.future.ProtobaseFuture)4 MapMessage (com.generallycloud.baseio.container.jms.MapMessage)3 RTPException (com.generallycloud.baseio.container.rtp.RTPException)3 JSONObject (com.alibaba.fastjson.JSONObject)2 RESMessage (com.generallycloud.baseio.container.RESMessage)1 WaiterOnFuture (com.generallycloud.baseio.container.WaiterOnFuture)1 Authority (com.generallycloud.baseio.container.authority.Authority)1 BytedMessage (com.generallycloud.baseio.container.jms.BytedMessage)1 Message (com.generallycloud.baseio.container.jms.Message)1 OnMessage (com.generallycloud.baseio.container.jms.client.OnMessage)1 OnMappedMessage (com.generallycloud.baseio.container.jms.client.impl.OnMappedMessage)1