Package com.facebook.swift.service

Examples of com.facebook.swift.service.ThriftClientManager.createClient()


        // 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()
        ) {
            // invoke puma
            List<ReadResultQueryInfoTimeString> results = pumaClient.getResultTimeString(PUMA_REQUEST);
View Full Code Here


        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()
        ) {
            pumaClient.getResultTimeString(PUMA_REQUEST);
            fail("Expected ReadSemanticException");
View Full Code Here

        // 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()
        ) {
            // invoke puma
            List<ReadResultQueryInfoTimeString> results = pumaClient.getResultTimeString(PUMA_REQUEST);
View Full Code Here

        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()
        ) {
            pumaClient.getResultTimeString(PUMA_REQUEST);
            fail("Expected ReadSemanticException");
View Full Code Here

     * {@link ClientExampleHelper} is used only to make the actually thrift method calls
     */
    private static void plainClientExample() throws ExecutionException, InterruptedException
    {
        try (ThriftClientManager clientManager = new ThriftClientManager();
             ExampleService rawClient = clientManager.createClient(ClientExampleHelper.getConnector(),
                                                                    ExampleService.class).get())
        {
            ClientExampleHelper.executeWithClientAndInput(rawClient, "plainClientExample");
        }
    }
View Full Code Here

    }

    private static void collectCounters() throws ExecutionException, InterruptedException
    {
        try (ThriftClientManager clientManager = new ThriftClientManager();
             Fb303 rawClient = clientManager.createClient(ClientExampleHelper.getConnector(), Fb303.class).get())
        {
            LOGGER.info("fb303 counters:\n{}", Joiner.on("\n").join(new TreeMap<>(rawClient.getCounters()).entrySet()));
        }
    }
View Full Code Here

    }

    private static void shutdownServer() throws ExecutionException, InterruptedException
    {
        try (ThriftClientManager clientManager = new ThriftClientManager();
             Fb303 rawClient = clientManager.createClient(ClientExampleHelper.getConnector(), Fb303.class).get())
        {
            rawClient.shutdown();
        }
    }
}
View Full Code Here

        // 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()
        ) {
            // invoke puma
            List<ReadResultQueryInfoTimeString> results = pumaClient.getResultTimeString(PUMA_REQUEST);
View Full Code Here

        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()
        ) {
            pumaClient.getResultTimeString(PUMA_REQUEST);
            fail("Expected ReadSemanticException");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.