/** * Overridable method to allow custom collecting and addition of received pushed input messages. * By default, this just reads whatever's received (possibly nothing). But alternatively, this * could e.g. block till at least one pushed msg was received etc. (check e.g. * BufferedInputsActor). * * @param req * @throws ProcessingException */ protected void addPushedMessages(ProcessRequest req) throws ProcessingException { getLogger().trace("{} - addPushedMessages() - entry", getFullName()); int msgCtr = 0; try { while (!pushedMessages.isEmpty()) { req.addInputContext(pushedMessages.poll()); msgCtr++; } } catch (InterruptedException e) { throw new ProcessingException( ErrorCode.RUNTIME_PERFORMANCE_INFO, "Msg Queue lock interrupted...", this, null); } finally { getLogger().trace("{} - addPushedMessages() - exit - added {}", getFullName(), msgCtr); } }
/** This method is called from the actor's PUSH ports, each time they receive a message. */ public void offer(MessageInputContext ctxt) throws PasserelleException { getLogger().debug("{} - offer {}", getFullName(), ctxt); try { pushedMessages.put(ctxt); } catch (Exception e) { throw new PasserelleException( ErrorCode.MSG_DELIVERY_FAILURE, "Error storing received msg", this, ctxt.getMsg(), e); } }