ClientCurrent(final boolean autoConsumeEnabled, final String connectString) { conf = new org.apache.hedwig.client.conf.ClientConfiguration() { @Override public boolean isAutoSendConsumeMessageEnabled() { return autoConsumeEnabled; } @Override public int getConsumedMessagesBufferSize() { return 1; } @Override protected HedwigSocketAddress getDefaultServerHedwigSocketAddress() { return new HedwigSocketAddress(connectString); } }; client = new org.apache.hedwig.client.HedwigClient(conf); publisher = client.getPublisher(); subscriber = client.getSubscriber(); }
void close() throws Exception { if (null != client) { client.close(); } }