/** * Handle the command send from my client peer. * @param in The (optional) Inputstream to get the params from. * @param out The stream to write the results. */ public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties) throws RemoteException { String strCommand = this.getProperty(REMOTE_COMMAND, properties); if (SEND_MESSAGE.equals(strCommand)) { BaseMessage message = (BaseMessage)this.getNextObjectParam(in, MESSAGE, properties); ((RemoteSendQueue)m_remoteObject).sendMessage(message); } else super.doProcess(in, out, properties); } }
/** * Send this message to the remote send queue (who will pass it on). * @param message The message to send. */ public void sendMessage(Message message) { try { if (((RemoteMessageQueue)this.getMessageQueue()).isSendRemoteMessage((BaseMessage)message) == false) return; if (((BaseMessage)message).isProcessedByServer()) return; // Don't send back down (the server already processed it). if (((BaseMessage)message).isConsumed()) return; // Don't send if already handled. if (MessageConstants.LOCAL_QUEUE.equalsIgnoreCase(((BaseMessage)message).getMessageHeader().getQueueType())) return; // Local queue only synchronized (m_sendQueue) { // In case this is called from another task m_sendQueue.sendMessage(message); } } catch (RemoteException ex) { ex.printStackTrace(); } } }