Skip to main content

IBM Streams Event Streams integration for IBM Streams topology applications

Project description

Overview

Provides functions to read messages from IBM Event Streams as a stream and publish tuples to Event Streams as messages.

IBM® Event Streams is a fully managed, cloud-based messaging service. Built on Apache Kafka, IBM Event Streams is a high-throughput, fault-tolerant, event management platform that helps you build intelligent, responsive, event-driven applications.

You may also review the streamsx.kafka package. to integrate IBM Event Streams cloud service with your IBM Streams topology applications.

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, ContextTypes
import streamsx.eventstreams as eventstreams
import time

def delay(v):
    time.sleep(5.0)
    return True

topology = Topology('EventStreamsHelloWorld')

to_evstr = topology.source(['Hello', 'World!'])
to_evstr = to_evstr.as_string()
# delay tuple by tuple
to_evstr = to_evstr.filter(delay)

# Publish a stream to Event Streams using HELLO topic
eventstreams.publish(to_evstr, topic='HELLO')

# Subscribe to same topic as a stream
from_evstr = eventstreams.subscribe(topology, schema=CommonSchema.String, topic='HELLO')

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

# finally submit the topology to a Streaming  Analytics Service instance
submit(ContextTypes.STREAMING_ANALYTICS_SERVICE, topology)

Project details


Download files

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

Files for streamsx.eventstreams, version 2.0.1
Filename, size File type Python version Upload date Hashes
Filename, size streamsx.eventstreams-2.0.1-py2.py3-none-any.whl (16.1 kB) File type Wheel Python version 3.6 Upload date Hashes View
Filename, size streamsx.eventstreams-2.0.1.tar.gz (12.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page