Create a Hello World streaming application that simply prints Hello
and DSX!
to the PE console of the application.
The application runs as a job in the Streaming Analytic service running on IBM Bluemix.
In [5]:
from streamsx.topology.topology import Topology
from streamsx.topology.context import *
topo = Topology("hello_dsx")
hw = topo.source(["Hello", "DSX!!"])
hw.print()
Now the application is submitted to the service, first we need to declare the VCAP services used to connect to the service.
This picks up the VCAP services from the file vcap_services.json
create by the 'Create VCAP services' notebook. That must be run once before running this notebook.
In [6]:
service_name='debrunne-streams2'
In [7]:
import json
with open('vcap_services.json') as json_data:
vs = json.load(json_data)
Now we submit the topo
object that represents the application's topology to the ANALYTICS_SERVICE
context, passing in the VCAP services information in the configuration.
In [8]:
cfg = {}
cfg[ConfigParams.VCAP_SERVICES] = vs
cfg[ConfigParams.SERVICE_NAME] = service_name
submit("ANALYTICS_SERVICE", topo, cfg)
print("Done - Submitted job!")
More text about looking for the output.