SysMessageID sysid = new SysMessageID();
sysid.readID(is);
PacketReference ref = Destination.get(sysid);
Packet realp = (ref == null ?
null : ref.getPacket());
if (ref != null && !ref.isInvalid() && realp != null) {
//XXX revisit if this should not be
// using a packet (queued instead)
Packet p = new Packet(con.useDirectBuffers());
p.fill(realp);
p.setConsumerID(id);
sentp[i] = p;
}
}
} catch (Exception ex) {
logger.logStack(Logger.ERROR,
Globals.getBrokerResources().getString(
BrokerResources.X_INTERNAL_EXCEPTION,
"\tackcnt = " + ackcount + "\n"
+ PacketUtil.dumpPacket(msg) + "\n"
+ "\t" + PacketUtil.dumpThrowable(ex)), ex);
assert false ;
}
// OK .. time to set the lbit on the message
int status = Status.OK;
try {
if (i > 0 ) {
assert sentp[i -1] != null;
sentp[i-1].setIsLast(true);
} else {
reason = "NOT FOUND";
status= Status.NOT_FOUND;
}
} catch (Exception ex) {
assert false;
reason = ex.getMessage();
status = Status.ERROR;
if (ex instanceof BrokerException)
status = ((BrokerException)ex).getStatusCode();
}
// do we need to create a reply packet each time ?
Packet pkt = new Packet(con.useDirectBuffers());
pkt.setConsumerID(msg.getConsumerID());
pkt.setPacketType(PacketType.DELIVER_REPLY);
Hashtable hash = new Hashtable();
hash.put("JMQStatus", new Integer(status));
if (reason != null)
hash.put("JMQReason", reason);
if (((IMQBasicConnection)con).getDumpPacket() ||
((IMQBasicConnection)con).getDumpOutPacket())
hash.put("JMQReqID", msg.getSysMessageID().toString());
pkt.setProperties(hash);
con.sendControlMessage(pkt);
// before 3.5, messages were queued on the connection
// however -> this means that browsing a queue