Search in sources :

Example 6 with Identity

use of com.yahoo.messagebus.network.Identity 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 7 with Identity

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

the class VdsVisitTarget method run.

@SuppressWarnings("unchecked")
public void run() throws Exception {
    initShutdownHook();
    log.log(LogLevel.DEBUG, "Starting VdsVisitTarget");
    MessageBusParams mbusParams = new MessageBusParams(new LoadTypeSet());
    mbusParams.getRPCNetworkParams().setIdentity(new Identity(slobrokAddress));
    if (port > 0) {
        mbusParams.getRPCNetworkParams().setListenPort(port);
    }
    access = new MessageBusDocumentAccess(mbusParams);
    VdsVisitHandler handler;
    Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(handlerClassName);
    try {
        // Any custom data handlers may have a constructor that takes in args,
        // so that the user can pass cmd line options to them
        Class<?>[] consTypes = new Class<?>[] { boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, int.class, String[].class };
        Constructor<?> cons = cls.getConstructor(consTypes);
        handler = (VdsVisitHandler) cons.newInstance(printIds, verbose, verbose, verbose, false, false, processTime, handlerArgs);
    } catch (NoSuchMethodException e) {
        // Retry, this time matching the StdOutVisitorHandler constructor
        // arg list
        Class<?>[] consTypes = new Class<?>[] { boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, boolean.class, int.class, boolean.class };
        Constructor<?> cons = cls.getConstructor(consTypes);
        handler = (VdsVisitHandler) cons.newInstance(printIds, verbose, verbose, verbose, false, false, processTime, false);
    }
    VisitorDataHandler dataHandler = handler.getDataHandler();
    VisitorControlHandler controlHandler = handler.getControlHandler();
    VisitorDestinationParameters params = new VisitorDestinationParameters("visit-destination", dataHandler);
    session = access.createVisitorDestinationSession(params);
    while (!controlHandler.isDone()) {
        Thread.sleep(1000);
    }
}
Also used : MessageBusDocumentAccess(com.yahoo.documentapi.messagebus.MessageBusDocumentAccess) Constructor(java.lang.reflect.Constructor) VisitorDestinationParameters(com.yahoo.documentapi.VisitorDestinationParameters) MessageBusParams(com.yahoo.documentapi.messagebus.MessageBusParams) VisitorDataHandler(com.yahoo.documentapi.VisitorDataHandler) Identity(com.yahoo.messagebus.network.Identity) LoadTypeSet(com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet) VisitorControlHandler(com.yahoo.documentapi.VisitorControlHandler)

Example 8 with Identity

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

the class MessageBusDocumentApiTestCase method setUp.

@Before
public void setUp() throws ListenFailedException {
    slobrok = new Slobrok();
    String slobrokConfigId = "raw:slobrok[1]\n" + "slobrok[0].connectionspec tcp/localhost:" + slobrok.port() + "\n";
    MessageBusParams params = new MessageBusParams();
    params.getRPCNetworkParams().setIdentity(new Identity("test/feeder"));
    params.getRPCNetworkParams().setSlobrokConfigId(slobrokConfigId);
    params.setDocumentManagerConfigId("file:src/test/cfg/documentmanager.cfg");
    params.setRouteName("Route");
    params.setRoutingConfigId("file:src/test/cfg/messagebus.cfg");
    params.setTraceLevel(9);
    params.setSourceSessionParams(new SourceSessionParams().setThrottlePolicy(null));
    access = new MessageBusDocumentAccess(params);
    destination = new VisitableDestination(slobrokConfigId, params.getDocumentManagerConfigId());
}
Also used : MessageBusDocumentAccess(com.yahoo.documentapi.messagebus.MessageBusDocumentAccess) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) MessageBusParams(com.yahoo.documentapi.messagebus.MessageBusParams) Identity(com.yahoo.messagebus.network.Identity) SourceSessionParams(com.yahoo.messagebus.SourceSessionParams) Before(org.junit.Before)

Example 9 with Identity

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

the class SendAdapterTestCase method setUp.

@Before
public void setUp() throws ListenFailedException, UnknownHostException {
    slobrok = new Slobrok();
    dstServer = new TestServer(new MessageBusParams().addProtocol(dstProtocol = new TestProtocol()), new RPCNetworkParams().setIdentity(new Identity("dst")).setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
    dstSession = dstServer.mb.createDestinationSession(new DestinationSessionParams().setName("session").setMessageHandler(new Receptor()));
    itrServer = new TestServer(new MessageBusParams().addProtocol(itrProtocol = new TestProtocol()), new RPCNetworkParams().setIdentity(new Identity("itr")).setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
    itrSession = itrServer.mb.createIntermediateSession(new IntermediateSessionParams().setName("session").setMessageHandler(new Receptor()).setReplyHandler(new Receptor()));
    srcServer = new TestServer(new MessageBusParams().addProtocol(srcProtocol = new TestProtocol()), new RPCNetworkParams().setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
    srcSession = srcServer.mb.createSourceSession(new SourceSessionParams().setTimeout(600.0).setReplyHandler(new Receptor()));
    assertTrue(srcServer.waitSlobrok("*/session", 2));
}
Also used : Receptor(com.yahoo.messagebus.test.Receptor) 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)

Example 10 with Identity

use of com.yahoo.messagebus.network.Identity 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

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