Skip to main content
Version: Next

Work with clients

After setting up your client library and creating a client object, you can explore more to start working with your client.

Create a client with multiple advertised listeners

To ensure clients in both internal and external networks can connect to a Pulsar cluster, Pulsar introduces advertisedListeners.

The following example creates a Python client using multiple advertised listeners:

PulsarClient client = PulsarClient.builder()
.serviceUrl("pulsar://xxxx:6650")
.listenerName("external")
.build();

Set memory limits

You can use memory limits parameters to control the total client memory usage, the producers and consumers under this client will compete for the memory assigned. For implementation details, see PIP 74: Pulsar client memory limits.

PulsarClient client = PulsarClient.builder()
.serviceUrl("pulsar://xxxx:6650")
.memoryLimit(64, SizeUnit.MEGA_BYTES)
.build();