private Processing createProcessing(DocumentOperation documentOperation, Message message) { Processing processing = new Processing(); processing.addDocumentOperation(documentOperation); processing.setServiceName(serviceName); processing.setDocprocServiceRegistry(docprocServiceComponentRegistry); processing.setVariable("route", message.getRoute()); processing.setVariable("timeout", message.getTimeRemaining()); return processing; } }
/** * Constructs a new instance of this class. This is the root node constructor, and will be used by the different * sessions for sending messages. Note that the {@link #discard()} functionality of this class is implemented so * that it passes a null reply to the handler to notify the discard. * * @param mbus The message bus on which we are running. * @param net The network layer we are to transmit through. * @param resender The resender to schedule with. * @param handler The handler to receive the final reply. * @param msg The message being sent. */ public RoutingNode(MessageBus mbus, Network net, Resender resender, ReplyHandler handler, Message msg) { this.mbus = mbus; this.net = net; this.resender = resender; this.handler = handler; this.msg = msg; this.trace = new Trace(msg.getTrace().getLevel()); this.route = msg.getRoute(); this.parent = null; if (route != null) { routeMetrics = mbus.getMetrics().getRouteMetrics(route); } }
public DocumentMessage fromDocumentOperation(Processing processing, DocumentOperation documentOperation) { DocumentMessage msg = newMessage(documentOperation); msg.setLoadType(loadType); msg.setPriority(priority); msg.setRoute(requestMsg.getRoute()); msg.setTimeReceivedNow(); msg.setTimeRemaining(requestMsg.getTimeRemainingNow()); msg.getTrace().setLevel(requestMsg.getTrace().getLevel()); if (log.isLoggable(LogLevel.DEBUG)) { log.log(LogLevel.DEBUG, "Created '" + msg.getClass().getName() + "', route = '" + msg.getRoute() + "', priority = '" + msg.getPriority().name() + "', load type = '" + msg.getLoadType() + "', trace level = '" + msg.getTrace().getLevel() + "', time remaining = '" + msg.getTimeRemaining() + "'."); } return msg; }
@Override public void run() { Message msg = decode(envelope.msg.getProtocol(), payload, Message.class); msg.getTrace().setLevel(envelope.msg.getTrace().getLevel()); msg.setRoute(envelope.msg.getRoute()).getRoute().removeHop(0); msg.setRetryEnabled(envelope.msg.getRetryEnabled()); msg.setRetry(envelope.msg.getRetry()); msg.setTimeRemaining(envelope.msg.getTimeRemainingNow()); msg.pushHandler(new ReplyHandler() { @Override public void handleReply(Reply reply) { new ReplyEnvelope(LocalNetwork.this, envelope, reply).send(); } }); owner.deliverMessage(msg, LocalServiceAddress.class.cast(envelope.recipient.getServiceAddress()) .getSessionName()); } });