IBM Streams 4.2.1

SPL File topics.spl

Topic based publish-subscribe model for streams. Supports a microservice architecture for IBM Streams applications where streams are published to topics and can be subscribed to be independent applications. Use of interchange schema types allows applications to be implemented in different langauges, including SPL, Python, Java & Scala.

Content

Operators
  • Publish: Publish a stream to a topic.
  • Subscribe: Subscribe to topics using a topic filter.
Functions

Composites

composite Publish(input In)

Publish a stream to a topic. Allows other IBM Streams applications to subscribe to the input stream, including those written in different languages. See namespace:com.ibm.streamsx.topology.topic for details.

Parameters

  • topic: Topic to publish stream to.
  • allowFilter: True if filters can be pushed from subscribing SPL applications. Optional, defaults to false.

Input Ports

  • In: Stream to be published as a topic.

composite Subscribe(output Topic)

Subscribe to topics using a topic filter. Generates a stream that is subscribed, through IBM Streams dynamic connections, to all streams published to topics that match the topic filter topic and are an exact stream type match to streamType. See namespace:com.ibm.streamsx.topology.topic for details.

Parameters

  • topic: Topic filter to subscribe to.
  • streamType: Type of output stream Topic.

Output Ports

  • Topic: Subscription to topic.

Functions

rstring getTopicSubscription(rstring topic)

Get the subscription that matches a topic for topic based subscription.

This is a low-level function that allows applications to build custom composites with functionality similar to Subscribe. The preference should be to use Subscribe where possible.

Parameters

  • topic: Topic to subscribe to.

Returns

  • rstring

rstring addUDPSubscription(rstring subscription)

Take a subscription and modify it to account for parallel regions in the publisher or subscriber.

This is a low-level function that allows applications to build custom composites with functionality similar to Subscribe or FilteredSubscribe. The preference should be to use Subscribe or FilteredSubscribe where possible.

Parameters

  • subscription: Base subscription.

Returns

  • rstring

int32 setSubscribeSubscription(rstring subscription)

Set a subscription expression adding in UDP channel based matching if the subscriber is in a parallel region.

Parameters

  • subscription: Subscription to be set on input port connected to Import operator.

Returns

  • int32

boolean checkTopicName(rstring topic)

Check a topic name is valid.

Parameters

  • topic

Returns

  • boolean

boolean checkTopicFilter(rstring topic)

Check a topic filter is valid.

Parameters

  • topic

Returns

  • boolean