New for the 4.2 release of Streams is a feature giving users the ability to securely store application specific configuration information or parameters that can be used during application authentication or connection time.

These objects, called application configurations, can now be stored securely in a Streams domain.

This article will demonstrate how to create and make use of use an application configuration object to store authentication information used to connect to a RabbitMQ server to process messages for a Streams application.

Listed below are the steps I’ll demonstrate showing how application configuration objects can be used in a Streams environment:

  • Using the Streams Console, create an application configuration object containing the connection credentials for a RabbitMQ server.
  • Using Streams Studio, modify the RabbitMQSample.spl sample file to get the RabbitMQ connection information from the application configuration object we just created.
  • Launch the RabbitMQSample application in Streams Studio showing the flow of messages from the Streams application through the RabbitMQ server using the connection credentials in the application configuration object.

Streams Console: Creating the Application Configuration object

  • Launch the Streams Console and navigate to the Management Dashboard if you are not already there.
  • Hover over the left most button in the menu bar, select the domain object, and click on the link called ‘Manage Application Configurations’.


From the Application Configuration page notice the two tabs. Make sure the tab called Application Configuration is selected. At the top of the page is a dropdown labeled ‘Scope’. If you have domain permissions this will be set to domain, if you have permissions on any instances in the domain, the drop down will also contain those instance names.

For this example we can either create an Application Configuration at the domain level, or at the instance level.

I will select an instance called rabbitInstance I created earlier.
Next, select the ‘+’ button which launches the New application configuration dialog.


Type in a name for the application configuration, RabbitMQAppConfig, give it a description if you like and then add the following in the ‘Name’ and ‘Value’ fields. You will need to do this twice, once for each property.

Name: Value:
username <your RabbitMQ user>
password <your RabbitMQ user’s password>

If you would like to save this information into a plain text properties file in case you want to upload it later to create another application configuration, toggle the checkbox called ‘Create a properties file from the application configuration’.

Now click ‘Save App Config’.


The tabbed area Application Configuration now shows the new application configuration object. To copy, edit, remove it, or to create a properties file for all the name/value pairs in the object select the gear icon in the upper right corner of the object to access these menu options.


Streams Studio: Modifying RabbitMQSample.spl to use the Application Configuration object

Several samples come as part of a Streams install, and many of them demonstrate how to use the Product Toolkits. The RabbitMQSample we will modify is under the <STREAMS_INSTALL>/ directory.

Modifying the application for your environment

Import the RabbitMQSample into Streams Studio as a sample spl application.

Open the RabbitMQSample project with the SPL Editor by right-clicking the RabbitMQSample and selecting ‘Open With’, then ‘SPL Editor’.


Modify the application by changing the following parameters for your environment:

$hostAndPort : "<your_rabbit_mq_server>:port";

After making the change build the example.

Launching the application

Now lets launch the application. Right click on the RabbitMQSample [Build: BuildConfig] object and select ‘Launch… Launch Active Build Config to Running Instance.’ Accept the default values and click the ‘Launch’ button.


Now go to the Streams Explorer view, select the Streams Jobs item and expand it to see your running job.
Right click the job and select ‘Show Instance Graph’.

Once the Instance Graph appears right click the ‘SinkOp’ operator and select ‘Show Log’, then ‘Show PE Console’.
The output should look similar to the below:

"Message: {message=\"What is friendship and why do we need it?\",routing_key=\"What is reality?\"}"
"Message: {message=\"What is friendship and why do we need it?\",routing_key=\"What is reality?\"}"
"Message: {message=\"What is friendship and why do we need it?\",routing_key=\"What is reality?\"}"
"Message: {message=\"What is friendship and why do we need it?\",routing_key=\"What is reality?\"}"
"Message: {message=\"What is friendship and why do we need it?\",routing_key=\"What is reality?\"}"
"Message: {message=\"What is friendship and why do we need it?\",routing_key=\"What is reality?\"}"

If it does not, check the console tab for errors.

It is possible your RabbitMQ server does not have a default username and password set up for connections. Make sure you have the example working correctly here before going to the next section that uses the application configuration we created earlier.
Check your RabbitMQ server configuration if you can not connect properly to RabbitMQ at this point. You may need to add the username and password parameters to the RabbitMQSample.spl file.

Modifying the application to use the Application Configuration Object

In the SPL Editor, add the following parameters in addition to those present. If you named the application configuration object you created something other than “RabbitMQAppConfig” change it to the appropriate name.

expression $userPropName : "username";
expression $passwordPropName: "password";
expression $appConfigName: "RabbitMQAppConfig";

Now build the application, and launch it again.

Check for any errors. If there are none, look at the ‘Console PE log’ of the ‘SinkOp’ and verify the messages are being received from the MQServer.

If there are errors check the following:

  • You added the above params to the RabbitMQSample.spl file.
  • The appConfigName parameter points to the correct application configuration name.
  • If you created the application configuration at the instance scope, make sure you are launching the SPL application to the proper instance. Make sure the instance is running.


This article explained and showed the following:

  • Streams Console: How to create an application configuration object containing RabbitMQ server connection information
  • Streams Studio:
    • How to modify an SPL Application to use the Application Configuration object created
    • How to launch an SPL application to a running instance and verify the RabbitMQ messages are being output


Getting Started with Streaming Analytics and RabbitMQ: This article gives additional information about using the Streaming Analytics service on Bluemix with RabbitMQ.

Join The Discussion