@lastshotlabs/slingshot-kafka
npm install @lastshotlabs/slingshot-kafka
Functions
Section titled “Functions”createInMemoryDedupStore
Section titled “createInMemoryDedupStore”Broker metadata attached to one inbound Kafka message after normalization.
function createInMemoryDedupStore(options: { maxKeys?: number } = {}): MessageDedupStoreSource: packages/slingshot-kafka/src/kafkaConnectors.ts
createKafkaAdapter
Section titled “createKafkaAdapter”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
function createKafkaAdapter(rawOpts: KafkaAdapterOptions & EventBusSerializationOptions & { /** * Optional metrics sink. When provided, the adapter records publish / * consume / dlq counters, publish/consume durations, and pending-buffer * + connection-state gauges so operators can wire ad-hoc dashboards * without log scraping. Defaults to a no-op emitter. */ metrics?: MetricsEmitter; /** * Optional structured logger. Defaults to a console-backed JSON * logger when omitted. All warn/error paths route through the logger * so no structured information is lost to console formatting. */ logger?: Logger; },): SlingshotEventBus &Source: packages/slingshot-kafka/src/kafkaAdapter.ts
createKafkaConnectors
Section titled “createKafkaConnectors”Broker metadata attached to one inbound Kafka message after normalization.
function createKafkaConnectors(rawOpts: KafkaConnectorsConfig & { /** * Optional metrics sink. When provided, the connector records publish / * consume / dlq counters and durations alongside the existing * observability hooks. Defaults to a no-op emitter. */ metrics?: MetricsEmitter; },): KafkaConnectorHandleSource: packages/slingshot-kafka/src/kafkaConnectors.ts
getKafkaAdapterIntrospectionOrNull
Section titled “getKafkaAdapterIntrospectionOrNull”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
function getKafkaAdapterIntrospectionOrNull(bus: SlingshotEventBus,): KafkaAdapterIntrospection | nullSource: packages/slingshot-kafka/src/kafkaAdapter.ts
kafkaAdapterOptionsSchema
Section titled “kafkaAdapterOptionsSchema”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
autoCreateTopics | Whether to automatically create topics that do not yet exist on the broker |
brokers | List of Kafka broker addresses to connect to |
clientId | Kafka client identifier for this adapter instance |
compression | Compression codec applied to produced messages (e.g. gzip, snappy, lz4) |
connectionTimeout | Milliseconds to wait for the initial broker connection before timing out |
defaultPartitions | Default number of partitions when auto-creating topics |
groupPrefix | Prefix prepended to all consumer group IDs created by this adapter |
heartbeatInterval | Interval in milliseconds between consumer heartbeats to the group coordinator |
maxRetries | Maximum number of retries for failed produce or consume operations |
replicationFactor | Replication factor used when auto-creating topics |
requestTimeout | Milliseconds to wait for a broker request response before timing out |
sasl | SASL authentication configuration for the Kafka connection |
sessionTimeout | Consumer session timeout in milliseconds; triggers a rebalance if exceeded |
ssl | TLS/SSL configuration for the Kafka connection |
startFromBeginning | Whether new consumer groups start reading from the earliest available offset |
topicPrefix | Prefix prepended to all topic names produced or consumed by this adapter |
validation | Event payload validation mode: strict rejects, warn logs, off skips validation |
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
kafkaConnectorsSchema
Section titled “kafkaConnectorsSchema”Broker metadata attached to one inbound Kafka message after normalization.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
| `/** Override the default inbound dedup TTL (1h). Set to 0 to disable dedup. */ | |
| dedupTtlMs` | Override the default inbound dedup TTL (1h); set to 0 to disable dedup |
brokers | List of Kafka broker addresses for the connector bridge |
clientId | Kafka client identifier for this connector bridge instance |
compression | Default compression codec applied to produced messages across all connectors |
drainIntervalMs | Interval in milliseconds between pending buffer drain attempts |
hooks | Observability hooks for monitoring inbound and outbound connector activity |
inbound | Array of inbound connector definitions consuming from Kafka topics |
maxProduceAttempts | Maximum number of produce attempts before a buffered outbound message is dropped |
sasl | SASL authentication configuration for the connector Kafka connection |
serializer | Default serializer used for all connectors unless overridden per connector |
ssl | TLS/SSL configuration for the connector Kafka connection |
validationMode | Default payload validation mode applied to all connectors unless overridden |
Source: packages/slingshot-kafka/src/kafkaConnectors.ts
toGroupId
Section titled “toGroupId”Convert a Slingshot event key to a Kafka topic name.
The event’s : separators are replaced with . (preserving the namespace
convention) and the prefix is prepended verbatim. Inputs that contain
Kafka-illegal characters or consecutive colons are passed through; callers
are responsible for keeping event names well-formed (use defineEvent and
the namespace:resource.action convention).
function toGroupId(prefix: string, topic: string, name: string): stringSource: packages/slingshot-kafka/src/kafkaTopicNaming.ts
toTopicName
Section titled “toTopicName”Convert a Slingshot event key to a Kafka topic name.
The event’s : separators are replaced with . (preserving the namespace
convention) and the prefix is prepended verbatim. Inputs that contain
Kafka-illegal characters or consecutive colons are passed through; callers
are responsible for keeping event names well-formed (use defineEvent and
the namespace:resource.action convention).
function toTopicName(prefix: string, event: string): stringSource: packages/slingshot-kafka/src/kafkaTopicNaming.ts
Classes
Section titled “Classes”KafkaAdapterConfigError
Section titled “KafkaAdapterConfigError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaAdapterError
Section titled “KafkaAdapterError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaConnectorError
Section titled “KafkaConnectorError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaConnectorMessageIdError
Section titled “KafkaConnectorMessageIdError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaConnectorStateError
Section titled “KafkaConnectorStateError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaConnectorValidationError
Section titled “KafkaConnectorValidationError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaDuplicateConnectorError
Section titled “KafkaDuplicateConnectorError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaDuplicateDurableSubscriptionError
Section titled “KafkaDuplicateDurableSubscriptionError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaDurableSubscriptionNameRequiredError
Section titled “KafkaDurableSubscriptionNameRequiredError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
KafkaDurableSubscriptionOffError
Section titled “KafkaDurableSubscriptionOffError”Errors thrown by the Kafka event bus adapter and connector bridge.
Source: packages/slingshot-kafka/src/errors.ts
Interfaces
Section titled “Interfaces”ConnectorObservabilityHooks
Section titled “ConnectorObservabilityHooks”Broker metadata attached to one inbound Kafka message after normalization.
Source: packages/slingshot-kafka/src/kafkaConnectors.ts
KafkaAdapterDropEvent
Section titled “KafkaAdapterDropEvent”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
KafkaAdapterHealth
Section titled “KafkaAdapterHealth”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
KafkaAdapterHealthSnapshot
Section titled “KafkaAdapterHealthSnapshot”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
KafkaAdapterIntrospection
Section titled “KafkaAdapterIntrospection”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
MessageDedupStore
Section titled “MessageDedupStore”Broker metadata attached to one inbound Kafka message after normalization.
Source: packages/slingshot-kafka/src/kafkaConnectors.ts
DuplicatePublishPolicy
Section titled “DuplicatePublishPolicy”Broker metadata attached to one inbound Kafka message after normalization.
Source: packages/slingshot-kafka/src/kafkaConnectors.ts
InboundConnectorConfig
Section titled “InboundConnectorConfig”Broker metadata attached to one inbound Kafka message after normalization.
Source: packages/slingshot-kafka/src/kafkaConnectors.ts
KafkaAdapterDeserErrorPolicy
Section titled “KafkaAdapterDeserErrorPolicy”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
KafkaAdapterDropReason
Section titled “KafkaAdapterDropReason”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
KafkaAdapterOptions
Section titled “KafkaAdapterOptions”Reasons the adapter may drop or skip an event. Surfaced through onDrop so
SREs can wire metrics and alerts without log scraping.
Source: packages/slingshot-kafka/src/kafkaAdapter.ts
KafkaConnectorsConfig
Section titled “KafkaConnectorsConfig”Broker metadata attached to one inbound Kafka message after normalization.
Source: packages/slingshot-kafka/src/kafkaConnectors.ts
OutboundConnectorConfig
Section titled “OutboundConnectorConfig”Broker metadata attached to one inbound Kafka message after normalization.
Source: packages/slingshot-kafka/src/kafkaConnectors.ts