Package org.apache.hedwig.client.conf

Examples of org.apache.hedwig.client.conf.ClientConfiguration


    @Test
    public void testCloseSubscribeDuringResubscribe() throws Exception {
        client.close();

        final long reconnectWaitTime = 2000L;
        client = new HedwigClient(new ClientConfiguration() {
            @Override
            public HedwigSocketAddress getDefaultServerHedwigSocketAddress() {
                return getDefaultHedwigAddress();
            }
View Full Code Here


        return new RegionClientConfiguration(serverPort, sslServerPort);
    }

    // Method to get a ClientConfiguration for the Cross Region Hedwig Client.
    protected ClientConfiguration getRegionClientConfiguration() {
        return new ClientConfiguration() {
            @Override
            public HedwigSocketAddress getDefaultServerHedwigSocketAddress() {
                return regionHubAddresses.get(0).get(0);
            }
        };
View Full Code Here

     * @param hub
     *            The hub in another region to connect to.
     */
    HedwigHubClient create(final HedwigSocketAddress hub) {
        // Create a hub specific version of the client to use
        ClientConfiguration hubClientConfiguration = new ClientConfiguration() {
            @Override
            protected HedwigSocketAddress getDefaultServerHedwigSocketAddress() {
                return hub;
            }

            @Override
            public boolean isSSLEnabled() {
                return cfg.isInterRegionSSLEnabled() || clientConfiguration.isSSLEnabled();
            }
        };
        try {
            hubClientConfiguration.addConf(this.clientConfiguration.getConf());
        } catch (ConfigurationException e) {
            String msg = "Configuration exception while loading the client configuration for the region manager.";
            logger.error(msg);
            throw new RuntimeException(msg);
        }
View Full Code Here

        serversList = new LinkedList<PubSubServer>();

        for (int i = 0; i < numServers; i++) {
            ServerConfiguration conf = getServerConfiguration(serverAddresses.get(i).getPort(),
                                                              serverAddresses.get(i).getSSLPort());
            PubSubServer s = new PubSubServer(conf, new ClientConfiguration(), new LoggingExceptionHandler());
            serversList.add(s);
            s.start();
        }
    }
View Full Code Here

    }

    protected void startHubServer(ServerConfiguration conf) throws Exception {
        defaultAddress = new HedwigSocketAddress("localhost", conf.getServerPort(),
                                                 conf.getSSLServerPort());
        server = new PubSubServer(conf, new ClientConfiguration(), new LoggingExceptionHandler());
        server.start();
    }
View Full Code Here

        zkc.close();
        PubSubServer hedwigServer = null;
        try {
            logger.info("starting hedwig broker!");
            hedwigServer = new PubSubServer(serverConf, new ClientConfiguration(), new LoggingExceptionHandler());
            hedwigServer.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Assert.assertNotNull("failed to instantiate hedwig pub sub server", hedwigServer);
View Full Code Here

            } catch (ConfigurationException e) {
                throw new IOException(e);
            }
        }

        ClientConfiguration hubClientCfg = new ClientConfiguration();
        String clientCfgFile = cl.getOption("client-cfg");
        if (clientCfgFile != null) {
            try {
                hubClientCfg.loadConf(new File(clientCfgFile).toURI().toURL());
            } catch (ConfigurationException e) {
                throw new IOException(e);
            }
        }

        printMessage("Connecting to zookeeper/bookkeeper using HedwigAdmin");
        try {
            admin = new HedwigAdmin(bkClientConf, hubServerConf);
            admin.getZkHandle().register(new MyWatcher());
        } catch (Exception e) {
            throw new IOException(e);
        }
       
        printMessage("Connecting to default hub server " + hubClientCfg.getDefaultServerHost());
        hubClient = new HedwigClient(hubClientCfg);
        publisher = hubClient.getPublisher();
        subscriber = hubClient.getSubscriber();
        subscriber.addSubscriptionListener(new ConsoleSubscriptionListener());
       
View Full Code Here

        PubSubServer server1 = new PubSubServer(new StandAloneServerConfiguration() {
                @Override
                public int getServerPort() {
                    return super.getServerPort() + 1;
                }
            }, new ClientConfiguration(), new LoggingExceptionHandler());
        server1.start();
        server1.shutdown();
    }
View Full Code Here

            @Override
            public int getServerPort() {
                return port;
            }

        }, new ClientConfiguration(), uncaughtExceptionHandler) {

            @Override
            protected TopicManager instantiateTopicManager() throws IOException {
                return instantiator.instantiateTopicManager();
            }
View Full Code Here

        return server;

    }

    public void runPublishRequest(final int port) throws Exception {
        Publisher publisher = new HedwigClient(new ClientConfiguration() {
            @Override
            public InetSocketAddress getDefaultServerHost() {
                return new InetSocketAddress("localhost", port);
            }
        }).getPublisher();
View Full Code Here

TOP

Related Classes of org.apache.hedwig.client.conf.ClientConfiguration

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.