Skip to main content

IBM Streams Kafka integration

Project description

Overview

Provides functions to read messages from a Kafka broker as a stream and submit tuples to a Kafka broker as messages.

The broker configuration must be done with properties in an application configuration. The minimum set of properties must contain the bootstrap.servers configuration, which is valid for both consumers and producers, i.e. for the subscribe and publish functions.

It is also possible to use different application configurations for subscribe and publish when special consumer or producer configs must be used.

Sample

A simple hello world example of a Streams application publishing to a topic and the same application consuming the same topic:

from streamsx.topology.topology import Topology from streamsx.topology.schema import CommonSchema from streamsx.topology.context import submit from streamsx.topology.context import ContextTypes import streamsx.kafka as kafka import time

def delay (v):

time.sleep (5.0) return True

topo = Topology(‘KafkaHelloWorld’)

to_kafka = topo.source ([‘Hello’, ‘World!’]) to_kafka = to_kafka.as_string() # delay tuple by tuple to_kafka = to_kafka.filter (delay)

# Publish a stream to Kafka using TEST topic, the Kafka servers # (bootstrap.servers) are configured in the application configuration ‘kafka_props’. kafka.publish (to_kafka, ‘TEST’, ‘kafka_props’)

# Subscribe to same topic as a stream from_kafka = kafka.subscribe (topo, ‘TEST’, ‘kafka_props’, CommonSchema.String)

# You’ll find the Hello World! in stdout log file: from_kafka.print()

submit (ContextTypes.DISTRIBUTED, topo) # The Streams job is kept running.

Documentation

  • streamsx.kafka package documentation <http://streamsxkafka.readthedocs.io/en/pypackage/>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamsx.kafka-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamsx.kafka-0.1.0-py2.py3-none-any.whl (9.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file streamsx.kafka-0.1.0.tar.gz.

File metadata

  • Download URL: streamsx.kafka-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.5

File hashes

Hashes for streamsx.kafka-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dee0075e11022710af1b0418a18c579044ab3015cf9908003c342d290e7c11aa
MD5 5888c68daaf0b6acf3f82391d921826c
BLAKE2b-256 060425501941410bd04b7dc63db38599cee0883cd15264cd42aa360a96ba9eb2

See more details on using hashes here.

File details

Details for the file streamsx.kafka-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for streamsx.kafka-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 86a16739d69a3dc337e1c1f7ac4baba7937fd29a20f7843dd6a91f35c5c1d74d
MD5 706833472d23b0abaca06971d99951fc
BLAKE2b-256 d62663fd8124840b1c870c36c41ed5602cab8e4e88a908df2b1c13792f253a7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page