private DestinationSessionParams createDestinationParams(MessageHandler messageHandler, String visitorName) { DestinationSessionParams destparams = new DestinationSessionParams(); destparams.setName(visitorName); destparams.setBroadcastName(false); destparams.setMessageHandler(messageHandler); return destparams; }
public SharedDestinationSession(SharedMessageBus mbus, DestinationSessionParams params) { this.mbus = mbus; this.msgHandler.set(params.getMessageHandler()); this.session = mbus.messageBus().createDestinationSession(params.setMessageHandler(this)); this.mbusReference = mbus.refer(); }
/** * <p>This is a convenience method to call {@link * #createDestinationSession(DestinationSessionParams)} with default values * for the {@link DestinationSessionParams} object.</p> * * @param name The local unique name for the created session. * @param broadcastName Whether or not to broadcast this session's name on * the network. * @param handler The handler to receive the messages for the session. * @return The created session. */ public DestinationSession createDestinationSession(String name, boolean broadcastName, MessageHandler handler) { return createDestinationSession( new DestinationSessionParams() .setName(name) .setBroadcastName(broadcastName) .setMessageHandler(handler)); }
private RemoteServer(Slobrok slobrok, String slobrokId, Protocol protocol, String identity) { this.slobrok = slobrok; this.slobrokId = slobrok != null ? slobrok.configId() : slobrokId; mbus = new MessageBus(new RPCNetwork(new RPCNetworkParams() .setSlobrokConfigId(this.slobrokId) .setIdentity(new Identity(identity))), new MessageBusParams().addProtocol(protocol)); session = mbus.createDestinationSession(new DestinationSessionParams().setMessageHandler(queue)); }