/** * <p>This is a convenience method to call {@link * #createSourceSession(SourceSessionParams)} with default values for the * {@link SourceSessionParams} object.</p> * * @param handler The reply handler to receive the replies for the session. * @return The created session. */ public SourceSession createSourceSession(ReplyHandler handler) { return createSourceSession(new SourceSessionParams().setReplyHandler(handler)); }
/** * <p>This is a convenience method to call {@link * #createSourceSession(SourceSessionParams)} by first assigning the reply * handler to the parameter object.</p> * * @param handler The reply handler to receive the replies for the session. * @param params The parameters to control the session. * @return The created session. */ public SourceSession createSourceSession(ReplyHandler handler, SourceSessionParams params) { return createSourceSession(new SourceSessionParams(params).setReplyHandler(handler)); }
@Override public Sender createSender(ReplyHandler replyHandler, VisitorParameters visitorParameters) { messageBus.setMaxPendingCount(0); SourceSessionParams sessionParams = createSourceSessionParams(visitorParameters); return new MessageBusSender(messageBus.createSourceSession(replyHandler, sessionParams)); } }
public SharedSourceSession(SharedMessageBus mbus, SourceSessionParams params) { if (params.getReplyHandler() != null) { throw new IllegalArgumentException("Reply handler must be null."); } this.mbus = mbus; this.session = mbus.messageBus().createSourceSession(params.setReplyHandler(this)); this.mbusReference = mbus.refer(); }
/** * Creates a new async session running on message bus logic with a specified reply handler. * * @param asyncParams Common asyncsession parameters, not used. * @param bus The message bus on which to run. * @param mbusParams Parameters concerning message bus configuration. * @param handler The external reply handler. */ MessageBusAsyncSession(AsyncParameters asyncParams, MessageBus bus, MessageBusParams mbusParams, ReplyHandler handler) { route = mbusParams.getRoute(); routeForGet = mbusParams.getRouteForGet(); traceLevel = mbusParams.getTraceLevel(); throttlePolicy = mbusParams.getSourceSessionParams().getThrottlePolicy(); if (handler == null) { handler = new MyReplyHandler(asyncParams.getResponseHandler(), responses); } session = bus.createSourceSession(handler, mbusParams.getSourceSessionParams()); }
private RemoteClient(Slobrok slobrok, String slobrokId, Protocol protocol) { this.slobrok = slobrok; this.slobrokId = slobrok != null ? slobrok.configId() : slobrokId; mbus = new MessageBus(new RPCNetwork(new RPCNetworkParams().setSlobrokConfigId(this.slobrokId)), new MessageBusParams().addProtocol(protocol)); session = mbus.createSourceSession(new SourceSessionParams().setThrottlePolicy(null).setReplyHandler(queue)); }