Search in sources :

Example 11 with RPCNetworkParams

use of com.yahoo.messagebus.network.rpc.RPCNetworkParams in project vespa by vespa-engine.

the class SessionCache method createSharedMessageBus.

private static SharedMessageBus createSharedMessageBus(final ContainerMbusConfig mbusConfig, final String slobrokConfigId, final String identity, Protocol protocol) {
    final MessageBusParams mbusParams = new MessageBusParams().addProtocol(protocol);
    final int maxPendingSize = DocumentUtil.calculateMaxPendingSize(mbusConfig.maxConcurrentFactor(), mbusConfig.documentExpansionFactor(), mbusConfig.containerCoreMemory());
    logSystemInfo(mbusConfig, maxPendingSize);
    mbusParams.setMaxPendingCount(mbusConfig.maxpendingcount());
    mbusParams.setMaxPendingSize(maxPendingSize);
    final RPCNetworkParams netParams = new RPCNetworkParams().setSlobrokConfigId(slobrokConfigId).setIdentity(new Identity(identity)).setListenPort(mbusConfig.port());
    return SharedMessageBus.newInstance(mbusParams, netParams);
}
Also used : RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Identity(com.yahoo.messagebus.network.Identity)

Example 12 with RPCNetworkParams

use of com.yahoo.messagebus.network.rpc.RPCNetworkParams in project vespa by vespa-engine.

the class SharedIntermediateSessionTestCase method requireThatMbusIsReleasedOnDestroy.

@Test
public void requireThatMbusIsReleasedOnDestroy() {
    Slobrok slobrok = null;
    try {
        slobrok = new Slobrok();
    } catch (ListenFailedException e) {
        fail();
    }
    RPCNetworkParams netParams = new RPCNetworkParams().setSlobrokConfigId(slobrok.configId());
    SharedMessageBus mbus = SharedMessageBus.newInstance(new MessageBusParams(), netParams);
    SharedIntermediateSession session = mbus.newIntermediateSession(new IntermediateSessionParams());
    mbus.release();
    session.release();
    assertFalse("MessageBus not destroyed by release().", mbus.messageBus().destroy());
}
Also used : RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) ListenFailedException(com.yahoo.jrt.ListenFailedException) Test(org.junit.Test)

Example 13 with RPCNetworkParams

use of com.yahoo.messagebus.network.rpc.RPCNetworkParams in project vespa by vespa-engine.

the class SharedSourceSessionTestCase method requireThatMbusIsReleasedOnDestroy.

@Test
public void requireThatMbusIsReleasedOnDestroy() {
    Slobrok slobrok = null;
    try {
        slobrok = new Slobrok();
    } catch (ListenFailedException e) {
        fail();
    }
    RPCNetworkParams netParams = new RPCNetworkParams().setSlobrokConfigId(slobrok.configId());
    SharedMessageBus mbus = SharedMessageBus.newInstance(new MessageBusParams(), netParams);
    SharedSourceSession session = mbus.newSourceSession(new SourceSessionParams());
    mbus.release();
    session.release();
    assertFalse("MessageBus not destroyed by release().", mbus.messageBus().destroy());
}
Also used : RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) MessageBusParams(com.yahoo.messagebus.MessageBusParams) SourceSessionParams(com.yahoo.messagebus.SourceSessionParams) ListenFailedException(com.yahoo.jrt.ListenFailedException) Test(org.junit.Test)

Example 14 with RPCNetworkParams

use of com.yahoo.messagebus.network.rpc.RPCNetworkParams in project vespa by vespa-engine.

the class SharedSourceSessionTestCase method newSourceSession.

private static SharedSourceSession newSourceSession(String slobrokId, SourceSessionParams params) {
    RPCNetworkParams netParams = new RPCNetworkParams().setSlobrokConfigId(slobrokId);
    MessageBusParams mbusParams = new MessageBusParams().addProtocol(new SimpleProtocol());
    SharedMessageBus mbus = SharedMessageBus.newInstance(mbusParams, netParams);
    SharedSourceSession session = mbus.newSourceSession(params);
    mbus.release();
    return session;
}
Also used : SimpleProtocol(com.yahoo.messagebus.test.SimpleProtocol) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) MessageBusParams(com.yahoo.messagebus.MessageBusParams)

Example 15 with RPCNetworkParams

use of com.yahoo.messagebus.network.rpc.RPCNetworkParams in project vespa by vespa-engine.

the class ChokeTestCase method setUp.

@Before
public void setUp() throws ListenFailedException, UnknownHostException {
    slobrok = new Slobrok();
    dstServer = new TestServer(new MessageBusParams().addProtocol(new SimpleProtocol()), new RPCNetworkParams().setIdentity(new Identity("dst")).setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
    dstSession = dstServer.mb.createDestinationSession(new DestinationSessionParams().setName("session").setMessageHandler(new Receptor()));
    srcServer = new TestServer(new MessageBusParams().setRetryPolicy(null).addProtocol(new SimpleProtocol()), new RPCNetworkParams().setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
    srcSession = srcServer.mb.createSourceSession(new SourceSessionParams().setTimeout(600.0).setThrottlePolicy(null).setReplyHandler(new Receptor()));
    assertTrue(srcServer.waitSlobrok("dst/session", 1));
}
Also used : SimpleProtocol(com.yahoo.messagebus.test.SimpleProtocol) Receptor(com.yahoo.messagebus.test.Receptor) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Identity(com.yahoo.messagebus.network.Identity) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer) Before(org.junit.Before)

Aggregations

RPCNetworkParams (com.yahoo.messagebus.network.rpc.RPCNetworkParams)20 Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)15 SimpleProtocol (com.yahoo.messagebus.test.SimpleProtocol)12 Identity (com.yahoo.messagebus.network.Identity)10 TestServer (com.yahoo.messagebus.network.rpc.test.TestServer)10 Receptor (com.yahoo.messagebus.test.Receptor)10 Test (org.junit.Test)6 ListenFailedException (com.yahoo.jrt.ListenFailedException)3 MessageBusParams (com.yahoo.messagebus.MessageBusParams)3 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)2 DocumentProtocol (com.yahoo.documentapi.messagebus.protocol.DocumentProtocol)2 SimpleMessage (com.yahoo.messagebus.test.SimpleMessage)2 Before (org.junit.Before)2 DaemonThreadFactory (com.yahoo.concurrent.DaemonThreadFactory)1 ThroughputLimitQueue (com.yahoo.documentapi.ThroughputLimitQueue)1 MessageBusDocumentAccess (com.yahoo.documentapi.messagebus.MessageBusDocumentAccess)1 MessageBusParams (com.yahoo.documentapi.messagebus.MessageBusParams)1 LoadTypeSet (com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet)1 Spec (com.yahoo.jrt.Spec)1 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)1