/** * Sets the extended source session params. * * @param params The params object. * @return This object for chaining. */ public MessageBusParams setSourceSessionParams(SourceSessionParams params) { sourceSessionParams = new SourceSessionParams(params); return this; } }
private SourceSessionParams sourceSessionParams(HttpRequest request) { SourceSessionParams params = new SourceSessionParams(); String timeout = request.getHeader(Headers.TIMEOUT); if (timeout != null) { try { params.setTimeout(Double.parseDouble(timeout)); } catch (NumberFormatException e) { // NOP } } return params; }
/** * <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)); }
private SourceSessionParams createSourceSessionParams(VisitorParameters visitorParameters) { SourceSessionParams sourceParams = new SourceSessionParams(); if (visitorParameters.getThrottlePolicy() != null) { sourceParams.setThrottlePolicy(visitorParameters.getThrottlePolicy()); } else { sourceParams.setThrottlePolicy(new DynamicThrottlePolicy()); } return sourceParams; }
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)); }
private ClientTestDriver(RemoteServer server, Protocol protocol) { this.server = server; MessageBusParams mbusParams = new MessageBusParams().addProtocol(protocol); RPCNetworkParams netParams = new RPCNetworkParams().setSlobrokConfigId(server.slobrokId()); SharedMessageBus mbus = SharedMessageBus.newInstance(mbusParams, netParams); session = mbus.newSourceSession(new SourceSessionParams()); client = new MbusClient(session); client.start(); mbus.release(); driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); ContainerBuilder builder = driver.newContainerBuilder(); builder.clientBindings().bind("mbus://*/*", client); driver.activateContainer(builder); }