Package com.facebook.swift.service

Examples of com.facebook.swift.service.ThriftServer


    }

    private ThriftServer createServer(ServiceInterface handler)
            throws IllegalAccessException, InstantiationException {
        ThriftServiceProcessor processor = new ThriftServiceProcessor(codecManager, handler);
        return new ThriftServer(processor);
    }
View Full Code Here


        PumaReadServer puma = new PumaReadServer();
        ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), puma);

        // create server and client
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
View Full Code Here

        ReadSemanticException exception = new ReadSemanticException("my exception");
        puma.setException(exception);

        TProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), puma);
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(HostAndPort.fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
View Full Code Here

    {
        ThriftServiceProcessor processor = new ThriftServiceProcessor(codecManager, handler);
        ThriftServerConfig config = new ThriftServerConfig();
        config.setMaxFrameSize(new DataSize(MAX_FRAME_SIZE, DataSize.Unit.BYTE));

        return new ThriftServer(processor, config).start();
    }
View Full Code Here

    {
        ThriftServiceProcessor processor = new ThriftServiceProcessor(codecManager, handler);
        ThriftServerConfig config = new ThriftServerConfig();
        config.setMaxFrameSize(new DataSize(MAX_FRAME_SIZE, DataSize.Unit.BYTE));

        return new ThriftServer(processor, config).start();
    }
View Full Code Here

        ThriftServiceProcessor processor =
          new ThriftServiceProcessor(codecManager,
                                     ImmutableList.<ThriftEventHandler>of(),
                                     exampleServiceHandler,
                                     fb303Handler);
        final ThriftServer server =
                new ThriftServer(
                        processor,
                        config,
                        new NiftyTimer("thrift"),
                        ImmutableMap.<String, ThriftFrameCodecFactory>of("header", new HeaderThriftCodecFactory()),
                        ImmutableMap.<String, TDuplexProtocolFactory>of("header", new TDuplexHeaderProtocolFactory()),
                        ImmutableMap.<String, ExecutorService>of(),
                        new NiftyNoOpSecurityFactory());

        fb303Handler.setShutdownHandler(new ServerShutdownHandler(server));
        server.start();
    }
View Full Code Here

        );

        // Start server
        LifeCycleManager serverLifeCycleManager = serverInjector.getInstance(LifeCycleManager.class);
        serverLifeCycleManager.start();
        ThriftServer server = serverInjector.getInstance(ThriftServer.class);
        int serverPort = server.getPort();

        // Start client manager and send request
        LifeCycleManager clientLifeCycleManager = clientInjector.getInstance(LifeCycleManager.class);
        clientLifeCycleManager.start();
        sendClientRequest(clientInjector, serverPort);
View Full Code Here

        PumaReadServer puma = new PumaReadServer();
        ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), ImmutableList.<ThriftEventHandler>of(), puma);

        // create server and client
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
View Full Code Here

        ReadSemanticException exception = new ReadSemanticException("my exception");
        puma.setException(exception);

        NiftyProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), ImmutableList.<ThriftEventHandler>of(), puma);
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(HostAndPort.fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
View Full Code Here

            throws ExecutionException, InterruptedException
    {
        ThriftCodecManager codecManager = new ThriftCodecManager();
        ThriftServiceProcessor processor = new ThriftServiceProcessor(codecManager, ImmutableList.<ThriftEventHandler>of(), new GenericService());

        try (ThriftServer server = new ThriftServer(processor, new ThriftServerConfig()).start();
             ThriftClientManager clientManager = new ThriftClientManager(codecManager)) {
            ThriftClient<GenericInterface.Client> clientOpener = new ThriftClient<>(clientManager, GenericInterface.Client.class);
            try (GenericInterface.Client client = clientOpener.open(new FramedClientConnector(HostAndPort.fromParts("localhost", server.getPort()))).get()) {
                GenericStruct<String> original = new GenericStruct<>();
                original.genericField = "original.genericField";
View Full Code Here

TOP

Related Classes of com.facebook.swift.service.ThriftServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.