A client for use with a Liftbridge cluster.
String or array of strings of Liftbridge server addresses to connect to.
TLS credentials to use. Defaults to insecure context.
Additional options to pass on to low-level gRPC client for channel creation.
Create an ephemeral subscription for the given stream. It begins
receiving messages starting at the configured position and waits
for new messages when it reaches the end of the stream. The default
start position is the end of the stream. It throws NoSuchPartitionError
if the given stream does not exist. Use subscribe().close()
to close
a subscription.
Stream to subscribe to.
ReadableStream of messages.
Close the client connection to the Liftbridge cluster.
Establish a connection to the Liftbridge cluster.
Milliseconds before the connection attempt times out. This is set as the gRPC Deadline.
Retry & backoff options.
Client instance.
Create a new stream attached to a NATS subject. Subject is the NATS subject the stream is attached to, and name is the stream identifier, unique per subject. It throws PartitionAlreadyExistsError if a stream with the given subject and name already exists.
Stream to create.
CreateStreamResponse gRPC object.
Publish a new message to the NATS subject. If the AckPolicy is not NONE and a deadline is provided, this will synchronously block until the first ack is received. If the ack is not received in time, a DeadlineExceeded status code is returned. If an AckPolicy and deadline are configured, this returns the first Ack on success, otherwise it returns null.
Message to publish.
PublishResponse gRPC object.
Create a client for working with a Liftbridge cluster.
Insecure connection (default).
import LiftbridgeClient from 'liftbridge'; const client = new LiftbridgeClient('localhost:9292'); await client.connect();
Secure TLS connection (recommended in production).
import LiftbridgeClient from 'liftbridge'; const client = new LiftbridgeClient('localhost:9292', { rootCertificateFile: './credentials/ca.crt', privateKeyFile: './credentials/private.key', certificateChainFile: './credentials/chain.crt' }); await client.connect();