Developing and running applications that use the JMS toolkit

To create applications that use the JMS toolkit, you must configure the SPL compiler to be aware of the location of the toolkit.

Before you begin

  • Configure the product environment variables by entering the following command:
    
    source product-installation-root-directory/7.2.0.0/bin/streamsprofile.sh
    
  • Install a supported version of WebSphere MQ Client and Apache ActiveMQ on the same machine as Streams. WebSphere MQ Server might or might not be on the same machine.
    • Apache ActiveMQ
      • The JMSSource and JMSSink operators support Apache ActiveMQ 5.7 and up.
        • The Apache ActiveMQ libraries must be installed on same machine as Streams because the JMSSink and JMSSource operators require the libraries that are installed with Streams. However, the ActiveMQ instance to which a message is sent can be a different machine. You either must set the STREAMS_MESSAGING_AMQ_HOME environment variable to the location where Apache ActiveMQ is installed or use the classLibs parameter to point to your messaging provider's class libraries. For example:
          
            export STREAMS_MESSAGING_AMQ_HOME="/home/streamsuser/ApacheActiveMQ"
          
    • WebSphere MQ Server
      • The JMSSource and JMSSink operators support WebSphere MQ v7.5 and v8.0.
      • The JMSSource and JMSSink operators require the WebSphere MQ Client libraries for Java if the messaging provider is WebSphere MQ.
        • The WebSphere MQ Client libraries must be installed on the hosts where the JMS operators can be run. You either must set the STREAMS_MESSAGING_WMQ_HOME environment variable to the location where WebSphere MQ is installed or use the classLibs parameter to point to your messaging provider's class libraries. For example:
          
            export STREAMS_MESSAGING_WMQ_HOME="/opt/mqm"
          
        • Tip: When using JMS over Websphere MQ / IBM MQ in server binding mode, you may need to update LD_LIBRARY_PATH definition to .../java/lib64. Please, refer to your IBM MQ's documentation for more information.

About this task

When developing applications, you can fully qualify the operators by prefixing the namespace or include a use directive to bring the necessary namespace(s) into scope.

When compiling the application, the location of the toolkit must be communicated to the compiler.

Procedure

  1. Review the list of restrictions for the Streams specialized toolkits in the product documentation.
  2. Verify that the appropriate environment variables are set for the messaging systems that you use.
    • If you use JMSSink or JMSSource operators to connect to WebSphere MQ or Apache ActiveMQ systems, set STREAMS_MESSAGING_WMQ_HOME or STREAMS_MESSAGING_AMQ_HOME respectively.
  3. Develop your application. To avoid the need to fully qualify the operators, add a use directive in your application.
    • For example, you can add the following clause in your SPL source file:
      
        use com.teracloud.streams.jms::*;
      
      You can also specify a use clause for individual operators by replacing the asterisk (*) with the operator name. For example:
      
        use com.teracloud.streams.jms::JMSSink;
      
  4. Configure the SPL compiler to find the toolkit root directory. Use one of the following methods:
    • Set the STREAMS_SPLPATH environment variable to the root directory of a toolkit or multiple toolkits (with : as a separator). For example:
      
      export STREAMS_SPLPATH=$STREAMS_INSTALL/toolkits/com.teracloud.streams.cep
      
    • Specify the -t or --spl-path command parameter when you run the sc command. For example:
      
      sc -t $STREAMS_INSTALL/toolkits/com.teracloud.streams.cep -M MyMain
      
      where MyMain is the name of the SPL main composite.

      Note: These command parameters override the STREAMS_SPLPATH environment variable. environment variable.

  5. Build your application using the sc command.
  6. Run the application.
    • You can launch the application in stand-alone mode using the standalone program located in the output directory.
    • You can submit the application in a distributed environment, as a job, to a running Streams instance using the streamtool submitjob command or Streams Console.