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);
}
}
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);
}
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());
}
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);
}
}
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);
}
}
Aggregations