Search in sources :

Example 1 with MessageBusParams

use of com.yahoo.messagebus.MessageBusParams 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 2 with MessageBusParams

use of com.yahoo.messagebus.MessageBusParams in project vespa by vespa-engine.

the class ClientThreadingTestCase method newMbusClient.

private static MbusClient newMbusClient(final LocalWire wire) {
    final SharedMessageBus mbus = new SharedMessageBus(new MessageBus(new LocalNetwork(wire), new MessageBusParams().addProtocol(new SimpleProtocol())));
    final SharedSourceSession session = mbus.newSourceSession(new SourceSessionParams());
    final MbusClient client = new MbusClient(session);
    session.release();
    mbus.release();
    return client;
}
Also used : MessageBus(com.yahoo.messagebus.MessageBus) SharedMessageBus(com.yahoo.messagebus.shared.SharedMessageBus) SimpleProtocol(com.yahoo.messagebus.test.SimpleProtocol) LocalNetwork(com.yahoo.messagebus.network.local.LocalNetwork) SharedMessageBus(com.yahoo.messagebus.shared.SharedMessageBus) MessageBusParams(com.yahoo.messagebus.MessageBusParams) SourceSessionParams(com.yahoo.messagebus.SourceSessionParams) SharedSourceSession(com.yahoo.messagebus.shared.SharedSourceSession)

Example 3 with MessageBusParams

use of com.yahoo.messagebus.MessageBusParams in project vespa by vespa-engine.

the class ServerThreadingTestCase method newMbusServer.

private static MbusServer newMbusServer(final CurrentContainer container, final LocalWire wire) {
    final SharedMessageBus mbus = new SharedMessageBus(new MessageBus(new LocalNetwork(wire), new MessageBusParams().addProtocol(new SimpleProtocol())));
    final SharedDestinationSession session = mbus.newDestinationSession(new DestinationSessionParams());
    final MbusServer server = new MbusServer(container, session);
    session.release();
    mbus.release();
    return server;
}
Also used : MessageBus(com.yahoo.messagebus.MessageBus) SharedMessageBus(com.yahoo.messagebus.shared.SharedMessageBus) SimpleProtocol(com.yahoo.messagebus.test.SimpleProtocol) LocalNetwork(com.yahoo.messagebus.network.local.LocalNetwork) SharedDestinationSession(com.yahoo.messagebus.shared.SharedDestinationSession) SharedMessageBus(com.yahoo.messagebus.shared.SharedMessageBus) MessageBusParams(com.yahoo.messagebus.MessageBusParams) DestinationSessionParams(com.yahoo.messagebus.DestinationSessionParams)

Example 4 with MessageBusParams

use of com.yahoo.messagebus.MessageBusParams 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 5 with MessageBusParams

use of com.yahoo.messagebus.MessageBusParams 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)

Aggregations

MessageBusParams (com.yahoo.messagebus.MessageBusParams)5 RPCNetworkParams (com.yahoo.messagebus.network.rpc.RPCNetworkParams)3 SimpleProtocol (com.yahoo.messagebus.test.SimpleProtocol)3 Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)2 MessageBus (com.yahoo.messagebus.MessageBus)2 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)2 LocalNetwork (com.yahoo.messagebus.network.local.LocalNetwork)2 SharedMessageBus (com.yahoo.messagebus.shared.SharedMessageBus)2 Test (org.junit.Test)2 ListenFailedException (com.yahoo.jrt.ListenFailedException)1 DestinationSessionParams (com.yahoo.messagebus.DestinationSessionParams)1 SharedDestinationSession (com.yahoo.messagebus.shared.SharedDestinationSession)1 SharedSourceSession (com.yahoo.messagebus.shared.SharedSourceSession)1