streamsx.jms package

JMS integration for IBM Streams

For details of implementing applications in Python for IBM Streams including IBM Cloud Pak for Data and the Streaming Analytics service running on IBM Cloud see:

Overview

Provides functions to exchange messages with a JMS broker.

This package exposes the com.ibm.streamsx.jms toolkit as Python methods for use with Streaming Analytics service on IBM Cloud and IBM Streams including IBM Cloud Pak for Data.

streamsx.jms.download_toolkit(url=None, target_dir=None)

Downloads the latest JMS toolkit from GitHub.

Example for updating the JMS toolkit for your topology with the latest toolkit from GitHub:

import streamsx.jms as jms
# download JMS toolkit from GitHub
jms_toolkit_location = jms.download_toolkit()
# add the toolkit to topology
streamsx.spl.toolkit.add_toolkit(topology, jms_toolkit_location)

Example for updating the topology with a specific version of the JMS toolkit using a URL:

import streamsx.jms as jms
url122 = 'https://github.com/IBMStreams/streamsx.jms/releases/download/v1.2.2/streamsx.jms.toolkits-1.2.2-20190826-1516.tgz'
jms_toolkit_location = jms.download_toolkit(url=url122)
streamsx.spl.toolkit.add_toolkit(topology, jms_toolkit_location)
Parameters
  • url (str) – Link to toolkit archive (*.tgz) to be downloaded. Use this parameter to download a specific version of the toolkit.

  • target_dir (str) – the directory where the toolkit is unpacked to. If a relative path is given, the path is appended to the system temporary directory, for example to /tmp on Unix/Linux systems. If target_dir is None a location relative to the system temporary directory is chosen.

Returns

the location of the downloaded JMS toolkit

Return type

str

Note

This function requires an outgoing Internet connection

New in version 0.1.

streamsx.jms.produce(stream, schema, java_class_libs, connection, access, connection_document=None, app_configuration_name=None, user_property_name=None, password_property_name=None, ssl_connection=None, ssl_debug=None, key_store=None, key_store_password=None, trust_store=None, trust_store_password=None, jms_header_properties=None, codepage=None, reconnection_policy=None, reconnection_bound=None, period=None, consistent_region_queue_name=None, max_message_send_retries=None, message_send_retry_delay=None, name=None)

Send messages to a JMS broker.

Parameters
  • stream – The input stream containing the data to send to the JMS broker

  • schema – The schema of the optional error output port.

  • java_class_libs (list str) – Paths to JAR files containing the necessary classes to communicate with the JMS server. A single list entry may point to a JAR file or a directory.

  • connection (str) – This mandatory parameter identifies the name of the connection specification that contains an JMS element.

  • access (str) – This mandatory parameter identifies the access specification name.

  • connection_document (str) – Specifies the path name to the file that contains the connection and access specifications, which are identified by the connection and access parameters. If this parameter is not specified, the operator uses the file that is in the default location ./etc/connections.xml.

  • app_configuration_name (str) – Specifies the name of application configuration that stores client credential information, the credential specified via application configuration overrides the one specified in connections file.

  • user_property_name (str) – Specifies the property name of user name in the application configuration. If the appConfigName parameter is specified and the userPropName parameter is not set, a compile time error occurs.

  • password_property_name (str) – Specifies the property name of the password in the application configuration. If the appConfigName parameter is specified and the passwordPropName parameter is not set, a compile time error occurs.

  • ssl_connection (bool) – Specifies whether the operator should attempt to connect using SSL. If this parameter is specified, then the keyStore and trustStore parameters must also be specified.

  • ssl_debug (bool) – Enable SSL/TLS protocol debugging. If enabled all protocol data and information is logged to the console.

  • key_store (str) – Specifies the path to the keyStore. If a relative path is specified, the path is relative to the application directory.

  • key_store_password (str) – Specifies the password for the keyStore.

  • trust_store (str) – Specifies the path to the trustStore. If a relative path is specified, the path is relative to the application directory.

  • trust_store_password (str) – Specifies the password for the trustStore.

  • jms_header_properties (str) – Specifies the mapping between JMS Header property values and Streams tuple attributes. The format of the mapping is: propertyName1/streamsAttributeName1/typeSpecifier1, propertyName2/streamsAttributeName2/typeSpecifier2,…

  • codepage (str) – Specifies the code page of the target system that is used to convert ustring for a Bytes message type.

  • reconnection_policy (str) – Specifies the reconnection policy. Valid values are NoRetry, InfiniteRetry, and BoundedRetry. If the parameter is not specified, the reconnection policy is set to BoundedRetry with a reconnectionBound of 5 and a period of 60 seconds.

  • reconnection_bound (int) – Specifies the number of successive connections that are attempted for an operator. You can use this parameter only when the reconnectionPolicy parameter is specified and set to BoundedRetry, otherwise a run time error occurs. If the reconnectionBound parameter is specified and the reconnectionPolicy parameter is not set, a compile time error occurs. The default value for the reconnectionBound parameter is 5.

  • period (double) – Specifies the time period in seconds the operator waits before it tries to reconnect. You can use this parameter only when the reconnectionPolicy parameter is specified, otherwise a compile time error occurs. The default value for the period parameter is 60.

  • consistent_region_queue_name (str) – This is a required parameter if this operator is participating in a consistent region. This parameter specifies the queue to be used to store consistent region specific information and the operator will perform a JNDI lookup with the queue name specified at initialization state. The queue name specified must also exist on the same messaging server where this operator is establishing the connection.

  • max_message_send_retries (int) – Specifies the number of successive retries that are attempted for a message if a failure occurs when the message is sent. The default value is zero; no retries are attempted.

  • message_send_retry_delay (long) – Specifies the time in milliseconds to wait before the next delivery attempt. If the maxMessageSendRetries is specified, you must also specify a value for this parameter.

  • name (str) – Source name in the Streams context, defaults to a generated name.

Returns

Optional error output Stream with schema ???

streamsx.jms.consume(topology, schemas, java_class_libs, connection, access, connection_document=None, app_configuration_name=None, user_property_name=None, password_property_name=None, ssl_connection=None, ssl_debug=None, key_store=None, key_store_password=None, trust_store=None, trust_store_password=None, jms_destination_outattribute_name=None, jms_deliverymode_outattribute_name=None, jms_expiration_outattribute_name=None, jms_priority_outattribute_name=None, jms_messageid_outattribute_name=None, jms_timestamp_outattribute_name=None, jms_correlationid_outattribute_name=None, jms_replyto_outattribute_name=None, jms_type_outattribute_name=None, jms_redelivered_outattribute_name=None, jms_header_properties=None, jms_header_properties_outattribute_name=None, message_selector=None, trigger_count=None, codepage=None, reconnection_policy=None, reconnection_bound=None, period=None, name=None)

Consume messages provided by a JMS broker.

Parameters
  • topology (Topology) – The Streams topology.

  • schemas() – The schemas of the output ports. There is the mandatory data output port containing the data of the received messages and an optional error output port. The latter expecting something like the ConsumerErrorOutputSchema.

  • java_class_libs (list str) – Paths to JAR files containing the necessary classes to communicate with the JMS server. A single list entry may point to a JAR file or a directory.

  • connection (str) – This mandatory parameter identifies the name of the connection specification that contains an JMS element.

  • access (str) – This mandatory parameter identifies the access specification name.

  • connection_document (str) – Specifies the path name to the file that contains the connection and access specifications, which are identified by the connection and access parameters. If this parameter is not specified, the operator uses the file that is in the default location ./etc/connections.xml.

  • app_configuration_name (str) – Specifies the name of application configuration that stores client credential information, the credential specified via application configuration overrides the one specified in connections file.

  • user_property_name (str) – Specifies the property name of user name in the application configuration. If the appConfigName parameter is specified and the userPropName parameter is not set, a compile time error occurs.

  • password_property_name (str) – Specifies the property name of the password in the application configuration. If the appConfigName parameter is specified and the passwordPropName parameter is not set, a compile time error occurs.

  • ssl_connection (bool) – Specifies whether the operator should attempt to connect using SSL. If this parameter is specified, then the keyStore and trustStore parameters must also be specified.

  • ssl_debug (bool) – Enable SSL/TLS protocol debugging. If enabled all protocol data and information is logged to the console.

  • key_store (str) – Specifies the path to the keyStore. If a relative path is specified, the path is relative to the application directory.

  • key_store_password (str) – Specifies the password for the keyStore.

  • trust_store (str) – Specifies the path to the trustStore. If a relative path is specified, the path is relative to the application directory.

  • trust_store_password (str) – Specifies the password for the trustStore.

  • jms_destination_outattribute_name (str) – Output attribute on output data stream to assign JMSDestination to, the specified attribute in output stream must be of type rstring.

  • jms_deliverymode_outattribute_name (str) – Output attribute on output data stream to assign JMSDeliveryMode to, the specified attribute in output stream must be of type int32.

  • jms_expiration_outattribute_name (str) – Output attribute on output data stream to assign JMSExpiration to, the specified attribute in output stream must be of type int64.

  • jms_priority_outattribute_name (str) – Output attribute on output data stream to assign JMSPriority to, the specified attribute in output stream must be of type int32.

  • jms_messageid_outattribute_name (str) – Output attribute on output data stream to assign JMSMessageID to, the specified attribute in output stream must be of type rstring.

  • jms_timestamp_outattribute_name (str) – Output attribute on output data stream to assign JMSTimestamp to, the specified attribute in output stream must be of type int64.

  • jms_correlationid_outattribute_name (str) – Output attribute on output data stream to assign JMSCorrelationID to, the specified attribute in output stream must be of type rstring.

  • jms_replyto_outattribute_name (str) – Output attribute on output data stream to assign JMSReplyTo to, the specified attribute in output stream must be of type rstring.

  • jms_type_outattribute_name (str) – Output attribute on output data stream to assign JMSType to, the specified attribute in output stream must be of type rstring.

  • jms_redelivered_outattribute_name (str) – Output attribute on output data stream to assign JMSRedelivered to, the specified attribute in output stream must be of type boolean.

  • jms_header_properties (str) – Specifies the mapping between JMS Header property values and Streams tuple attributes. The format of the mapping is: propertyName1/streamsAttributeName1/typeSpecifier1, propertyName2/streamsAttributeName2/typeSpecifier2,…

  • jms_header_properties_outattribute_name (str) – Output attribute on output data stream to assign to the map containing all received properties. The specified attribute in output stream must be of type map<ustring,ustring>.

  • message_selector (str) – This optional parameter is used as JMS Message Selector.

  • trigger_count (int) – Specifies how many messages are submitted before the JMSSource operator starts to drain the pipeline and establish a consistent state. This parameter must be greater than zero and must be set if the JMSSource operator is the start operator of an operatorDriven consistent region.

  • codepage (str) – Specifies the code page of the target system that is used to convert ustring for a Bytes message type.

  • reconnection_policy (str) – Specifies the reconnection policy. Valid values are NoRetry, InfiniteRetry, and BoundedRetry. If the parameter is not specified, the reconnection policy is set to BoundedRetry with a reconnectionBound of 5 and a period of 60 seconds.

  • reconnection_bound (int) – Specifies the number of successive connections that are attempted for an operator. You can use this parameter only when the reconnectionPolicy parameter is specified and set to BoundedRetry, otherwise a run time error occurs. If the reconnectionBound parameter is specified and the reconnectionPolicy parameter is not set, a compile time error occurs. The default value for the reconnectionBound parameter is 5.

  • period (double) – Specifies the time period in seconds the operator waits before it tries to reconnect. You can use this parameter only when the reconnectionPolicy parameter is specified, otherwise a compile time error occurs. The default value for the period parameter is 60.

  • name (str) – Source name in the Streams context, defaults to a generated name.

Returns

Output Stream containing the data of the received messages. Optional Error Output Stream with schema ConsumerErrorOutputSchema.

Indices and tables