Search in sources :

Example 1 with ProducerConfigurationData

use of org.apache.pulsar.client.impl.conf.ProducerConfigurationData in project incubator-pulsar by apache.

the class PulsarClientImpl method createProducer.

@Override
public Producer<byte[]> createProducer(final String topic, final ProducerConfiguration conf) throws PulsarClientException {
    if (conf == null) {
        throw new PulsarClientException.InvalidConfigurationException("Invalid null configuration object");
    }
    try {
        ProducerConfigurationData confData = conf.getProducerConfigurationData().clone();
        confData.setTopicName(topic);
        return createProducerAsync(confData).get();
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof PulsarClientException) {
            throw (PulsarClientException) t;
        } else {
            throw new PulsarClientException(t);
        }
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new PulsarClientException(e);
    }
}
Also used : ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData) PulsarClientException(org.apache.pulsar.client.api.PulsarClientException) ExecutionException(java.util.concurrent.ExecutionException)

Example 2 with ProducerConfigurationData

use of org.apache.pulsar.client.impl.conf.ProducerConfigurationData in project incubator-pulsar by apache.

the class PulsarClientImpl method createProducerAsync.

@Override
public CompletableFuture<Producer<byte[]>> createProducerAsync(final String topic, final ProducerConfiguration conf) {
    ProducerConfigurationData confData = conf.getProducerConfigurationData().clone();
    confData.setTopicName(topic);
    return createProducerAsync(confData);
}
Also used : ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData)

Example 3 with ProducerConfigurationData

use of org.apache.pulsar.client.impl.conf.ProducerConfigurationData in project incubator-pulsar by apache.

the class PulsarClientImpl method createProducerAsync.

@Override
public CompletableFuture<Producer<byte[]>> createProducerAsync(String topic) {
    ProducerConfigurationData conf = new ProducerConfigurationData();
    conf.setTopicName(topic);
    return createProducerAsync(conf);
}
Also used : ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData)

Example 4 with ProducerConfigurationData

use of org.apache.pulsar.client.impl.conf.ProducerConfigurationData in project incubator-pulsar by apache.

the class PulsarClientImpl method createProducer.

@Override
public Producer<byte[]> createProducer(String topic) throws PulsarClientException {
    try {
        ProducerConfigurationData conf = new ProducerConfigurationData();
        conf.setTopicName(topic);
        return createProducerAsync(conf).get();
    } catch (ExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof PulsarClientException) {
            throw (PulsarClientException) t;
        } else {
            throw new PulsarClientException(t);
        }
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new PulsarClientException(e);
    }
}
Also used : ProducerConfigurationData(org.apache.pulsar.client.impl.conf.ProducerConfigurationData) PulsarClientException(org.apache.pulsar.client.api.PulsarClientException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ProducerConfigurationData (org.apache.pulsar.client.impl.conf.ProducerConfigurationData)4 ExecutionException (java.util.concurrent.ExecutionException)2 PulsarClientException (org.apache.pulsar.client.api.PulsarClientException)2