Search in sources :

Example 6 with RPCNetworkParams

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

the class SharedDestinationSessionTestCase 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);
    SharedDestinationSession session = mbus.newDestinationSession(new DestinationSessionParams());
    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 7 with RPCNetworkParams

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

the class SharedDestinationSessionTestCase method newDestinationSession.

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

Example 8 with RPCNetworkParams

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

the class SharedMessageBusTestCase method requireThatMbusIsClosedOnDestroy.

@Test
public void requireThatMbusIsClosedOnDestroy() throws ListenFailedException {
    Slobrok slobrok = new Slobrok();
    SharedMessageBus mbus = SharedMessageBus.newInstance(new MessageBusParams(), new RPCNetworkParams().setSlobrokConfigId(slobrok.configId()));
    mbus.release();
    assertFalse(mbus.messageBus().destroy());
}
Also used : RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) MessageBusParams(com.yahoo.messagebus.MessageBusParams) Test(org.junit.Test)

Example 9 with RPCNetworkParams

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

the class SharedIntermediateSessionTestCase method newIntermediateSession.

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

Example 10 with RPCNetworkParams

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

the class DummyReceiver method init.

public void init() {
    MessageBusParams params = new MessageBusParams(new LoadTypeSet());
    params.setRPCNetworkParams(new RPCNetworkParams().setIdentity(new Identity(name)));
    params.setDocumentManagerConfigId("client");
    params.getMessageBusParams().setMaxPendingCount(maxPendingCount);
    params.getMessageBusParams().setMaxPendingSize(0);
    da = new MessageBusDocumentAccess(params);
    queue = (maxQueueTime < 0) ? new LinkedBlockingDeque<>() : new ThroughputLimitQueue<>(maxQueueTime);
    session = da.getMessageBus().createDestinationSession("default", true, this);
    executor = new ThreadPoolExecutor(threads, threads, 5, TimeUnit.SECONDS, queue, new DaemonThreadFactory());
    System.out.println("Registered listener at " + name + "/default with " + maxPendingCount + " max pending and sleep time of " + sleepTime);
}
Also used : LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) MessageBusDocumentAccess(com.yahoo.documentapi.messagebus.MessageBusDocumentAccess) DaemonThreadFactory(com.yahoo.concurrent.DaemonThreadFactory) MessageBusParams(com.yahoo.documentapi.messagebus.MessageBusParams) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Identity(com.yahoo.messagebus.network.Identity) ThroughputLimitQueue(com.yahoo.documentapi.ThroughputLimitQueue) LoadTypeSet(com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet)

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