/** * @param message * @param receiver * <p>receive the messages from the camel exchange, and pass it to a particular agent or all * the agents, based on the value of the receiver parameter */ public void getCamelMessages(Message message, String receiver) { try { Iterator<SimpleJasonAgent> it = agentList.iterator(); for (; it.hasNext(); ) { SimpleJasonAgent a = it.next(); // if the receiver value is "all", send the message to all the agents in the context if (receiver.equals("all")) { Message tm = message; if (!a.getAgName().equals(message.getSender())) { tm.setReceiver(a.getAgName()); a.updateMsgQueue(tm); } } else if (a.getAgName().equals(receiver)) a.updateMsgQueue(message); } } catch (Exception e) { } }