/** * <p>This is a convenience method to call {@link * #send(Message,String,boolean)} with a <code>false</code> value for the * 'parseIfNotFound' parameter.</p> * * @param msg The message to send. * @param routeName The route to assign to the message. * @return The immediate result of the attempt to send this message. */ public Result send(Message msg, String routeName) { return send(msg, routeName, false); }
public Result sendMessage(Message msg) { return session.send(msg); }
@Override public Result send(Message msg) { return sourceSession.send(msg); }
@Override public Result sendMessage(Message msg) { return session.send(msg); }
/** * <p>This is a convenience function to assign a given route to the given * message, and then pass it to the other {@link #send(Message)} method of * this session.</p> * * @param msg The message to send. * @param route The route to assign to the message. * @return The immediate result of the attempt to send this message. */ public Result send(Message msg, Route route) { return send(msg.setRoute(route)); }
/** * A convenience method for assigning the internal trace level and route string to a message before sending it * through the internal mbus session object. * * @param msg the message to send. * @return the document api result object. */ public Result send(Message msg) { try { long reqId = requestId.incrementAndGet(); msg.setContext(reqId); msg.getTrace().setLevel(traceLevel); String toRoute = (msg.getType() == DocumentProtocol.MESSAGE_GETDOCUMENT ? routeForGet : route); if (toRoute != null) { return toResult(reqId, session.send(msg, toRoute, true)); } else { return toResult(reqId, session.send(msg)); } } catch (Exception e) { return new Result(Result.ResultType.FATAL_ERROR, new Error(e.getMessage(), e)); } }
/** * <p>This is a blocking proxy to the {@link #send(Message)} method. This * method blocks until the message is accepted by the send queue. Note that * the message timeout does not activate by calling this method. This method * will also return if this session is closed or the calling thread is * interrupted.</p> * * @param msg The message to send. * @return The result of initiating send. * @throws InterruptedException Thrown if the calling thread is interrupted. */ public Result sendBlocking(Message msg) throws InterruptedException { Result res = send(msg); if (isSendQFull(res)) { BlockedMessage blockedMessage = new BlockedMessage(msg); synchronized (lock) { blockedQ.add(blockedMessage); } res = blockedMessage.waitComplete(); } return res; }
msg.setRoute(Route.parse(routeName)); return send(msg);