pulsar.client.transport package

Submodules

pulsar.client.transport.curl module

class pulsar.client.transport.curl.PycurlTransport(timeout=None, **kwrgs)[source]

Bases: object

execute(url, method=None, data=None, input_path=None, output_path=None)[source]
pulsar.client.transport.curl.get_file(url, path: str)[source]
pulsar.client.transport.curl.post_file(url, path)[source]

pulsar.client.transport.relay module

HTTP transport for communicating with pulsar-relay.

Provides methods for posting messages, long-polling, and managing authentication with the relay server.

class pulsar.client.transport.relay.RelayTransport(relay_url: str, username: str, password: str, timeout: int = 30, cursor_path: str | None = None)[source]

Bases: object

HTTP transport for pulsar-relay communication.

Handles: - Message publishing (single and bulk) - Long-polling for message consumption - Automatic authentication and retry

clear_tracked_message_ids(topic: str | None = None) None[source]

Clear tracked message IDs.

Args:
topic: If provided, clears only the specified topic.

If None, clears all tracked message IDs.

close()[source]

Close the transport and cleanup resources.

get_all_tracked_message_ids() Dict[str, str][source]

Get all tracked message IDs.

Returns:

Dictionary mapping topic names to last message IDs

get_last_message_id(topic: str) str | None[source]

Get the last tracked message ID for a topic.

Args:

topic: Topic name

Returns:

Last message ID for the topic, or None if not tracked

long_poll(topics: List[str], timeout: int = 30) List[Dict[str, Any]][source]

Poll for messages from specified topics.

This is a blocking call that waits up to ‘timeout’ seconds for new messages. Automatically tracks the last message ID per topic and includes it in subsequent poll requests to ensure no messages are missed.

Args:

topics: List of topic names to subscribe to timeout: Maximum seconds to wait for messages (1-60)

Returns:

List of message dictionaries

Raises:

RelayTransportError: If the request fails

post_bulk_messages(messages: List[Dict[str, Any]]) Dict[str, Any][source]

Post multiple messages in a single request.

Automatically retries on communication errors and server errors (5xx) with exponential backoff. Does not retry on client errors (4xx).

Args:

messages: List of message dictionaries, each containing ‘topic’ and ‘payload’

Returns:

Response dictionary with results and summary

Raises:

RelayTransportError: If the request fails with a client error (4xx)

post_message(topic: str, payload: Dict[str, Any], ttl: int | None = None, metadata: Dict[str, str] | None = None) Dict[str, Any][source]

Post a single message to the relay.

Automatically retries on communication errors and server errors (5xx) with exponential backoff. Does not retry on client errors (4xx).

Args:

topic: Topic name to publish to payload: Message payload (must be JSON-serializable) ttl: Time-to-live in seconds (optional) metadata: Optional metadata dictionary

Returns:

Response dictionary with message_id, topic, and timestamp

Raises:

RelayTransportError: If the request fails with a client error (4xx)

set_last_message_id(topic: str, message_id: str) None[source]

Manually set the last message ID for a topic.

This can be useful for resuming from a specific message ID after a restart.

Args:

topic: Topic name message_id: Message ID to set as the last seen message

exception pulsar.client.transport.relay.RelayTransportError[source]

Bases: Exception

Raised when communication with pulsar-relay fails.

pulsar.client.transport.requests module

pulsar.client.transport.requests.get_file(url, path)[source]
pulsar.client.transport.requests.post_file(url, path)[source]

pulsar.client.transport.ssh module

pulsar.client.transport.ssh.rsync_get_file(uri_from, uri_to, user, host, port, key)[source]
pulsar.client.transport.ssh.rsync_post_file(uri_from, uri_to, user, host, port, key)[source]
pulsar.client.transport.ssh.scp_get_file(uri_from, uri_to, user, host, port, key)[source]
pulsar.client.transport.ssh.scp_post_file(uri_from, uri_to, user, host, port, key)[source]

pulsar.client.transport.standard module

Pulsar HTTP Client layer based on Python Standard Library (urllib)

class pulsar.client.transport.standard.UrllibTransport(timeout=None, **kwrgs)[source]

Bases: object

execute(url, method=None, data=None, input_path=None, output_path=None)[source]

pulsar.client.transport.tus module

pulsar.client.transport.tus.find_tus_endpoint(job_files_endpoint: str) str[source]
pulsar.client.transport.tus.tus_upload_file(url: str, path: str) None[source]

Module contents

pulsar.client.transport.get_file(url, path)[source]
pulsar.client.transport.get_transport(transport_type=None, os_module=<module 'os' (frozen)>, transport_params=None)[source]
pulsar.client.transport.post_file(url, path)[source]
pulsar.client.transport.rsync_get_file(uri_from, uri_to, user, host, port, key)[source]
pulsar.client.transport.rsync_post_file(uri_from, uri_to, user, host, port, key)[source]
pulsar.client.transport.scp_get_file(uri_from, uri_to, user, host, port, key)[source]
pulsar.client.transport.scp_post_file(uri_from, uri_to, user, host, port, key)[source]