* <p>
* This method stores the messages and launches a delivery sequence.
*/
protected void doClientMessages(AgentId from, ClientMessages not) {
receiving = true;
ClientMessages cm = null;
// interceptors
if (interceptorsAvailable()) {
// new client message
cm = new ClientMessages(not.getClientContext(), not.getRequestId());
cm.setAsyncSend(not.getAsyncSend());
cm.setDMQId(not.getDMQId());
for (Iterator msgs = not.getMessages().iterator(); msgs.hasNext();) {
org.objectweb.joram.shared.messages.Message message = (org.objectweb.joram.shared.messages.Message) msgs.next();
// set the destination name
message.setProperty("JoramDestinationName", getName());
// interceptors process
org.objectweb.joram.shared.messages.Message m = processInterceptors(message);
if (m == null) {
// send message to the DMQ
DMQManager dmqManager = new DMQManager(dmqId, getId());
nbMsgsSentToDMQSinceCreation++;
dmqManager.addDeadMessage(message, MessageErrorConstants.INTERCEPTORS);
dmqManager.sendToDMQ();
new Message(message).releaseFullMessage();
} else {
// add message to the client message
cm.addMessage(m);
}
}
// test client message size.
if (cm.getMessageCount() == 0) {
receiving = false;
return;
}
} else {
cm = not;
}
// pre process the client message
ClientMessages clientMsgs = preProcess(from, cm);
if (clientMsgs != null) {
Message msg;
// Storing each received message:
for (Iterator msgs = clientMsgs.getMessages().iterator(); msgs.hasNext();) {
msg = new Message((org.objectweb.joram.shared.messages.Message) msgs.next());
msg.order = arrivalsCounter++;
storeMessage(msg);