@Deprecated public PulsarClientImpl(String serviceUrl, ClientConfiguration conf, EventLoopGroup eventLoopGroup, ConnectionPool cnxPool) throws PulsarClientException { this(conf.setServiceUrl(serviceUrl).getConfigurationData().clone(), eventLoopGroup, cnxPool); }
/** * Create a LoadSimulationClient with the given JCommander arguments. * * @param arguments * Arguments to configure this from. */ public LoadSimulationClient(final MainArguments arguments) throws Exception { payloadCache = new ConcurrentHashMap<>(); topicsToTradeUnits = new ConcurrentHashMap<>(); clientConf = new ClientConfiguration(); clientConf.setConnectionsPerBroker(4); clientConf.setIoThreads(Runtime.getRuntime().availableProcessors()); // Disable stats on the clients to reduce CPU/memory usage. clientConf.setStatsInterval(0, TimeUnit.SECONDS); producerConf = new ProducerConfiguration(); // Disable timeout. producerConf.setSendTimeout(0, TimeUnit.SECONDS); producerConf.setMessageRoutingMode(ProducerConfiguration.MessageRoutingMode.RoundRobinPartition); // Enable batching. producerConf.setBatchingMaxPublishDelay(1, TimeUnit.MILLISECONDS); producerConf.setBatchingEnabled(true); consumerConf = new ConsumerConfiguration(); consumerConf.setMessageListener(ackListener); admin = new PulsarAdmin(new URL(arguments.serviceURL), clientConf); client = new PulsarClientImpl(arguments.serviceURL, clientConf); port = arguments.port; executor = Executors.newCachedThreadPool(new DefaultThreadFactory("test-client")); }
/** * Create a new PulsarClient object using default client configuration * * @param serviceUrl * the url of the Pulsar endpoint to be used * @return a new pulsar client object * @throws PulsarClientException.InvalidServiceURL * if the serviceUrl is invalid * @deprecated use {@link #builder()} to construct a client instance */ @Deprecated public static PulsarClient create(String serviceUrl) throws PulsarClientException { return create(serviceUrl, new ClientConfiguration()); }
/** * Construct a new Pulsar Admin client object. * <p> * This client object can be used to perform many subsquent API calls * * @param serviceUrl * the Pulsar service URL (eg. "http://my-broker.example.com:8080") * @param pulsarConfig * the ClientConfiguration object to be used to talk with Pulsar * @deprecated Since 2.0. Use {@link #builder()} to construct a new {@link PulsarAdmin} instance. */ @Deprecated public PulsarAdmin(URL serviceUrl, ClientConfiguration pulsarConfig) throws PulsarClientException { this(serviceUrl.toString(), pulsarConfig.getConfigurationData()); }
public PulsarLogger(Map<String, Object> props) throws PulsarClientException { String brokerHost = (String) props.get(PULSAR_SERVICE_URL_PROP_NAME); Integer brokerPort = (Integer) props.get(PULSAR_SERVICE_URL_PORT_PROP_NAME); pulsarURL.append(brokerHost); pulsarURL.append(":"); pulsarURL.append(brokerPort); this.topic = (String) props.get("topic"); if (props.get("sync") != null) { this.sync = (Boolean) props.get("sync"); } else { this.sync = false; } if (props.get("flatten") != null) { this.flatten = (Boolean) props.get("flatten"); } else { this.flatten = false; } this.pulsarClient = new PulsarClientImpl(pulsarURL.toString(), new ClientConfiguration()); this.producer = pulsarClient.createProducer(topic); this.jsonUtils = new JsonUtils(); }
@Deprecated public PulsarClientImpl(String serviceUrl, ClientConfiguration conf, EventLoopGroup eventLoopGroup) throws PulsarClientException { this(conf.setServiceUrl(serviceUrl).getConfigurationData().clone(), eventLoopGroup); }
@Deprecated public PulsarClientImpl(String serviceUrl, ClientConfiguration conf) throws PulsarClientException { this(conf.setServiceUrl(serviceUrl).getConfigurationData().clone()); }